On Sun, 23.03.14 21:46, Patrick Donnelly (batr...@batbytes.com) wrote: > My problem is not related to race conditions. The issue is that > /proc/pid/cmdline is shown instead of /proc/pid/comm for each journal > entry. That is: > > $ journalctl --boot > [...] > Mar 23 21:39:01 host a.out[10697]: hi > Mar 23 21:39:01 host c[10697]: bye2 > [...] > > These identifiers are being pulled from cmdline or argv[0] somehow.
Yupp, the client side also sends an identifier to the server which is used if it exists. It's container in the SYSLOG_IDENTIFIER field. I figure what happens for you is that when you change argv[0] the GNU program_invocation_short_name variable is not updated, and sd-journal picks up that variable for setting SYSLOG_IDENTIFIER. > > >> #include <sys/prctl.h> > >> #include <systemd/sd-journal.h> > >> > >> int main (int argc, char *argv[]) > >> { > >> printf("%d\n", prctl(PR_SET_NAME, "foo", 0, 0, 0)); > >> sd_journal_print(LOG_INFO, "hi"); > >> strcpy(argv[0], "abc"); > >> sd_journal_print(LOG_INFO, "bye2"); > >> return 0; > >> } I figure you can fix this by changing program_invocation_short_name too: program_invocation_short_name = basename(argv[0]); See: http://linux.die.net/man/3/program_invocation_short_name If you don't update it too it will still point to the old value... p_i_s_n is used internally by glibc too btw, so it should be updated in any case if you change argv[0]. Lennart -- Lennart Poettering, Red Hat _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel