![]() | |||||||||||||
Messages in this thread |
The following code
/* foo.c */
#include <sys/wait.h>
main() {
int pid = fork();
int val;
if(pid == 0) {
sleep(5);
exit(0);
}
wait4(-1,&val,WNOHANG,NULL);
}
does NOT work when traced:
# strace -f foo
[...]
personality(PER_LINUX) = 0
fork() = 21389
[pid 21388] wait4(-1, <unfinished ...>
[pid 21389] nanosleep(0xbffff8f8, 0xbffff8f8, 0x40091770, 0x1, 0x80485ac) = 0
[pid 21389] _exit(0) = ?
<... wait4 resumed> 0xbffff90c, WNOHANG, NULL) = 0
_exit(0) = ?
The main program returns immediately when I'm not tracing.
Ideas, anybody?
--
How come only your friends step on your new white sneakers?
--
Matthias Urlichs \ noris network GmbH / Xlink-POP Nürnberg
Schleiermacherstraße 12 \ Linux+Internet / EMail: urlichs@noris.de
90491 Nürnberg (Germany) \ Consulting+Programming+Networking+etc'ing
PGP: 1024/4F578875 1B 89 E2 1C 43 EA 80 44 15 D2 29 CF C6 C7 E0 DE
Click <A HREF="http://info.noris.de/~smurf/finger">here</A>. 42
| ||||||||||||
| Last update: 2005-03-22 12:38 [from the cache] ©2003-2008 | |||||||||||||