get exit status of unrelated defunct process

This is a discussion on get exit status of unrelated defunct process within the Linux Programming forums, part of the Platform Specific Boards category; just like the title says, I'm looking for a way to get the exit status (return code from exit/main), via ...

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    2,590

    get exit status of unrelated defunct process

    just like the title says, I'm looking for a way to get the exit status (return code from exit/main), via /proc or any other means, of a process that was not started from the shell. in one of my big projects, I am recently having issues with a lot of zombie processes not being collected by the parent, and if I could get the exit status, I could track down exactly what's causing it. it took the machine down completely and caused a kernel panic once last week, so it's fairly important that I find the cause, but I'm unable to do so thus far.
    Code:
    namespace life
    {
        const bool change = true;
    }

  2. #2
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,415
    O_o

    I'm relatively sure that the only way would be to enable process accounting and just reading the generated file.

    Soma
    “Often out of periods of losing come the greatest strivings toward a new winning streak.” -- Fred Rogers
    “Salem Was Wrong!” -- Pedant Necromancer

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    2,590
    I enabled process accounting on the offending machine, and after a little poking around, got a program working that can read the pacct file, and can show me the exit status. The only problem is that the machine is running fedora 15, which is old enough that it does not support process accounting version 3, and as a result, the file does not contain process IDs. It seems strange to me that process ID would be the most obvious field you'd want in that file. This is more frustrating than usual, given the fact that there appears to be no way to make it work the way I need it to.
    Code:
    namespace life
    {
        const bool change = true;
    }

  4. #4
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,415
    O_o

    Well, I don't know what to say really; I know I used it before I switched out my flavor of "GNU/Linux" (I'm using "Arch" these days.), and to be honest, I'm shocked that "Fedora 15" doesn't have the patches applied. (The release predates "Fedora 15" by a few years according to the wiki on "Fedora".) That said, I poked a few things into "Google" and got a few possible patches that might work for you, and as you are on "Fedora", I can't help anymore beyond that.

    To be clear here, I'm still saying that process accounting is your best bet even if you have to patch/upgrade a couple of tools; I can think of a few ways to hack "systemd"/"cron" that might work, but you'd be shooting at a moving target and possibly botching the install in the process.

    Soma
    “Often out of periods of losing come the greatest strivings toward a new winning streak.” -- Fred Rogers
    “Salem Was Wrong!” -- Pedant Necromancer

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. collect2: ld returned 1 exit status
    By Bryce Miller in forum C++ Programming
    Replies: 9
    Last Post: 02-28-2012, 10:28 PM
  2. collect2: ld returned 1 exit status error??
    By blindchicken11 in forum C Programming
    Replies: 11
    Last Post: 11-07-2011, 08:38 PM
  3. ld returned 1 exit status
    By madennn in forum C Programming
    Replies: 14
    Last Post: 03-29-2011, 12:26 PM
  4. ERROR collect2: ld returned 1 exit status
    By meili100 in forum C++ Programming
    Replies: 13
    Last Post: 12-04-2007, 12:20 PM
  5. execv and defunct process
    By groorj in forum C Programming
    Replies: 5
    Last Post: 08-05-2005, 08:37 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21