This is the mail archive of the
libc-hacker@cygnus.com
mailing list for the glibc project.
Re: vfork specs
- To: drepper@cygnus.com
- Subject: Re: vfork specs
- From: Stanislav Meduna <stano@trillian.eunet.sk>
- Date: Sat, 16 Jan 1999 10:21:06 +0100 (CET)
- Cc: libc-alpha@cygnus.com, linux-gcc@vger.rutgers.edu, linux-kernel@vger.rutgers.edu
> Assume this:
>
> void
> bar ()
> {
> pid_t p = baz ();
> if (p == 0)
> foo (0);
> }
> pid_t
> baz ()
> {
> return vfork ();
> }
The Single Unix Specification says:
: The vfork() function has the same effect as fork(),
: except that the behaviour is undefined if the process
: created by vfork() either modifies any data other than
: a variable of type pid_t used to store the return value
: from vfork(), or returns from the function in which
: vfork() was called, or calls any other function before
: successfully calling _exit() or one of the exec family
: of functions.
So this one is (if I interpret it correctly)
definitly bad code.
Regards
--
Stano