aboutsummaryrefslogtreecommitdiffstats
path: root/lib/os_mon/c_src/memsup.c
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2012-07-24 17:03:01 +0200
committerBjörn-Egil Dahlberg <[email protected]>2012-07-24 17:14:16 +0200
commit0da1a7be25ec7ae3a185dd69d3e3d6e1f5401dbb (patch)
tree36721a788d0b7d985634042e88deb2f79f232047 /lib/os_mon/c_src/memsup.c
parent92eb89bd630e822cfc93a07dad7d6c7a25f45d63 (diff)
downloadotp-0da1a7be25ec7ae3a185dd69d3e3d6e1f5401dbb.tar.gz
otp-0da1a7be25ec7ae3a185dd69d3e3d6e1f5401dbb.tar.bz2
otp-0da1a7be25ec7ae3a185dd69d3e3d6e1f5401dbb.zip
os_mon: Elucidate port program error messages
Try to avoid confusion of the message 'Erlang has closed' by clarifying that the message is sent from os_mon port programs.
Diffstat (limited to 'lib/os_mon/c_src/memsup.c')
-rw-r--r--lib/os_mon/c_src/memsup.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/lib/os_mon/c_src/memsup.c b/lib/os_mon/c_src/memsup.c
index 078f20ff98..593a066f98 100644
--- a/lib/os_mon/c_src/memsup.c
+++ b/lib/os_mon/c_src/memsup.c
@@ -493,7 +493,7 @@ get_basic_mem(unsigned long *tot, unsigned long *used, unsigned long *pagesize){
#elif defined(__linux__) && !defined(_SC_AVPHYS_PAGES)
memory_ext me;
if (get_mem_procfs(&me) < 0) {
- print_error("ProcFS read error.");
+ print_error("ProcFS read error");
exit(1);
}
*tot = me.total;
@@ -582,7 +582,7 @@ message_loop(int erlin_fd)
* Wait for command from Erlang
*/
if ((res = read(erlin_fd, &cmdLen, 1)) < 0) {
- print_error("Error reading from Erlang.");
+ print_error("Error reading from Erlang");
return;
}
@@ -603,19 +603,19 @@ message_loop(int erlin_fd)
break;
case 0:
- print_error("Erlang has closed.");
+ print_error("Erlang has closed");
return;
default:
- print_error("Error reading from Erlang.");
+ print_error("Error reading from Erlang");
return;
} /* switch() */
} else { /* cmdLen != 1 */
- print_error("Invalid command length (%d) received.", cmdLen);
+ print_error("Invalid command length (%d) received", cmdLen);
return;
}
} else { /* Erlang end closed */
- print_error("Erlang has closed.");
+ print_error("Erlang has closed");
return;
}
}
@@ -641,15 +641,12 @@ static void
print_error(const char *format,...)
{
va_list args;
+ char buffer[256];
va_start(args, format);
- fprintf(stderr, "%s: ", program_name);
- vfprintf(stderr, format, args);
+ vsnprintf(buffer, 256, format, args);
va_end(args);
- fprintf(stderr, " \n");
+ /* try to use one write only */
+ fprintf(stderr, "[os_mon] memory supervisor port (memsup): %s\r\n", buffer);
+ fflush(stderr);
}
-
-
-
-
-