Subject: Re: vfork in C++?
To: Jason R Thorpe <thorpej@wasabisystems.com>
From: Andrew Cagney <cagney@mac.com>
List: current-users
Date: 11/29/2002 14:06:47
> On Sat, Nov 23, 2002 at 08:01:10PM -0800, Jason R Thorpe wrote:
>
> > > /usr/lib/libstdc++.so: warning: reference to compatibility vfork(); include <unistd.h> for correct reference
> >
> > Well, it tells you precisely what needs to happen -- <unistd.h> needs to
> > be included by the source file using vfork().
> >
> > This warning does not happen on a -current system, but the toolchain has
> > not changed... and I don't see a reference to vfork in the libstdc++ sources,
> > however it is there in the object... hm.
>
> Ah, it was right under my nose:
>
> ./libio/iopopen.c:#define _IO_fork vfork /* defined in libiberty, if needed */
>
> -current does indeed include <unistd.h> to get the correct vfork reference,
> ...and apparently the netbsd-1-6 branch does, as well:
Well, I just re-built 1-6 and still get the warning. Appears to be a
bit of a gap between the theory and reality :-/
The declaration (<unistd.h>) looks to be wrapped in the (false) expression:
228 #if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
229 (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED))
|| \
230 (_XOPEN_SOURCE - 0) >= 500
Poking around with:
# /home/tmp/TOOLDIR/bin/powerpc--netbsd-gcc -O2 -Werror -nostdinc++
-I/usr/src/gnu/lib/libstdc++/arch/powerpc
-I/usr/src/gnu/lib/libstdc++/../../dist/toolchain/libio
-I/usr/src/gnu/lib/libstdc++/../../dist/toolchain/libstdc++
-I/usr/src/gnu/lib/libstdc++/../../dist/toolchain/libstdc++/stl
-I/usr/src/gnu/lib/libstdc++/../../dist/toolchain/libstdc++/../libio
-I/usr/src/gnu/lib/libstdc++/../../dist/toolchain/gcc/cp/inc
-I/usr/src/gnu/lib/libstdc++/../libiberty
-I/usr/src/gnu/lib/libstdc++/../../dist/toolchain/include -nostdinc
-isystem /home/tmp/DESTDIR/usr/include -c -fPIC -DPIC
/usr/src/gnu/lib/libstdc++/../../dist/toolchain/libio/iopopen.c -E -dD
Indicates:
extern _G_pid_t vfork (void) ;
((_IO_proc_file *) fp)->pid = child_pid = vfork ();
(that's the declaration found in iopopen.c) and only
#define _POSIX_C_SOURCE 1L
is defined.
Andrew
> symbolic names:
> netbsd-1-6-RELEASE: 1.2
> netbsd-1-6-RC3: 1.2
> netbsd-1-6-RC2: 1.2
> netbsd-1-6-RC1: 1.2
> netbsd-1-6: 1.2.0.2
> netbsd-1-6-base: 1.2
> gcc-2-95-3: 1.1.1.1
> gcc-2-95-2: 1.1.1.1
> FSF: 1.1.1
> keyword substitution: o
> total revisions: 3; selected revisions: 3
> description: