Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.development.apps > #139
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail |
|---|---|
| From | pacman@kosh.dhis.org (Alan Curry) |
| Newsgroups | comp.os.linux.development.apps, comp.os.linux.development.system |
| Subject | Re: Status = 2943 from waitpid? |
| Date | Thu, 9 Jun 2011 06:03:18 +0000 (UTC) |
| Organization | Aioe.org NNTP Server |
| Lines | 41 |
| Message-ID | <ispnn6$ht9$1@speranza.aioe.org> (permalink) |
| References | <033817d4-c109-4d37-a476-f7710b7ed829@a10g2000vbz.googlegroups.com> |
| NNTP-Posting-Host | R3O4l+EuNlE9axVePMkncg.user.speranza.aioe.org |
| X-Complaints-To | abuse@aioe.org |
| Originator | pacman@kosh.dhis.org (Alan Curry) |
| X-Notice | Filtered by postfilter v. 0.8.2 |
| X-Newsreader | trn 4.0-test76 (Apr 2, 2001) |
| Xref | x330-a1.tempe.blueboxinc.net comp.os.linux.development.apps:139 comp.os.linux.development.system:157 |
Cross-posted to 2 groups.
Show key headers only | View raw
In article <033817d4-c109-4d37-a476-f7710b7ed829@a10g2000vbz.googlegroups.com>,
Jeffrey Walton <noloader@gmail.com> wrote:
>Hi All,
>
>I'm ptrace'ing a process. After fork/exec and then a wait on the
>child, I'm getting a status of 2943. I'm testing for failure, but
>waitpid reports non-failure. I've looked in <sys/wait.h>, but the
>value 2943 is not defined and does not appear to be a bit mask.
Don't try to pick apart the bits by hand and especially don't try to treat
the glibc header files as human-readable. <sys/wait.h> provides macros that
you can use in C code to determine what an exit status means. So write the C
code. Trying to parse <sys/wait.h> with your pathetic human brain will lead
to frustration.
#include <stdio.h>
#include <string.h>
#include <sys/wait.h>
int main(void)
{
int status = 2943;
if(WIFEXITED(status)) {
printf("Exit status %d\n", WEXITSTATUS(status));
} else if(WIFSIGNALED(status)) {
printf("Terminated by signal %d (%s)%s\n",
WTERMSIG(status),
strsignal(WTERMSIG(status)),
WCOREDUMP(status)?" (core dumped)":"");
} else if(WIFSTOPPED(status)) {
printf("Stopped by signal %d (%s)\n",
WSTOPSIG(status),
strsignal(WSTOPSIG(status)));
} else if(WIFCONTINUED(status)) {
printf("Continued\n");
}
}
--
Alan Curry
Back to comp.os.linux.development.apps | Previous | Next — Previous in thread | Next in thread | Find similar
Status = 2943 from waitpid? Jeffrey Walton <noloader@gmail.com> - 2011-06-08 21:57 -0700
Re: Status = 2943 from waitpid? pacman@kosh.dhis.org (Alan Curry) - 2011-06-09 06:03 +0000
Re: Status = 2943 from waitpid? Jeffrey Walton <noloader@gmail.com> - 2011-06-09 05:27 -0700
Re: Status = 2943 from waitpid? Rainer Weikusat <rweikusat@mssgmbh.com> - 2011-06-09 13:51 +0100
Re: Status = 2943 from waitpid? Shankar <shankarke@gmail.com> - 2011-06-09 23:25 -0700
Re: Status = 2943 from waitpid? Rainer Weikusat <rweikusat@mssgmbh.com> - 2011-06-10 15:04 +0100
csiph-web