aboutsummaryrefslogtreecommitdiffstats
path: root/lib/os_mon/c_src/memsup.c
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2012-07-25 16:08:41 +0200
committerBjörn-Egil Dahlberg <[email protected]>2012-07-25 16:08:41 +0200
commit9f6993fb41a8d14111325779c14968556b4f7f83 (patch)
tree8f42ab42bc24104d17955d61940111ed2fa36033 /lib/os_mon/c_src/memsup.c
parentc0cb221de152593a36c4468e0f46abd0b37afae2 (diff)
parent0da1a7be25ec7ae3a185dd69d3e3d6e1f5401dbb (diff)
downloadotp-9f6993fb41a8d14111325779c14968556b4f7f83.tar.gz
otp-9f6993fb41a8d14111325779c14968556b4f7f83.tar.bz2
otp-9f6993fb41a8d14111325779c14968556b4f7f83.zip
Merge branch 'egil/change-os_mon-ports-error-messages/OTP-10161' into maint
* egil/change-os_mon-ports-error-messages/OTP-10161: os_mon: Elucidate port program error messages
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);
}
-
-
-
-
-