diff options
author | "Steven J. Hill" <sjhill@realitydiluted.com> | 2005-11-16 03:36:39 +0000 |
---|---|---|
committer | "Steven J. Hill" <sjhill@realitydiluted.com> | 2005-11-16 03:36:39 +0000 |
commit | b823b17fa7dc5a15d822a4f31fe8ee846a65cfae (patch) | |
tree | cbf84b1c8fc0682e74165cc48b9baf0d7b382533 /libpthread/nptl/sysdeps/unix/sysv/linux | |
parent | 708121712921e39f6d81179c376e53d26ee817b4 (diff) | |
download | uClibc-alpine-b823b17fa7dc5a15d822a4f31fe8ee846a65cfae.tar.bz2 uClibc-alpine-b823b17fa7dc5a15d822a4f31fe8ee846a65cfae.tar.xz |
Sync with glibc reference tree and changes for uClibc thus far.
Diffstat (limited to 'libpthread/nptl/sysdeps/unix/sysv/linux')
15 files changed, 62 insertions, 146 deletions
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile index 3dd1430b7..43f4bb409 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile @@ -34,25 +34,26 @@ SO_LIBC_CSRC = $(AR_LIBC_CSRC) ifeq ($(strip $(TARGET_ARCH)),alpha) AR_LIBC_CSRC += libc-lowlevellock.c -AR_LIBP_CSRC += rtld-libc-lowlevellock.c +AR_LIBP_CSRC += lowlevellock.c endif ifeq ($(strip $(TARGET_ARCH)),mips) AR_LIBC_CSRC += libc-lowlevellock.c -AR_LIBP_CSRC += rtld-libc-lowlevellock.c +AR_LIBP_CSRC += lowlevellock.c endif ifeq ($(strip $(TARGET_ARCH)),powerpc) AR_LIBC_CSRC += libc-lowlevellock.c -AR_LIBP_CSRC += rtld-libc-lowlevellock.c +AR_LIBP_CSRC += lowlevellock.c endif ifeq ($(strip $(TARGET_ARCH)),sparc) AR_LIBC_CSRC += libc-lowlevellock.c -AR_LIBP_CSRC += rtld-libc-lowlevellock.c +AR_LIBP_CSRC += lowlevellock.c endif # # Needed to get pthread types. # CFLAGS-pt-fork.c = -D_GNU_SOURCE +CFLAGS-pthread_getcpuclockid.c = -I$(TOPDIR)/librt AR_LIBP_COBJS = $(patsubst %.c, %.o, $(AR_LIBP_CSRC)) SO_LIBP_COBJS = $(patsubst %.c, %.os, $(SO_LIBP_CSRC)) @@ -111,10 +112,7 @@ $(AR_LIBC_COBJS): %.o : %.c $(SO_LIBC_COBJS): %.os : %.c $(CC) $(CFLAGS-$<) $(CFLAGS-LIBC) -DSHARED -c $< -o $@ -rtld-libc-lowlevellock.c: libc-lowlevellock.c - $(LN) -fs $< $@ - clean: - $(RM) *.o *.os *~ core rtld-libc-lowlevellock.c + $(RM) *.o *.os *~ core .PHONY: $(AR_LIB_NAME) $(AR_SO_LIB_NAME) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h b/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h index d13d6e86a..86b47037e 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h @@ -1,5 +1,5 @@ /* Machine-specific pthread type layouts. Alpha version. - Copyright (C) 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2003, 2004, 2005 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 @@ -117,8 +117,9 @@ typedef union unsigned int __nr_readers_queued; unsigned int __nr_writers_queued; int __writer; - - unsigned int __reserved[6]; + int __pad1; + unsigned long int __pad2; + unsigned long int __pad3; /* FLAGS must stay at this position in the structure to maintain binary compatibility. */ unsigned int __flags; diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c b/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c index c03bfd4d6..f62e4b919 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c @@ -22,9 +22,6 @@ #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> @@ -70,11 +67,7 @@ fresetlockfiles (void) pid_t -#ifdef __UCLIBC__ __libc_fork_nptl (void) -#else -__libc_fork (void) -#endif { pid_t pid; struct used_handler @@ -258,8 +251,3 @@ __libc_fork (void) return pid; } -#ifndef __UCLIBC__ -weak_alias (__libc_fork, __fork) -libc_hidden_def (__fork) -weak_alias (__libc_fork, fork) -#endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/internaltypes.h b/libpthread/nptl/sysdeps/unix/sysv/linux/internaltypes.h index 7da94d860..07ee9d7dd 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/internaltypes.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/internaltypes.h @@ -21,9 +21,7 @@ #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/kernel-features.h b/libpthread/nptl/sysdeps/unix/sysv/linux/kernel-features.h index ef8240b00..dd2d40a44 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/kernel-features.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/kernel-features.h @@ -25,10 +25,8 @@ # include <sgidefs.h> #endif -#if __UCLIBC__ # include <linux/version.h> # define __LINUX_KERNEL_VERSION LINUX_VERSION_CODE -#endif #ifndef __LINUX_KERNEL_VERSION /* We assume the worst; all kernels should be supported. */ diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/kernel-posix-timers.h b/libpthread/nptl/sysdeps/unix/sysv/linux/kernel-posix-timers.h index 3ff4cda3f..9be630268 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/kernel-posix-timers.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/kernel-posix-timers.h @@ -1,60 +1 @@ -/* Copyright (C) 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@redhat.com>, 2003. - - 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; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include <pthread.h> -#include <setjmp.h> -#include <signal.h> -#include <sys/types.h> - - -/* Nonzero if the system calls are not available. */ -extern int __no_posix_timers attribute_hidden; - -/* Callback to start helper thread. */ -extern void __start_helper_thread (void) attribute_hidden; - -/* Control variable for helper thread creation. */ -extern pthread_once_t __helper_once attribute_hidden; - -/* TID of the helper thread. */ -extern pid_t __helper_tid attribute_hidden; - - -/* Type of timers in the kernel. */ -typedef int kernel_timer_t; - - -/* Internal representation of timer. */ -struct timer -{ - /* Notification mechanism. */ - int sigev_notify; - - /* Timer ID returned by the kernel. */ - kernel_timer_t ktimerid; - - /* All new elements must be added after ktimerid. And if the thrfunc - element is not the third element anymore the memory allocation in - timer_create needs to be changed. */ - - /* Parameters for the thread to be started for SIGEV_THREAD. */ - void (*thrfunc) (sigval_t); - sigval_t sival; - pthread_attr_t attr; -}; +#include <../../../../../../librt/kernel-posix-timers.h> 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 85b75221e..3d1c02181 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c @@ -57,11 +57,3 @@ __libc_pthread_init (ptr, reclaim, functions) return &__libc_multiple_threads; #endif } - -/* I would rather not talk about this. */ -#ifdef SHARED -#include <link.h> -void _dl_aux_init (ElfW(auxv_t) *av) -{ -} -#endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/lowlevellock.c b/libpthread/nptl/sysdeps/unix/sysv/linux/lowlevellock.c index 8fdccac70..f93891431 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/lowlevellock.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/lowlevellock.c @@ -50,11 +50,7 @@ __lll_timedlock_wait (int *futex, const struct timespec *abstime) struct timespec rt; /* Get the current time. */ -#ifdef __UCLIBC__ (void) gettimeofday (&tv, NULL); -#else - (void) __gettimeofday (&tv, NULL); -#endif /* Compute relative timeout. */ rt.tv_sec = abstime->tv_sec - tv.tv_sec; @@ -109,11 +105,7 @@ __lll_timedwait_tid (int *tidp, const struct timespec *abstime) struct timespec rt; /* Get the current time. */ -#ifdef __UCLIBC__ (void) gettimeofday (&tv, NULL); -#else - (void) __gettimeofday (&tv, NULL); -#endif /* Compute relative timeout. */ rt.tv_sec = abstime->tv_sec - tv.tv_sec; diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile index 865f74149..084708397 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile @@ -21,7 +21,8 @@ TOPDIR=../../../../../../../ include $(TOPDIR)Rules.mak include ../../../../../Rules.mak -AR_LIBP_ASRC = pt-vfork.S clone.S +#AR_LIBP_ASRC = pt-vfork.S clone.S +AR_LIBP_ASRC = pt-vfork.S SO_LIBP_ASRC = $(AR_LIBP_ASRC) AR_LIBP_CSRC = pthread_once.c SO_LIBP_CSRC = $(AR_LIBP_CSRC) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/createthread.c b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/createthread.c index d07d04e09..d8a7c5539 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/createthread.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/createthread.c @@ -21,8 +21,4 @@ + TLS_TCB_OFFSET + TLS_PRE_TCB_SIZE) /* Get the real implementation. */ -#ifdef __UCLIBC__ #include <sysdeps/pthread/createthread.c> -#else -#include <nptl/sysdeps/pthread/createthread.c> -#endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/not-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/not-cancel.h index f79953d88..9418417b4 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/not-cancel.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/not-cancel.h @@ -1,4 +1,4 @@ -/* Uncancelable versions of cancelable interfaces. Generic version. +/* Uncancelable versions of cancelable interfaces. Linux version. Copyright (C) 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2003. @@ -18,37 +18,43 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -/* By default we have none. Map the name to the normal functions. */ +#include <sysdep.h> + +/* Uncancelable open. */ #define open_not_cancel(name, flags, mode) \ - __libc_open (name, flags, mode) -#ifdef __UCLIBC__ -extern int __libc_open(__const char *__file, int __oflag, ...) __THROW; -#define open_not_cancel_2(name, flags) \ - __libc_open (name, flags, 0) -#else + INLINE_SYSCALL (open, 3, (const char *) (name), (flags), (mode)) #define open_not_cancel_2(name, flags) \ - __libc_open (name, flags) -#endif + INLINE_SYSCALL (open, 2, (const char *) (name), (flags)) + +/* Uncancelable close. */ #define close_not_cancel(fd) \ - __close (fd) -#ifdef __UCLIBC__ -#define close_not_cancel_no_status(fd) \ - (void) close (fd) -#define read_not_cancel(fd, buf, n) \ - read (fd, buf, n) -#define write_not_cancel(fd, buf, n) \ - write (fd, buf, n) -#else + INLINE_SYSCALL (close, 1, fd) #define close_not_cancel_no_status(fd) \ - (void) __close (fd) + (void) ({ INTERNAL_SYSCALL_DECL (err); \ + INTERNAL_SYSCALL (close, err, 1, (fd)); }) + +/* Uncancelable read. */ #define read_not_cancel(fd, buf, n) \ - __read (fd, buf, n) + INLINE_SYSCALL (read, 3, (fd), (buf), (n)) + +/* Uncancelable write. */ #define write_not_cancel(fd, buf, n) \ - __write (fd, buf, n) -#endif + INLINE_SYSCALL (write, 3, (fd), (buf), (n)) + +/* Uncancelable writev. */ #define writev_not_cancel_no_status(fd, iov, n) \ - (void) __writev (fd, iov, n) + (void) ({ INTERNAL_SYSCALL_DECL (err); \ + INTERNAL_SYSCALL (writev, err, 3, (fd), (iov), (n)); }) + +/* Uncancelable fcntl. */ #define fcntl_not_cancel(fd, cmd, val) \ - __fcntl (fd, cmd, val) + __fcntl_nocancel (fd, cmd, val) + +/* Uncancelable waitpid. */ +#ifdef __NR_waitpid +# define waitpid_not_cancel(pid, stat_loc, options) \ + INLINE_SYSCALL (waitpid, 3, pid, stat_loc, options) +#else # define waitpid_not_cancel(pid, stat_loc, options) \ - __waitpid (pid, stat_loc, options) + INLINE_SYSCALL (wait4, 4, pid, stat_loc, options, NULL) +#endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h b/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h index 393c171ee..84acf3843 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h @@ -45,6 +45,7 @@ mflr 9; \ stw 9,52(1); \ cfi_offset (lr, 4); \ + CGOTSETUP; \ DOCARGS_##args; /* save syscall args around CENABLE. */ \ CENABLE; \ stw 3,16(1); /* store CENABLE return value (MASK). */ \ @@ -58,6 +59,7 @@ lwz 4,52(1); \ lwz 0,12(1); /* restore CR/R3. */ \ lwz 3,8(1); \ + CGOTRESTORE; \ mtlr 4; \ mtcr 0; \ addi 1,1,48; \ @@ -84,6 +86,9 @@ # define DOCARGS_6 stw 8,40(1); DOCARGS_5 # define UNDOCARGS_6 lwz 8,40(1); UNDOCARGS_5 +# define CGOTSETUP +# define CGOTRESTORE + # ifdef IS_IN_libpthread # define CENABLE bl __pthread_enable_asynccancel@local # define CDISABLE bl __pthread_disable_asynccancel@local @@ -93,6 +98,18 @@ # elif defined IS_IN_librt # define CENABLE bl JUMPTARGET(__librt_enable_asynccancel) # define CDISABLE bl JUMPTARGET(__librt_disable_asynccancel) +# if defined HAVE_AS_REL16 && defined PIC +# undef CGOTSETUP +# define CGOTSETUP \ + bcl 20,31,1f; \ + 1: stw 30,44(1); \ + mflr 30; \ + addis 30,30,_GLOBAL_OFFSET_TABLE-1b@ha; \ + addi 30,30,_GLOBAL_OFFSET_TABLE-1b@l +# undef CGOTRESTORE +# define CGOTRESTORE \ + lwz 30,44(1) +# endif # else # error Unsupported library # endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c b/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c index 9e1abd983..047c64322 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c @@ -5,8 +5,4 @@ #define __pthread_mutex_lock __pthread_mutex_cond_lock #define NO_INCR -#ifdef __UCLIBC__ #include <pthread_mutex_lock.c> -#else -#include <nptl/pthread_mutex_lock.c> -#endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c index d4ed1caba..5c8b0db7e 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c @@ -56,11 +56,7 @@ sem_timedwait (sem_t *sem, const struct timespec *abstime) int sec, nsec; /* Get the current time. */ -#ifdef __UCLIBC__ gettimeofday (&tv, NULL); -#else - __gettimeofday (&tv, NULL); -#endif /* Compute relative timeout. */ sec = abstime->tv_sec - tv.tv_sec; diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/smp.h b/libpthread/nptl/sysdeps/unix/sysv/linux/smp.h index fbe16bacd..41fa97ff4 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/smp.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/smp.h @@ -34,11 +34,7 @@ is_smp_system (void) size_t reslen = sizeof (buf); /* Try reading the number using `sysctl' first. */ -#ifdef __UCLIBC__ if (sysctl ((int *) sysctl_args, -#else - if (__sysctl ((int *) sysctl_args, -#endif sizeof (sysctl_args) / sizeof (sysctl_args[0]), buf, &reslen, NULL, 0) < 0) { |