Thread: get exit status of unrelated defunct process

  1. #1
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445

    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.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

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

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

    Soma
    “Salem Was Wrong!” -- Pedant Necromancer
    “Four isn't random!” -- Gibbering Mouther

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    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.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  4. #4
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    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
    “Salem Was Wrong!” -- Pedant Necromancer
    “Four isn't random!” -- Gibbering Mouther

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, 11:26 AM
  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, 07:37 AM