diff options
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/alpha/elf/start.S | 1 | ||||
-rw-r--r-- | sysdeps/generic/gnu/types.h | 3 | ||||
-rw-r--r-- | sysdeps/generic/prof-freq.c | 57 | ||||
-rw-r--r-- | sysdeps/i386/dl-machine.h | 7 | ||||
-rw-r--r-- | sysdeps/mach/hurd/prof-freq.c | 2 | ||||
-rw-r--r-- | sysdeps/posix/sysconf.c | 4 | ||||
-rw-r--r-- | sysdeps/stub/libc-lock.h | 6 | ||||
-rw-r--r-- | sysdeps/unix/alpha/sysdep.S | 56 | ||||
-rw-r--r-- | sysdeps/unix/i386/sysdep.S | 27 | ||||
-rw-r--r-- | sysdeps/unix/opendir.c | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/errnos.h | 32 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/gnu/types.h | 4 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/sysdep.S | 32 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/sysdep.h | 31 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/schedbits.h | 51 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/waitflags.h | 30 |
16 files changed, 321 insertions, 24 deletions
diff --git a/sysdeps/alpha/elf/start.S b/sysdeps/alpha/elf/start.S index d20a009aa4..c8b374afe5 100644 --- a/sysdeps/alpha/elf/start.S +++ b/sysdeps/alpha/elf/start.S @@ -21,6 +21,7 @@ Cambridge, MA 02139, USA. */ .text .align 3 + .globl _start .ent _start, 0 _start: .frame fp, 0, zero diff --git a/sysdeps/generic/gnu/types.h b/sysdeps/generic/gnu/types.h index decd26cac8..614252aaac 100644 --- a/sysdeps/generic/gnu/types.h +++ b/sysdeps/generic/gnu/types.h @@ -83,5 +83,8 @@ typedef unsigned long __fd_mask; #define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) #define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) +#ifdef __USE_SVID +typedef long int key_t; +#endif #endif /* gnu/types.h */ diff --git a/sysdeps/generic/prof-freq.c b/sysdeps/generic/prof-freq.c index 4e952e781d..c69b43ec09 100644 --- a/sysdeps/generic/prof-freq.c +++ b/sysdeps/generic/prof-freq.c @@ -55,5 +55,62 @@ __profile_frequency () return 0; return (1000000 / tim.it_interval.tv_usec); } +/* Return frequency of ticks reported by profil. Generic version. */ +/*- + * Copyright (c) 1983, 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + +#include <sys/types.h> +#include <sys/time.h> + +int +__profile_frequency () +{ + /* + * Discover the tick frequency of the machine if something goes wrong, + * we return 0, an impossible hertz. + */ + struct itimerval tim; + + tim.it_interval.tv_sec = 0; + tim.it_interval.tv_usec = 1; + tim.it_value.tv_sec = 0; + tim.it_value.tv_usec = 0; + setitimer(ITIMER_REAL, &tim, 0); + setitimer(ITIMER_REAL, 0, &tim); + if (tim.it_interval.tv_usec < 2) + return 0; + return (1000000 / tim.it_interval.tv_usec); +} diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h index 83b6f8d165..5bd0f8254b 100644 --- a/sysdeps/i386/dl-machine.h +++ b/sysdeps/i386/dl-machine.h @@ -133,7 +133,7 @@ _dl_start_user:\n\ # See if we were run as a command with the executable file\n\ # name as an extra leading argument.\n\ movl _dl_skip_args@GOT(%ebx), %eax\n\ - movl (%eax),%eax\n\ + movl (%eax), %eax\n\ # Pop the original argument count.\n\ popl %ecx\n\ # Subtract _dl_skip_args from it.\n\ @@ -151,7 +151,7 @@ _dl_start_user:\n\ call _dl_init_next@PLT\n\ addl $4, %esp # Pop argument.\n\ # Check for zero return, when out of initializers.\n\ - testl %eax,%eax\n\ + testl %eax, %eax\n\ jz 1f\n\ # Call the shared object initializer function.\n\ # NOTE: We depend only on the registers (%ebx, %esi and %edi)\n\ @@ -164,7 +164,8 @@ _dl_start_user:\n\ # Loop to call _dl_init_next for the next initializer.\n\ jmp 0b\n\ 1: # Clear the startup flag.\n\ - movl $0, _dl_starting_up@GOT(%ebx)\n\ + movl _dl_starting_up@GOT(%ebx), %eax\n\ + movl $0, (%eax)\n\ # Pass our finalizer function to the user in %edx, as per ELF ABI.\n\ movl _dl_fini@GOT(%ebx), %edx\n\ # Jump to the user's entry point.\n\ diff --git a/sysdeps/mach/hurd/prof-freq.c b/sysdeps/mach/hurd/prof-freq.c index a3707033a6..5c0d307bdb 100644 --- a/sysdeps/mach/hurd/prof-freq.c +++ b/sysdeps/mach/hurd/prof-freq.c @@ -1,2 +1,4 @@ /* __profile_frequency is in sysdeps/mach/hurd/profil.c. This file is here as a place-holder to prevent the use of sysdeps/generic/prof-freq.c. */ +/* __profile_frequency is in sysdeps/mach/hurd/profil.c. This file +is here as a place-holder to prevent the use of sysdeps/generic/prof-freq.c. */ diff --git a/sysdeps/posix/sysconf.c b/sysdeps/posix/sysconf.c index 5b2caf66f6..29d06135c6 100644 --- a/sysdeps/posix/sysconf.c +++ b/sysdeps/posix/sysconf.c @@ -527,8 +527,8 @@ __sysconf (name) #endif case _SC_THREAD_DESTRUCTOR_ITERATIONS: -#ifdef PTHREAD_DESTRUCTOR_ITERATIONS - return PTHREAD_DESTRUCTOR_ITERATIONS; +#ifdef _POSIX_THREAD_DESTRUCTOR_ITERATIONS + return _POSIX_THREAD_DESTRUCTOR_ITERATIONS; #else return -1; #endif diff --git a/sysdeps/stub/libc-lock.h b/sysdeps/stub/libc-lock.h index a8608df791..ca2d77c220 100644 --- a/sysdeps/stub/libc-lock.h +++ b/sysdeps/stub/libc-lock.h @@ -48,5 +48,11 @@ Cambridge, MA 02139, USA. */ /* Unlock the named lock variable. */ #define __libc_lock_unlock(NAME) +/* Start critical region with cleanup. */ +#define __libc_cleanup_region_start(FCT, ARG) + +/* End critical region with cleanup. */ +#define __libc_cleanup_region_end(DOIT) + #endif /* libc-lock.h */ diff --git a/sysdeps/unix/alpha/sysdep.S b/sysdeps/unix/alpha/sysdep.S index 336eb02029..8d70bda21e 100644 --- a/sysdeps/unix/alpha/sysdep.S +++ b/sysdeps/unix/alpha/sysdep.S @@ -17,8 +17,7 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <sysdep.h> -#define _ERRNO_H -#include <errnos.h> +#include <features.h> .section .bss .globl errno @@ -30,15 +29,60 @@ errno: .space 4 #endif .text -LEAF(__syscall_error, 0) + .align 2 + +#ifdef _LIBC_REENTRANT + + .globl __syscall_error + .ent __syscall_error +__syscall_error: ldgp gp, 0(t12) + lda sp, -16(sp) + .frame sp, 16, ra, 0 + stq ra, 0(sp) + stq v0, 8(sp) + .mask 0x4000001, -16 .prologue 1 - /* Store return value in errno... */ - stl v0, errno + /* Find our pre-thread errno address */ + jsr ra, __errno_location + + /* Store the error value. */ + ldl t0, 8(sp) + stl t0, 0(v0) - /* And just kick back a -1. */ + /* And kick back a -1. */ ldi v0, -1 + + ldq ra, 0(sp) + lda sp, 16(sp) ret + .end __syscall_error + +/* A default non-threaded version of __errno_location that just returns + the address of errno. */ + + .weak __errno_location + .ent __errno_location +__errno_location: + .frame sp, 0, ra + ldgp gp, 0(t12) + .mask 0, 0 + .prologue 1 + lda v0, errno + ret + .end __errno_location + +#else + +ENTRY(__syscall_error) + ldgp gp, 0(t12) + .prologue 1 + + stl v0, errno + lda v0, -1 + ret END(__syscall_error) + +#endif /* _LIBC_REENTRANT */ diff --git a/sysdeps/unix/i386/sysdep.S b/sysdeps/unix/i386/sysdep.S index 95e2fd5c7a..7dced7cda5 100644 --- a/sysdeps/unix/i386/sysdep.S +++ b/sysdeps/unix/i386/sysdep.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 93, 94, 95, 96 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 @@ -36,17 +36,40 @@ syscall_error: cmpl $EWOULDBLOCK_sys, %eax /* Is it the old EWOULDBLOCK? */ jne notb /* Branch if not. */ movl $EAGAIN, %eax /* Yes; translate it to EAGAIN. */ -#endif notb: +#endif #ifndef PIC movl %eax, C_SYMBOL_NAME(errno) +#ifdef _LIBC_REENTRANT + pushl %eax + call __errno_location + popl %ecx + movl %ecx, (%eax) +#endif #else /* The caller has pushed %ebx and then set it up to point to the GOT before calling us through the PLT. */ movl C_SYMBOL_NAME(errno@GOT)(%ebx), %ecx + +#ifndef _LIBC_REENTRANT /* Pop %ebx value saved before jumping here. */ popl %ebx movl %eax, (%ecx) +#else + movl %eax, (%ecx) + pushl %eax + call C_SYMBOL_NAME(__errno_location@PLT) + popl %ecx + /* Pop %ebx value saved before jumping here. */ + popl %ebx + movl %ecx, (%eax) +#endif #endif movl $-1, %eax ret + +#ifdef __ELF__ +#undef __syscall_error +.Lfe2: + .size __syscall_error, .Lfe2-__syscall_error +#endif diff --git a/sysdeps/unix/opendir.c b/sysdeps/unix/opendir.c index 890d428086..7161cec6e9 100644 --- a/sysdeps/unix/opendir.c +++ b/sysdeps/unix/opendir.c @@ -91,7 +91,7 @@ __opendir (const char *name) dirp->fd = fd; - __libc_lock_init (dirp->lock); + __libc_lock_init (dirp->lock) return dirp; } diff --git a/sysdeps/unix/sysv/linux/errnos.h b/sysdeps/unix/sysv/linux/errnos.h index be1e4d3feb..868819e6b3 100644 --- a/sysdeps/unix/sysv/linux/errnos.h +++ b/sysdeps/unix/sysv/linux/errnos.h @@ -1 +1,33 @@ +/* errnos.h - error constants. Linux specific version. +Copyright (C) 1996 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library 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 <linux/errno.h> + +#ifndef __ASSEMBLER__ +#if defined __USE_REENTRANT && (!defined _LIBC || defined _LIBC_REENTRANT) +/* Declare alias of `errno' variable so it is accessible even if macro + with name `errno' is defined. */ +extern int __errno; + +/* When using threads, errno is a per-thread value. */ +extern int *__errno_location __P ((void)) __attribute__ ((__const__)); +#define errno (*__errno_location ()) + +#endif +#endif diff --git a/sysdeps/unix/sysv/linux/gnu/types.h b/sysdeps/unix/sysv/linux/gnu/types.h index abfcb6e9c9..745d2d8e2e 100644 --- a/sysdeps/unix/sysv/linux/gnu/types.h +++ b/sysdeps/unix/sysv/linux/gnu/types.h @@ -70,4 +70,8 @@ typedef __kernel_clock_t __clock_t; XPG4 seems to require `unsigned long'. */ typedef unsigned long __fd_mask; +#ifdef __USE_SVID +typedef int key_t; +#endif + #endif /* gnu/types.h */ diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.S b/sysdeps/unix/sysv/linux/i386/sysdep.S index 0130ad02a9..7d5444d6a6 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.S +++ b/sysdeps/unix/sysv/linux/i386/sysdep.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1995 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1996 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 @@ -27,26 +27,46 @@ Cambridge, MA 02139, USA. */ .globl errno .type errno,@object .size errno,4 -errno: .space 4 +errno: .zero 4 .globl _errno .type _errno,@object _errno = errno /* This name is expected by hj libc.so.5 startup code. */ .text -/* The following code is not used at all in the shared library. - The PIC system call stubs set errno themselves. */ +/* The following code is only used in the shared library when we + compile the reentrant version. Otherwise each system call defines + each own version. */ -#ifndef PIC +#ifndef PIC /* The syscall stubs jump here when they detect an error. The code for Linux is almost identical to the canonical Unix/i386 code, except that the error number in %eax is negated. */ -.globl __syscall_error + .globl __syscall_error + .type __syscall_error,@function __syscall_error: negl %eax #define __syscall_error __syscall_error_1 #include <sysdeps/unix/i386/sysdep.S> +#endif /* !PIC */ + + +#ifdef _LIBC_REENTRANT + .globl __errno_location + .type __errno_location,@function +__errno_location: +#ifdef PIC + call .L2 +.L2: popl %ecx + addl $_GLOBAL_OFFSET_TABLE_+[.-.L2], %ecx + movl errno@GOT(%ecx), %eax +#else + movl $errno, %eax +#endif + ret +.Lfe1: + .size __errno_location, .Lfe1-__errno_location #endif diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h index c77bbbbf86..96470a19b9 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.h +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -45,21 +45,44 @@ Cambridge, MA 02139, USA. */ testl %eax, %eax; \ jl syscall_error; -#ifndef PIC +#ifndef PIC #define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */ #else /* Store (- %eax) into errno through the GOT. */ +#ifdef _LIBC_REENTRANT #define SYSCALL_ERROR_HANDLER \ + .type syscall_error,@function; \ +syscall_error: \ + pushl %ebx; \ + call 0f; \ +0:popl %ebx; \ + xorl %edx, %edx; \ + addl $_GLOBAL_OFFSET_TABLE_+[.-0b], %ebx; \ + subl %eax, %edx; \ + movl errno@GOT(%ebx), %ecx; \ + movl %edx, (%ecx); \ + pushl %edx; \ + call __errno_location@PLT; \ + popl %ecx; \ + popl %ebx; \ + movl %ecx, (%eax); \ + movl $-1, %eax; \ + ret; +#else +#define SYSCALL_ERROR_HANDLER \ + .type syscall_error,@function; \ syscall_error: \ call 0f; \ 0:popl %ecx; \ - negl %eax; \ + xorl %edx, %edx; \ addl $_GLOBAL_OFFSET_TABLE_+[.-0b], %ecx; \ + subl %eax, %edx; \ movl errno@GOT(%ecx), %ecx; \ - movl %eax, (%ecx); \ + movl %edx, (%ecx); \ movl $-1, %eax; \ ret; -#endif +#endif /* _LIBC_REENTRANT */ +#endif /* PIC */ /* Linux takes system call arguments in registers: diff --git a/sysdeps/unix/sysv/linux/schedbits.h b/sysdeps/unix/sysv/linux/schedbits.h new file mode 100644 index 0000000000..ac27b9e2d2 --- /dev/null +++ b/sysdeps/unix/sysv/linux/schedbits.h @@ -0,0 +1,51 @@ +/* Definitions of constants and data structure for POSIX 1003.1b-1993 + scheduling interface. +Copyright (C) 1996 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library 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. */ + +#ifndef _SCHEDBITS_H +#define _SCHEDBITS_H 1 + +/* Scheduling algorithms. */ +#define SCHED_OTHER 0 +#define SCHED_FIFO 1 +#define SCHED_RR 2 + +/* Data structure to describe a process' schedulability. */ +struct sched_params +{ + int sched_priority; +}; + +/* Cloning flags. */ +#define CSIGNAL 0x000000ff /* Signal mask to be sent at exit. */ +#define CLONE_VM 0x00000100 /* Set if VM shared between processes. */ +#define CLONE_FS 0x00000200 /* Set if fs info shared between processes.*/ +#define CLONE_FILES 0x00000400 /* Set if open files shared between processes*/ +#define CLONE_SIGHAND 0x00000800 /* Set if signal handlers shared. */ +#define CLONE_PID 0x00001000 /* Set if pid shared. */ + + +/* Clone current process. The parameter list of FN is not for true. Only + dots is not allowed by ISO C and without argument the compiler would + complain about a missing parameter list. */ +extern int clone __P ((int (*__fn) (void *, ...), void *__child_stack, + int __flags, int __nargs, ...)); + + +#endif /* schedbits.h */ diff --git a/sysdeps/unix/sysv/linux/waitflags.h b/sysdeps/unix/sysv/linux/waitflags.h new file mode 100644 index 0000000000..0be2825159 --- /dev/null +++ b/sysdeps/unix/sysv/linux/waitflags.h @@ -0,0 +1,30 @@ +/* Definitions of flag bits for `waitpid' et al. +Copyright (C) 1992, 1996 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 Library General Public License as +published by the Free Software Foundation; either version 2 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 +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#ifndef _WAITFLAGS_H + +#define _WAITFLAGS_H 1 + +/* Bits in the third argument to `waitpid'. */ +#define WNOHANG 1 /* Don't block waiting. */ +#define WUNTRACED 2 /* Report status of stopped children. */ + +#define __WCLONE 0x80000000 /* Wait for cloned process. */ + +#endif /* waitflags.h */ |