trinity-devel@lists.pearsoncomputing.net

Message: previous - next
Month: March 2012

Re: [trinity-devel] fprintf(stderr, "tdeinit: PID %ld terminated.\n", (long) exit_pid);

From: "Timothy Pearson" <kb9vqf@...>
Date: Fri, 2 Mar 2012 12:04:00 -0600
> On 2 March 2012 09:17, Aleksey Midenkov <midenok@...> wrote:
>> On Fri, Mar 2, 2012 at 8:12 AM, Darrell Anderson
>> <humanreadable@...> wrote:
>>> This message is from tdelibs/kinit/kinit.cpp. They appear in the
>>> xession log.
>>>
>>> I don't mind the messages and I can see from the source code they are
>>> intended to be debugging aids.
>>>
>>> But they lack information. How do I add the process name to the
>>> message?
>>>
>>> Like this:
>>>
>>> PID 10804 (process name) terminated.
>>>
>>> With that information the message might remain useful only for
>>> debugging, but at least the message appears more useful and
>>> informational to users.
>>>
>>
>> You can consult /proc/<PID>/cmdline contents.
>>
>
> Yeah this is the way to do it - but it's not portable is it?
>
> Calvin

Use an #ifdef for POSIX systems to enable extra information from
/proc/<PID>, and keep the original code for non-POSIX systems.  This type
of code is present in a few places in tdelibs already.

Tim