tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: vfork on Oracle Solaris 11.2



Ryo ONODERA wrote:
> I am working on Oracle JRE/JDK 8u45 packages.
> I would like to test these packages on Oracle Solaris 11.2,
> but 11.2's vfork(2) is deprecated and I cannot compile
> sysutils/bsdinstall during pkgsrc bootstrap.
> 
> How to resolve my problem?
> Should vfork be replaced by fork?
> 
> The error message is here.
> 
> ===> Building for bsdinstall-20130905
> gcc -O2  -Werror  -D_PATH_DEVNULL=\"/dev/null\" -DTARGET_STRIP=\"/usr/ccs/bin/strip\" -DHAVE_NBCOMPAT_H=1 -I/usr/tmp/pkgsrc/bs/wrk/sysutils/bsdinstall/work/libnbcompat -c bsdinstall.c
> cc1: warnings being treated as errors
> bsdinstall.c: In function 'strip':
> bsdinstall.c:1038:2: error: 'vfork' is deprecated (declared at /usr/include/unistd.h:531)
> bsdinstall.c: In function 'afterinstall':
> bsdinstall.c:1077:2: error: 'vfork' is deprecated (declared at /usr/include/unistd.h:531)
> *** [bsdinstall.o] Error code 1
> 

I libc
It depends whether vfork(2) exists in Solaris 11.2 but
for some reason it's declared with a warning/error flag. If so
then Autotools is misguided with this as it discovers correctly
that there is vfork(2) in the system and assumes it's existence.

This implies that libc is wrong on Oracle Solaris 11.2.

II sysutils/bsdinstall
I would implement a fall-back in <nbcompat/unistd.h> and call
fork(2) when vfork(2) is unsupported.

--- files/bsdinstall.c  3 Sep 2013 15:27:38 -0000       1.2
+++ files/bsdinstall.c  30 May 2015 12:43:05 -0000
@@ -86,11 +86,12 @@
 #include <stdlib.h>
 #endif
 #include <string.h>
-#include <unistd.h>
 #if defined(HAVE_NBCOMPAT_H)
+#include <nbcompat/unistd.h>
 #include <nbcompat/util.h>
 #include <nbcompat/vis.h>
 #else
+#include <unistd.h>
 #include <util.h>
 #include <vis.h>
 #endif


Then introduce the following change in nbcompat:
RCS file: /public/netbsd-rsync/pkgsrc/pkgtools/libnbcompat/files/nbcompat/unistd.h,v
retrieving revision 1.4
diff -u -r1.4 unistd.h
--- files/nbcompat/unistd.h     29 Apr 2008 05:46:08 -0000      1.4
+++ files/nbcompat/unistd.h     30 May 2015 12:38:28 -0000
@@ -81,4 +81,8 @@
 void   strmode(mode_t, char *);
 #endif
 
+#if !HAVE_WORKING_VFORK && HAVE_WORKING_FORK
+#define        vfork fork
+#endif
+
 #endif /* !_NBCOMPAT_UNISTD_H_ */


If we are without fork(2) then we have trouble being in a POSIX system.
It's probably not our job to emulate it like Cygwin does on Windows.

III Handle Solaris 11.2 case

There is already a macro AC_FUNC_VFORK

I can see the following possible solutions:
1. Pass to configure env for the Solaris 11.2 case: ac_cv_func_vfork_works=no
2. Fix autotools' tests for Solaris 11.2 underneath AC_FUNC_VFORK and emit HAVE_WORKING_VFORK=no
3. Replace AC_FUNC_VFORK with hand-written version discovering vfork(2)


Standards
vfork(2) was marked obsolescent in "The Open Group Base Specifications Issue 6"
with the following comment "This function may be withdrawn in a future version."
I cannot find it in Issue 7.

http://pubs.opengroup.org/onlinepubs/009695399/functions/vfork.html


Home | Main Index | Thread Index | Old Index