summaryrefslogtreecommitdiffstats
path: root/libpthread/nptl/sysdeps/unix/sysv
diff options
context:
space:
mode:
Diffstat (limited to 'libpthread/nptl/sysdeps/unix/sysv')
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in101
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/fork.c13
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c14
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/i386/fork.c1
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c3
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch5
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c1
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/pt-raise.c9
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/pthread_getaffinity.c4
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/raise.c7
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/sigwaitinfo.c4
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/sleep.c150
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/timer_create.c2
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c2
14 files changed, 110 insertions, 206 deletions
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in
index a39ada190..0c73e61c2 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in
@@ -5,25 +5,38 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-libpthread_CSRC = pt-raise.c pthread_attr_getaffinity.c \
- pthread_attr_setaffinity.c pthread_getaffinity.c \
- pthread_getcpuclockid.c pthread_kill.c \
- pthread_mutex_cond_lock.c pthread_setaffinity.c \
- pthread_yield.c sem_post.c sem_timedwait.c \
- sem_trywait.c sem_wait.c pt-fork.c \
- sigtimedwait.c sigwaitinfo.c sigwait.c sleep.c
-
-libpthread_SSRC = #ptw-close.S ptw-open.S ptw-waitid.S ptw-waidpid.S ptw-write.S
-
-libc_CSRC = libc_pthread_init.c libc_multiple_threads.c \
- register-atfork.c unregister-atfork.c getpid.c \
- raise.c sleep.c
-
-libc_SSRC = #close.S open.S waitid.S waidpid.S write.S
+libpthread_CSRC := pt-raise.c pthread_attr_getaffinity.c \
+ pthread_attr_setaffinity.c pthread_getaffinity.c \
+ pthread_getcpuclockid.c pthread_kill.c \
+ pthread_mutex_cond_lock.c pthread_setaffinity.c \
+ pthread_yield.c sem_post.c sem_timedwait.c \
+ sem_trywait.c sem_wait.c pt-fork.c \
+ sigtimedwait.c sigwaitinfo.c pt-sigwait.c pt-sleep.c \
+ pt-msgsnd.c pt-msgrcv.c pt-waitpid.c pt-wait.c \
+ pt-open64.c pt-tcdrain.c pt-fcntl.c pt-pread_pwrite.c \
+ pt-llseek.c pt-fsync.c
+
+libpthread_SSRC := pt-close.S pt-open.S pt-read.S pt-write.S \
+ pt-nanosleep.S pt-pause.S pt-lseek.S pt-accept.S \
+ pt-connect.S pt-recv.S pt-recvfrom.S pt-recvmsg.S \
+ pt-send.S pt-sendmsg.S pt-sendto.S
+
+libc_CSRC := libc_pthread_init.c libc_multiple_threads.c \
+ register-atfork.c unregister-atfork.c getpid.c \
+ raise.c sleep.c
+
+libc_SSRC := exit-thread.S close.S open.S read.S write.S nanosleep.S \
+ creat.S pause.S msync.S lseek.S accept.S connect.S recv.S \
+ recvfrom.S recvmsg.S send.S sendmsg.S sendto.S
+
+librt_CSRC := mq_notify.c timer_create.c timer_delete.c \
+ timer_getoverr.c timer_gettime.c timer_routines.c \
+ timer_settime.c
ifeq ($(TARGET_ARCH),alpha)
libpthread_CSRC += lowlevellock.c
libc_CSRC += libc-lowlevellock.c
+librt_CSRC := mq_notify.c
endif
ifeq ($(TARGET_ARCH),mips)
@@ -34,15 +47,29 @@ endif
ifeq ($(TARGET_ARCH),powerpc)
libpthread_CSRC += lowlevellock.c
libc_CSRC += libc-lowlevellock.c
+librt_CSRC := mq_notify.c
endif
ifeq ($(TARGET_ARCH),sparc)
libpthread_CSRC += lowlevellock.c
libc_CSRC += libc-lowlevellock.c
+librt_CSRC := mq_notify.c
+endif
+
+ifeq ($(TARGET_ARCH),x86_64)
+librt_CSRC := mq_notify.c
endif
-CFLAGS-pt-fork.c = -D_GNU_SOURCE
-CFLAGS-pthread_getcpuclockid.c = -I$(top_srcdir)/librt
+CFLAGS-pthread_getcpuclockid.c = -I$(top_srcdir)librt
+CFLAGS-pt-pread_pwrite.c = -I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH) \
+ -I$(top_srcdir)libc/sysdeps/linux/common
+CFLAGS-mq_notify.c = -I$(top_srcdir)librt -DIS_IN_librt=1
+CFLAGS-timer_create.c = -I$(top_srcdir)librt -DIS_IN_librt=1
+CFLAGS-timer_delete.c = -I$(top_srcdir)librt -DIS_IN_librt=1
+CFLAGS-timer_getoverr.c = -I$(top_srcdir)librt -DIS_IN_librt=1
+CFLAGS-timer_gettime.c = -I$(top_srcdir)librt -DIS_IN_librt=1
+CFLAGS-timer_routines.c = -I$(top_srcdir)librt -DIS_IN_librt=1
+CFLAGS-timer_settime.c = -I$(top_srcdir)librt -DIS_IN_librt=1
CFLAGS-linux = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 $(SSP_ALL_CFLAGS)
#CFLAGS:=$(CFLAGS:-O1=-O2)
@@ -55,6 +82,31 @@ CFLAGS-OMIT-getpid.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-OMIT-raise.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-OMIT-sleep.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-OMIT-libc-lowlevellock.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-exit-thread.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-close.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-open.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-read.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-write.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-nanosleep.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-creat.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-pause.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-accept.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-connect.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-recv.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-recvfrom.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-recvmsg.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-send.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-sendmsg.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-sendto.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-lseek.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-msync.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-mq_notify.c = -DIS_IN_libpthread=1
+CFLAGS-OMIT-timer_create.c = -DIS_IN_libpthread=1
+CFLAGS-OMIT-timer_delete.c = -DIS_IN_libpthread=1
+CFLAGS-OMIT-timer_getoverr.c = -DIS_IN_libpthread=1
+CFLAGS-OMIT-timer_gettime.c = -DIS_IN_libpthread=1
+CFLAGS-OMIT-timer_routines.c = -DIS_IN_libpthread=1
+CFLAGS-OMIT-timer_settime.c = -DIS_IN_libpthread=1
PTHREAD_LINUX_DIR := $(top_srcdir)/libpthread/nptl/sysdeps/unix/sysv/linux
PTHREAD_LINUX_OUT := $(top_builddir)/libpthread/nptl/sysdeps/unix/sysv/linux
@@ -64,17 +116,20 @@ PTHREAD_LINUX_OBJ += $(patsubst %.S,$(PTHREAD_LINUX_OUT)/%.o,$(libpthread_SSRC))
libpthread-a-y += $(PTHREAD_LINUX_OBJ)
libpthread-so-y += $(PTHREAD_LINUX_OBJ:.o=.oS)
-
libpthread-nomulti-y += $(PTHREAD_LINUX_OBJ)
LIBC_LINUX_OBJ := $(patsubst %.c,$(PTHREAD_LINUX_OUT)/%.o,$(libc_CSRC))
LIBC_LINUX_OBJ += $(patsubst %.S,$(PTHREAD_LINUX_OUT)/%.o,$(libc_SSRC))
-libc-a-y += $(LIBC_LINUX_OBJ)
-libc-so-y += $(LIBC_LINUX_OBJ:.o=.oS)
-
+libc-static-y += $(LIBC_LINUX_OBJ)
+libc-shared-y += $(LIBC_LINUX_OBJ:.o=.oS)
libc-nomulti-y += $(LIBC_LINUX_OBJ)
+LIBRT_LINUX_OBJ := $(patsubst %.c,$(PTHREAD_LINUX_OUT)/%.o,$(librt_CSRC))
+
+librt-a-y += $(LIBRT_LINUX_OBJ)
+librt-so-y += $(LIBRT_LINUX_OBJ:.o=.oS)
+
objclean-y += nptl_linux_objclean
headers_clean-y += nptl_linux_headers_clean
@@ -122,10 +177,6 @@ $(PTHREAD_LINUX_OUT)/lowlevelrwlock.h: $(PTHREAD_LINUX_OUT)/lowlevelrwlock.s
$(PTHREAD_LINUX_OUT)/unwindbuf.h: $(PTHREAD_LINUX_OUT)/unwindbuf.s
@sed -n "s/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$\/#define \1 \2/p" $< > $@
-ptw-%.oS:
- $(PTHREAD_LINUX_OUT)/sjh.sh $* > $(PTHREAD_LINUX_OUT)/tmp.S
- $(compile.S) -x assembler-with-cpp tmp.S
-
nptl_linux_headers:
$(MAKE) $(PTHREAD_LINUX_OUT)/lowlevelbarrier.h
$(MAKE) $(PTHREAD_LINUX_OUT)/lowlevelcond.h
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c b/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c
index 7586de8a4..5d894225a 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c
@@ -19,6 +19,7 @@
#include <assert.h>
#include <stdlib.h>
+#include <syscall.h>
#include <unistd.h>
#include <sys/types.h>
#include <sysdep.h>
@@ -26,7 +27,6 @@
#include "fork.h"
#include <hp-timing.h>
#include <ldsodefs.h>
-#include <bits/stdio-lock.h>
#include <atomic.h>
#include <errno.h>
@@ -59,9 +59,8 @@ fresetlockfiles (void)
#endif
}
-
-pid_t
-__libc_fork (void)
+extern __typeof(fork) __libc_fork;
+pid_t __libc_fork (void)
{
pid_t pid;
struct used_handler
@@ -228,6 +227,6 @@ __libc_fork (void)
return pid;
}
-weak_alias (__libc_fork, __fork)
-hidden_def (__fork)
-weak_alias (__libc_fork, fork)
+libc_hidden_proto(fork)
+weak_alias(__libc_fork,fork)
+libc_hidden_weak(fork)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c b/libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c
index e39f63229..9a4f51c9d 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c
@@ -22,11 +22,11 @@
#include <sysdep.h>
+extern __typeof(getpid) __getpid;
#ifndef NOT_IN_libc
-static inline __attribute__((always_inline)) pid_t really_getpid (pid_t oldval);
+static __always_inline pid_t really_getpid (pid_t oldval);
-static inline __attribute__((always_inline)) pid_t
-really_getpid (pid_t oldval)
+static __always_inline pid_t really_getpid (pid_t oldval)
{
if (__builtin_expect (oldval == 0, 1))
{
@@ -46,8 +46,7 @@ really_getpid (pid_t oldval)
}
#endif
-pid_t attribute_hidden
-__getpid (void)
+pid_t __getpid (void)
{
#ifdef NOT_IN_libc
INTERNAL_SYSCALL_DECL (err);
@@ -59,5 +58,6 @@ __getpid (void)
#endif
return result;
}
-
-weak_alias (__getpid, getpid)
+libc_hidden_proto(getpid)
+weak_alias(__getpid, getpid)
+libc_hidden_weak(getpid)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/fork.c b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/fork.c
index 0ddfe70da..b874538b3 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/fork.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/fork.c
@@ -23,7 +23,6 @@
#include <sysdep.h>
#include <tls.h>
-
#define ARCH_FORK() \
INLINE_SYSCALL (clone, 5, \
CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID | SIGCHLD, 0, \
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c b/libpthread/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c
index f337816cf..5d3bcb0d6 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c
@@ -25,6 +25,7 @@
#include <pthreadP.h>
#include <bits/libc-lock.h>
+libc_hidden_proto(memcpy)
#ifdef TLS_MULTIPLE_THREADS_IN_TCB
void
@@ -48,7 +49,7 @@ __libc_pthread_init (ptr, reclaim, functions)
/* We copy the content of the variable pointed to by the FUNCTIONS
parameter to one in libc.so since this means access to the array
can be done with one memory access instead of two. */
- __memcpy (&__libc_pthread_functions, functions,
+ memcpy (&__libc_pthread_functions, functions,
sizeof (__libc_pthread_functions));
#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch
index 6c77bb5d5..8011cc087 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch
@@ -10,6 +10,7 @@ libpthread_CSRC = pthread_once.c
libc_a_CSRC = fork.c
+CFLAGS-OMIT-fork.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y)
CFLAGS-fork.c = -D__USE_STDIO_FUTEXES__
endif
@@ -33,8 +34,8 @@ libpthread-nomulti-y+=$(LINUX_ARCH_OBJS)
LIBC_LINUX_ARCH_OBJ:=$(patsubst %.c,$(LINUX_ARCH_OUT)/%.o,$(libc_a_CSRC))
-libc-a-y+=$(LIBC_LINUX_ARCH_OBJ)
-libc-so-y+=$(LIBC_LINUX_ARCH_OBJ:.o=.oS)
+libc-static-y+=$(LIBC_LINUX_ARCH_OBJ)
+libc-shared-y+=$(LIBC_LINUX_ARCH_OBJ:.o=.oS)
libc-nomulti-y+=$(LIBC_LINUX_ARCH_OBJ)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c b/libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c
index a1e228ee2..3e1b70f86 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c
@@ -19,6 +19,7 @@
#include <unistd.h>
+extern int __libc_fork (void);
pid_t
__fork (void)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/pt-raise.c b/libpthread/nptl/sysdeps/unix/sysv/linux/pt-raise.c
index 9161e29e2..fa4f75471 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/pt-raise.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/pt-raise.c
@@ -23,10 +23,8 @@
#include <tls.h>
#include <kernel-features.h>
-
-int
-raise (sig)
- int sig;
+extern __typeof(raise) __raise;
+int __raise (int sig)
{
#if __ASSUME_TGKILL || defined __NR_tgkill
/* raise is an async-safe function. It could be called while the
@@ -50,3 +48,6 @@ raise (sig)
return INLINE_SYSCALL (tkill, 2, THREAD_GETMEM (THREAD_SELF, tid), sig);
#endif
}
+libc_hidden_proto(raise)
+weak_alias(__raise, raise)
+libc_hidden_weak(raise)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_getaffinity.c b/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_getaffinity.c
index ead5d42bb..3ca9d7d94 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_getaffinity.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_getaffinity.c
@@ -42,5 +42,5 @@ __pthread_getaffinity_new (pthread_t th, size_t cpusetsize, cpu_set_t *cpuset)
return 0;
}
-hidden_strong_alias (__pthread_getaffinity_new, __pthread_getaffinity_np)
-strong_alias (__pthread_getaffinity_new, pthread_getaffinity_np)
+strong_alias(__pthread_getaffinity_new, __pthread_getaffinity_np)
+strong_alias(__pthread_getaffinity_new, pthread_getaffinity_np)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/raise.c b/libpthread/nptl/sysdeps/unix/sysv/linux/raise.c
index 07cb35ae1..7c7c32c4e 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/raise.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/raise.c
@@ -25,9 +25,8 @@
#include <kernel-features.h>
-int attribute_hidden
-__raise (sig)
- int sig;
+extern __typeof(raise) __raise;
+int __raise (int sig)
{
struct pthread *pd = THREAD_SELF;
#if __ASSUME_TGKILL || defined __NR_tgkill
@@ -71,4 +70,6 @@ __raise (sig)
return INLINE_SYSCALL (tkill, 2, selftid, sig);
#endif
}
+libc_hidden_proto(raise)
weak_alias(__raise, raise)
+libc_hidden_weak(raise)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sigwaitinfo.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sigwaitinfo.c
index c6ea739d3..6c47fdee6 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/sigwaitinfo.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sigwaitinfo.c
@@ -69,9 +69,7 @@ do_sigwaitinfo (const sigset_t *set, siginfo_t *info)
/* Return any pending signal or wait for one for the given time. */
int
-__sigwaitinfo (set, info)
- const sigset_t *set;
- siginfo_t *info;
+__sigwaitinfo (const sigset_t *set, siginfo_t *info)
{
if (SINGLE_THREAD_P)
return do_sigwaitinfo (set, info);
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sleep.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sleep.c
index 579b00be3..9e948adce 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/sleep.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sleep.c
@@ -1,150 +1,2 @@
-/* Implementation of the POSIX sleep function using nanosleep.
- Copyright (C) 1996,1997,1998,1999,2003,2005 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
#include <pthreadP.h>
-#include <errno.h>
-#include <time.h>
-#include <signal.h>
-#include <string.h> /* For the real memset prototype. */
-#include <unistd.h>
-#include <sys/param.h>
-
-
-#if 0
-static void
-cl (void *arg)
-{
- (void) __sigprocmask (SIG_SETMASK, arg, (sigset_t *) NULL);
-}
-#endif
-
-
-/* We are going to use the `nanosleep' syscall of the kernel. But the
- kernel does not implement the stupid SysV SIGCHLD vs. SIG_IGN
- behaviour for this syscall. Therefore we have to emulate it here. */
-unsigned int
-__sleep (unsigned int seconds)
-{
- const unsigned int max
- = (unsigned int) (((unsigned long int) (~((time_t) 0))) >> 1);
- struct timespec ts;
- sigset_t set, oset;
- unsigned int result;
-
- /* This is not necessary but some buggy programs depend on this. */
- if (__builtin_expect (seconds == 0, 0))
- {
-#ifdef CANCELLATION_P
- CANCELLATION_P (THREAD_SELF);
-#endif
- return 0;
- }
-
- ts.tv_sec = 0;
- ts.tv_nsec = 0;
- again:
- if (sizeof (ts.tv_sec) <= sizeof (seconds))
- {
- /* Since SECONDS is unsigned assigning the value to .tv_sec can
- overflow it. In this case we have to wait in steps. */
- ts.tv_sec += MIN (seconds, max);
- seconds -= (unsigned int) ts.tv_sec;
- }
- else
- {
- ts.tv_sec = (time_t) seconds;
- seconds = 0;
- }
-
- /* Linux will wake up the system call, nanosleep, when SIGCHLD
- arrives even if SIGCHLD is ignored. We have to deal with it
- in libc. We block SIGCHLD first. */
- __sigemptyset (&set);
- __sigaddset (&set, SIGCHLD);
- if (__sigprocmask (SIG_BLOCK, &set, &oset))
- return -1;
-
- /* If SIGCHLD is already blocked, we don't have to do anything. */
- if (!__sigismember (&oset, SIGCHLD))
- {
- int saved_errno;
- struct sigaction oact;
-
- __sigemptyset (&set);
- __sigaddset (&set, SIGCHLD);
-
- /* We get the signal handler for SIGCHLD. */
- if (sigaction (SIGCHLD, (struct sigaction *) NULL, &oact) < 0)
- {
- saved_errno = errno;
- /* Restore the original signal mask. */
- (void) __sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL);
- __set_errno (saved_errno);
- return -1;
- }
-
- /* Note the sleep() is a cancellation point. But since we call
- nanosleep() which itself is a cancellation point we do not
- have to do anything here. */
- if (oact.sa_handler == SIG_IGN)
- {
- //__libc_cleanup_push (cl, &oset);
-
- /* We should leave SIGCHLD blocked. */
- while (1)
- {
- result = nanosleep (&ts, &ts);
-
- if (result != 0 || seconds == 0)
- break;
-
- if (sizeof (ts.tv_sec) <= sizeof (seconds))
- {
- ts.tv_sec = MIN (seconds, max);
- seconds -= (unsigned int) ts.tv_nsec;
- }
- }
-
- //__libc_cleanup_pop (0);
-
- saved_errno = errno;
- /* Restore the original signal mask. */
- (void) __sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL);
- __set_errno (saved_errno);
-
- goto out;
- }
-
- /* We should unblock SIGCHLD. Restore the original signal mask. */
- (void) __sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL);
- }
-
- result = nanosleep (&ts, &ts);
- if (result == 0 && seconds != 0)
- goto again;
-
- out:
- if (result != 0)
- /* Round remaining time. */
- result = seconds + (unsigned int) ts.tv_sec + (ts.tv_nsec >= 500000000L);
-
- return result;
-}
-weak_alias (__sleep, sleep)
+#include <../../../../../../libc/unistd/sleep.c>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_create.c b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_create.c
index 5e9951395..8ca24c7f9 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_create.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_create.c
@@ -26,7 +26,7 @@
#include <sysdep.h>
#include <kernel-features.h>
#include <internaltypes.h>
-#include <nptl/pthreadP.h>
+#include <pthreadP.h>
#include "kernel-posix-timers.h"
#include "kernel-posix-cpu-timers.h"
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c
index e5214e605..e2b8ddae6 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c
@@ -23,7 +23,7 @@
#include <stdbool.h>
#include <sysdep.h>
#include <kernel-features.h>
-#include <nptl/pthreadP.h>
+#include <pthreadP.h>
#include "kernel-posix-timers.h"