[uClibc]libpthread and vfork

Gregory Nutt spudmonkey at racsa.co.cr
Fri Jan 31 14:36:29 UTC 2003


Hi, again,

As a clarification, the ENOSYS doesn't come from the kernel's fork 
system call, it comes from uClibc/libc/sysdeps/linux/common/syscalls.c 
(in using version 0.9.15):

#ifdef L___libc_fork
#include <unistd.h>
#   ifdef __UCLIBC_HAS_MMU__
#define __NR___libc_fork __NR_fork
         _syscall0(pid_t, __libc_fork);
         weak_alias (__libc_fork, fork)
#   else
         pid_t fork(void)
         {
             __set_errno(ENOSYS);
             return -1;
         }
#   endif
#endif

Greg

>Has any experienced this:
>
>1. Build a program that includes libpthread (before libc of course), and
>2. The program calls vfork() on a uClinux system (which does not not 
>support fork)
>
>When I do this, vfork() fails with errno=ENOSYS. I believe that this 
>because the libpthread replaces vfork with its own vfork:
>
>pid_t __vfork(void)
>{
>  return __fork();
>}
>weak_alias (__vfork, vfork);
>
>__fork in turns calls __lib_fork in libc.  The fork system call returns 
>ENOSYS.  At least that is what I think happening.




More information about the uClibc mailing list