summaryrefslogtreecommitdiffstats
path: root/libpthread/nptl/sysdeps/unix
diff options
context:
space:
mode:
Diffstat (limited to 'libpthread/nptl/sysdeps/unix')
-rw-r--r--libpthread/nptl/sysdeps/unix/sysdep.h61
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in75
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/close.S14
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/fork.c1
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/open.S14
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/read.S12
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/sigwait.c2
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/waitpid.S19
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/write.S12
9 files changed, 169 insertions, 41 deletions
diff --git a/libpthread/nptl/sysdeps/unix/sysdep.h b/libpthread/nptl/sysdeps/unix/sysdep.h
new file mode 100644
index 000000000..3f5d1721c
--- /dev/null
+++ b/libpthread/nptl/sysdeps/unix/sysdep.h
@@ -0,0 +1,61 @@
+/* Copyright (C) 1991, 92, 93, 96, 98, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ 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 <sysdeps/generic/sysdep.h>
+
+#include <sys/syscall.h>
+#define HAVE_SYSCALLS
+
+/* Note that using a `PASTE' macro loses. */
+#ifdef __STDC__
+#define SYSCALL__(name, args) PSEUDO (__##name, name, args)
+#else
+#define SYSCALL__(name, args) PSEUDO (__/**/name, name, args)
+#endif
+#define SYSCALL(name, args) PSEUDO (name, name, args)
+
+/* Machine-dependent sysdep.h files are expected to define the macro
+ PSEUDO (function_name, syscall_name) to emit assembly code to define the
+ C-callable function FUNCTION_NAME to do system call SYSCALL_NAME.
+ r0 and r1 are the system call outputs. MOVE(x, y) should be defined as
+ an instruction such that "MOVE(r1, r0)" works. ret should be defined
+ as the return instruction. */
+
+#ifndef SYS_ify
+#ifdef __STDC__
+#define SYS_ify(syscall_name) SYS_##syscall_name
+#else
+#define SYS_ify(syscall_name) SYS_/**/syscall_name
+#endif
+#endif
+
+/* Terminate a system call named SYM. This is used on some platforms
+ to generate correct debugging information. */
+#ifndef PSEUDO_END
+#define PSEUDO_END(sym)
+#endif
+#ifndef PSEUDO_END_NOERRNO
+#define PSEUDO_END_NOERRNO(sym) PSEUDO_END(sym)
+#endif
+#ifndef PSEUDO_END_ERRVAL
+#define PSEUDO_END_ERRVAL(sym) PSEUDO_END(sym)
+#endif
+
+/* Wrappers around system calls should normally inline the system call code.
+ But sometimes it is not possible or implemented and we use this code. */
+#define INLINE_SYSCALL(name, nr, args...) __syscall_##name (args)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in
index 0c73e61c2..9826a3de4 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in
@@ -5,34 +5,28 @@
# 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 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
+libpthread_CSRC = 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 pt-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 jmp-unwind.c
+
+# These provide both a cancellable and a not cancellable implementation
+libc_SSRC = close.S open.S waitpid.S write.S read.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
@@ -56,6 +50,12 @@ libc_CSRC += libc-lowlevellock.c
librt_CSRC := mq_notify.c
endif
+ifeq ($(TARGET_ARCH),sh)
+SH_PTHREAD_SPECIFIC := sem_post.c sem_wait.c sem_timedwait.c sem_trywait.c
+libpthread_CSRC := $(filter-out $(SH_PTHREAD_SPECIFIC),$(libpthread_CSRC))
+endif
+
+
ifeq ($(TARGET_ARCH),x86_64)
librt_CSRC := mq_notify.c
endif
@@ -82,24 +82,13 @@ 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-waitpid.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
@@ -116,8 +105,15 @@ 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-so-y += $(PTHREAD_LINUX_OUT)/pt-raise.oS
libpthread-nomulti-y += $(PTHREAD_LINUX_OBJ)
+ASFLAGS-open.S = -D_LIBC_REENTRANT
+ASFLAGS-close.S = -D_LIBC_REENTRANT
+ASFLAGS-read.S = -D_LIBC_REENTRANT
+ASFLAGS-write.S = -D_LIBC_REENTRANT
+ASFLAGS-waitpid.S = -D_LIBC_REENTRANT
+
LIBC_LINUX_OBJ := $(patsubst %.c,$(PTHREAD_LINUX_OUT)/%.o,$(libc_CSRC))
LIBC_LINUX_OBJ += $(patsubst %.S,$(PTHREAD_LINUX_OUT)/%.o,$(libc_SSRC))
@@ -177,11 +173,16 @@ $(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" $< > $@
+$(PTHREAD_LINUX_DIR)/pt-sleep.c:
+ $(LN) -s sleep.c $@
+
nptl_linux_headers:
$(MAKE) $(PTHREAD_LINUX_OUT)/lowlevelbarrier.h
$(MAKE) $(PTHREAD_LINUX_OUT)/lowlevelcond.h
$(MAKE) $(PTHREAD_LINUX_OUT)/lowlevelrwlock.h
$(MAKE) $(PTHREAD_LINUX_OUT)/unwindbuf.h
+
+nptl_linux_headers_bootstrap:
$(LN) -sf ../../$(PTHREAD_LINUX_DIR)/bits/local_lim.h $(top_builddir)include/bits
nptl_linux_headers_clean:
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/close.S b/libpthread/nptl/sysdeps/unix/sysv/linux/close.S
index b1cd59469..cf50a1eae 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/close.S
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/close.S
@@ -1,9 +1,21 @@
#include <sysdep-cancel.h>
+
+/*
+extern int __close_nocancel (int) attribute_hidden;
+*/
+#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
+
+
PSEUDO (__libc_close, close, 1)
ret
-PSEUDO_END (__libc_close)
+PSEUDO_END(__libc_close)
+
+libc_hidden_def (__close_nocancel)
libc_hidden_def (__libc_close)
weak_alias (__libc_close, __close)
libc_hidden_weak (__close)
weak_alias (__libc_close, close)
libc_hidden_weak (close)
+
+
+#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c b/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c
index 5d894225a..f8a64c0cb 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c
@@ -227,6 +227,7 @@ pid_t __libc_fork (void)
return pid;
}
+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/open.S b/libpthread/nptl/sysdeps/unix/sysv/linux/open.S
index 50e4bcef0..486686a22 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/open.S
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/open.S
@@ -1,9 +1,21 @@
#include <sysdep-cancel.h>
+
+/*
+extern int __open_nocancel (const char *, int, ...) attribute_hidden;
+*/
+#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
+
PSEUDO (__libc_open, open, 3)
ret
-PSEUDO_END (__libc_open)
+PSEUDO_END(__libc_open)
+
+libc_hidden_def (__open_nocancel)
libc_hidden_def (__libc_open)
weak_alias (__libc_open, __open)
libc_hidden_weak (__open)
weak_alias (__libc_open, open)
libc_hidden_weak (open)
+
+
+
+#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/read.S b/libpthread/nptl/sysdeps/unix/sysv/linux/read.S
index dc63d1763..d3adfa84c 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/read.S
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/read.S
@@ -1,9 +1,19 @@
#include <sysdep-cancel.h>
+
+/*
+extern int __read_nocancel (int, void *, size_t) attribute_hidden;
+*/
+#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
+
PSEUDO (__libc_read, read, 3)
ret
-PSEUDO_END (__libc_read)
+PSEUDO_END(__libc_read)
+
+libc_hidden_def (__read_nocancel)
libc_hidden_def (__libc_read)
weak_alias (__libc_read, __read)
libc_hidden_weak (__read)
weak_alias (__libc_read, read)
libc_hidden_weak (read)
+
+#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sigwait.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sigwait.c
new file mode 100644
index 000000000..bde0a9292
--- /dev/null
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sigwait.c
@@ -0,0 +1,2 @@
+#include <pthreadP.h>
+#include "../../../../../../libc/signal/sigwait.c"
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/waitpid.S b/libpthread/nptl/sysdeps/unix/sysv/linux/waitpid.S
new file mode 100644
index 000000000..f55d34629
--- /dev/null
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/waitpid.S
@@ -0,0 +1,19 @@
+#include <sysdep-cancel.h>
+
+/*
+extern pid_t __waitpid_nocancel (pid_t, int *, int) attribute_hidden;
+*/
+#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
+
+
+PSEUDO (__waitpid, waitpid, 3)
+ret
+PSEUDO_END(__waitpid)
+
+libc_hidden_def (__waitpid)
+weak_alias (__waitpid, waitpid)
+libc_hidden_weak (waitpid)
+weak_alias (__waitpid, __libc_waitpid)
+libc_hidden_weak (__libc_waitpid)
+
+#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/write.S b/libpthread/nptl/sysdeps/unix/sysv/linux/write.S
index 168eab95c..43de3320d 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/write.S
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/write.S
@@ -1,9 +1,19 @@
#include <sysdep-cancel.h>
+
+/*
+extern int __write_nocancel (int, const void *, size_t) attribute_hidden;
+*/
+#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
+
PSEUDO (__libc_write, write, 3)
ret
-PSEUDO_END (__libc_write)
+PSEUDO_END(__libc_write)
+
+libc_hidden_def (__write_nocancel)
libc_hidden_def (__libc_write)
weak_alias (__libc_write, __write)
libc_hidden_weak (__write)
weak_alias (__libc_write, write)
libc_hidden_weak (write)
+
+#endif