[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Process::spawn
From: |
Ian Gough |
Subject: |
Process::spawn |
Date: |
Tue, 21 Jan 2003 12:30:55 -0500 |
I was taking another
look at Process::spawn and I think it might have some implementation
issues.
1) wait4 has an
option value of 0. This prevents it from detecting that the process on which it
waits has been terminated by a signal such as SIGSTOP. I noticed that spawn did
not exit when I killed the spawned process with 'kill'. Perhaps the option value
should be WUNTRACED.
From the man page on
wait4 on Mac OS X:
"If the WUNTRACED
option is set, children of the current process that are stopped due to a
SIGTTIN, SIGTTOU,
SIGTSTP, or
SIGSTOP signal also have their status reported."
3) The vfork child
calls execvp and then exit. It should probably check for an exec error and
call _exit(). From the man page:
Vfork() can normally
be used just like fork. It does not work,
however,
to return while running in the childs
context from the procedure that
called vfork() since
the eventual return from vfork() would then return
to a no longer existent stack frame. Be careful, also, to call
_exit
rather than exit if you can't execve, since
exit will flush and close
standard I/O channels, and
thereby mess up the parent processes standard
I/O
data structures. (Even with fork it is wrong to call exit
since
buffered data would then be flushed
twice.)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Process::spawn,
Ian Gough <=