diff options
Diffstat (limited to 'libpthread/nptl')
4 files changed, 36 insertions, 1 deletions
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c b/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c index 840974401..ea22b0df2 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c @@ -22,7 +22,9 @@ #include <unistd.h> #include <sys/types.h> #include <sysdep.h> +#ifndef __UCLIBC__ #include <libio/libioP.h> +#endif #include <tls.h> #include "fork.h" #include <hp-timing.h> @@ -42,10 +44,17 @@ struct fork_handler *__fork_handlers; static void fresetlockfiles (void) { +#ifdef __UCLIBC__ + FILE *fp; + + for (fp = _stdio_openlist; fp != NULL; fp = fp->__nextopen) + _IO_lock_init(fp->_lock); +#else _IO_ITER i; for (i = _IO_iter_begin(); i != _IO_iter_end(); i = _IO_iter_next(i)) _IO_lock_init (*((_IO_lock_t *) _IO_iter_file(i)->_lock)); +#endif } @@ -111,7 +120,11 @@ __libc_fork (void) break; } +#ifdef __UCLIBC__ + _IO_lock_lock (_stdio_openlist_lock); +#else _IO_list_lock (); +#endif #ifndef NDEBUG pid_t ppid = THREAD_GETMEM (THREAD_SELF, tid); @@ -155,10 +168,16 @@ __libc_fork (void) fresetlockfiles (); /* Reset locks in the I/O code. */ +#ifdef __UCLIBC__ + _IO_lock_init (_stdio_openlist_lock); +#else _IO_list_resetlock (); +#endif +#ifndef __UCLIBC__ /* Reset the lock the dynamic loader uses to protect its data. */ __rtld_lock_initialize (GL(dl_load_lock)); +#endif /* Run the handlers registered for the child. */ while (allp != NULL) @@ -190,7 +209,11 @@ __libc_fork (void) THREAD_SETMEM (THREAD_SELF, pid, parentpid); /* We execute this even if the 'fork' call failed. */ +#ifdef __UCLIBC__ + _IO_lock_unlock(_stdio_openlist_lock); +#else _IO_list_unlock (); +#endif /* Run the handlers registered for the parent. */ while (allp != NULL) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/internaltypes.h b/libpthread/nptl/sysdeps/unix/sysv/linux/internaltypes.h index 1dec19e57..7da94d860 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/internaltypes.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/internaltypes.h @@ -21,6 +21,9 @@ #define _INTERNALTYPES_H 1 #include <stdint.h> +#ifdef __UCLIBC__ +#include <sched.h> +#endif struct pthread_attr diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/pt-vfork.S b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/pt-vfork.S index fe2b81bc1..f82504329 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/pt-vfork.S +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/pt-vfork.S @@ -16,6 +16,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include <features.h> #include <tls.h> /* Save the PID value. */ @@ -34,4 +35,10 @@ sw a2, PID_OFFSET(v1); /* Restore the PID. */ \ 1: +#ifdef __UCLIBC__ +#undef weak_alias +#define weak_alias(name, aliasname) +#include <../../../../../../../libc/sysdeps/linux/mips/vfork.S> +#else #include <../sysdeps/unix/sysv/linux/mips/vfork.S> +#endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c b/libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c index a1e228ee2..8569ef0bf 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c @@ -18,7 +18,9 @@ 02111-1307 USA. */ #include <unistd.h> - +#ifdef __UCLIBC__ +extern pid_t __libc_fork(void); +#endif pid_t __fork (void) |