diff options
author | Ulrich Drepper <drepper@redhat.com> | 1996-09-07 04:10:57 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1996-09-07 04:10:57 +0000 |
commit | edf5b2d7168982e1725f41e142b77e5ec88d7bf2 (patch) | |
tree | d8f99738ad6b0db07f474b26ebb8db432c147056 /sysdeps/unix | |
parent | 474be527c80085dfdc48568f44e1359e5452c47e (diff) | |
download | glibc-edf5b2d7168982e1725f41e142b77e5ec88d7bf2.tar.gz glibc-edf5b2d7168982e1725f41e142b77e5ec88d7bf2.tar.xz glibc-edf5b2d7168982e1725f41e142b77e5ec88d7bf2.zip |
update from main archive 960906 cvs/libc-960907
Sat Sep 7 05:15:45 1996 Ulrich Drepper <drepper@cygnus.com> * libio/iofdopen: Initialize _lock field only if _IO_MTSAFE_IO. * libio/iofopen: Likewise. * libio/iofopncook.c: Likewise. * libio/iopopen.c: Likewise. * libio/iovsprintf.c: Likewise. * libio/iovsscanf.c: Likewise. * libio/memstream.c: Likewise. * libio/vasprintf.c: Likewise. * libio/vdprintf.c: Likewise. * libio/vsnprintf.c: Likewise. Sat Sep 7 03:55:47 1996 Ulrich Drepper <drepper@cygnus.com> * Makeconfig (soversions.mk): Also use shlib-versions files in add-on directories. * config.make.in (config-defines): Remove. Not used anymore. (defines): New variable. Initiliazed by @DEFINES@. * configure.in: Add AC_SUBST(DEFINES). * libio/Makefile (routines): When compiling reentrant libc add clearerr_u, feof_u, ferror_u, fputc_u, getc_u, getchar_u, iofflush_u, putc_u, putchar_u, ioflockfile. (CPPFLAGS): Add -D_IO_MTSAFE_IO for reentrant libc. * sysdeps/stub/libc-lock.h: Add stubs for __libc_cleanup_region_start and __libc_cleanup_region_end. * sysdeps/unix/i386/sysdep.S [_LIBC_REENTRANT]: Set errno using __errno_location function. * sysdeps/unix/sysv/linux/i386/sysdep.S [_LIBC_REENTRANT]: Set errno using __errno_location function. (__errno_location): New function. * sysdeps/unix/sysv/linux/i386/sysdep.h [PIC]: Add second syscall_error handler for reentrant libc. * sysdeps/unix/opendir.c: Remove unneeded `;'. * libio.h [_IO_MTSAFE_IO]: Include <pthread.h>. [!_IO_MTSAFE_IO]: Define _IO_flockfile and _IO_funlockfile as empty macros. * libioP.h: Include <libc-lock.h>. * libio/stdio.h: Add prototypes for *_locked and *_unlocked functions. * libio/clearerr.c: Use _IO_ protected versions of flockfile and funlockfile to be namespace clean. * libio/genops.c: Use __libc_lock_* macros for handling lock. * libio/iofdopen: Add initialization of _lock in _IO_FILE. * libio/iofopen: Likewise. * libio/iofopncook.c: Likewise. * libio/iopopen.c: Likewise. * libio/iovsprintf.c: Likewise. * libio/iovsscanf.c: Likewise. * libio/memstream.c: Likewise. * libio/vasprintf.c: Likewise. * libio/vdprintf.c: Likewise. * libio/vsnprintf.c: Likewise. * libio/fgetc.c: Use __libc_cleanup_region_* macros instead of flockfile etc. * libio/fputc.c: Likewise. * libio/freopen.c: Likewise. * libio/fseek.c: Likewise. * libio/getc.c: Likewise. * libio/getchar.c: Likewise. * libio/iofclose.c: Likewise. * libio/iofflush.c: Likewise. * libio/iofgetpos.c: Likewise. * libio/iofgets.c: Likewise. * libio/iofputs.c: Likewise. * libio/iofread.c: Likewise. * libio/iofsetpos.c: Likewise. * libio/ioftell.c: Likewise. * libio/iofwrite.c: Likewise. * libio/iogetdelim.c: Likewise. * libio/iogets.c: Likewise. * libio/ioputs.c: Likewise. * libio/iosetbuffer.c: Likewise. * libio/iosetvbuf.c: Likewise. * libio/ioungetc.c: Likewise. * libio/putc.c: Likewise. * libio/putchar.c: Likewise. * libio/rewind.c: Likewise. * stdio-common/vfprintf.c: Likewise. * stdio-common/vfscanf.c: Likewise. * libio/clearerr_u.c: Correct alias name. * libio/ferror_u.c: Likewise. * libio/fileno.c: Likewise. * libio/fputc_u.c: Likewise. * libio/getc.c: Likewise. * libio/getc_u.c: Likewise. * libio/getchar.c: Likewise. * libio/getchar_u.c: Likewise. * libio/putc.c: Likewise. * libio/putchar.c: Likewise. * libio/feof_u.c: Undefine macro with name of function before definition of function itself. * libio/ioflockfile.c: New file. Implementation of flockfile and funlockfile. * libio/putchar_u.c: Fix typo. Use stdout instead of fp. * malloc/malloc.h: Don't include <libc-lock.h> and don't declare _malloc_loc. * malloc/free.c: Include <libc-lock.h>. * malloc/realloc.c: Likewise. * malloc/malloc-find.c: Likewise. * malloc/malloc-size.c: Likewise. * malloc/malloc-walk.c: Likewise. * malloc/memalign.c: Likewise. * malloc/malloc.c: Likewise. * sysdeps/i386/dl-machine.h: Correct clearing of _dl_starting_up. Fri Sep 6 19:38:49 1996 Ulrich Drepper <drepper@cygnus.com> * sysdeps/stub/libc-lock.h: Define __libc_lock_critical_start and __libc_lock_critical_end as empty macros. * malloc/malloc.h: Don't include <libc-lock.h> and don't declare __libc_malloc_lock. * malloc/free.c: Include <libc-lock.h>. * malloc/malloc-find.c: Likewise. * malloc/malloc-size.c: Likewise. * malloc/malloc-walk.c: Likewise. * malloc/malloc.c: Likewise. * malloc/memalign.c: Likewise. * malloc/realloc.c: Likewise. * Makefile: Undo change from Mon Sep 2 22:15:14 1996. No more extra_solibs pass. * Rules: Likewise. * extra-lib.mk: Likewise. * manual/Makefile: Likewise. * db/Makefile (makedb): Choose dependecies based on build-shared. Patch by Andres Schwab. * sysdeps/posix/sysconf.c: Don't use PTHREAD_DESTRUCTOR_ITERATIONS but _POSIX_THREAD_DESTRUCTOR_ITERATIONS. * sysdeps/unix/sysv/linux/errnos.h: New file. * sysdeps/unix/sysv/linux/schedbits.h: New file. * sysdeps/unix/sysv/linux/waitflags.h: New file. * sysdeps/unix/sysv/linux/gnu/types.h: Add definition of `key_t'. Fri Sep 6 08:26:31 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * rpm/template: Fix typo in %build section. Fri Sep 6 03:31:07 1996 Ulrich Drepper <drepper@cygnus.com> * sysdeps/unix/sysv/linux/errnos.h: Don't define errno macro when building libc without thread support. * resolv/netdb.h: Likewise for h_errno macro. Thu Sep 5 23:01:48 1996 Ulrich Drepper <drepper@cygnus.com> * libc-symbols.h: Add new macro weak_const_function. It's like weak_function, but the function is additionally marked as const. * features.h: Only include <sys/cdefs.h> if !__ASSEMBLER__. Thu Sep 5 22:55:49 1996 Richard Henderson <rth@tamu.edu> * inet/herrno.c (__h_errno_location): New function. (h_errno): Make strong_alias __h_errno so that we can access the variable even if `h_errno' is a macro. * resolv/netdb.h: Define macro h_errno to access thread specific version of h_errno variable. Declare alias __h_errno for h_errno. * resolv/res_query (h_errno): Remove definition. * sysdeps/unix/sysv/linux/errnos.h [!__ASSEMBLER__ && __USE_REENTRANT]: Add macro `errno' to get thread specific variable. * sysdeps/unix/alpha/sysdep.S [_LIBC_REENTRANT]: Set errno using __errno_location function. (__errno_location): New function. Thu Sep 5 21:08:44 1996 Ulrich Drepper <drepper@cygnus.com> * posix/gnu/types.h: Remove definition of key_t. * sysdeps/generic/gnu/types.h: Move it to here. * sysdeps/unix/sysv/linux/gnu/types.h: Add Linux specific definition of key_t. * sysdeps/unix/sysv/linux/waitflags.h: New file. Linux specific definitions. * sysdeps/unix/sysv/linux/schedbits.h: New file. Include clone prototypes and associated flags. Thu Sep 5 08:58:47 1996 Richard Henderson <rth@tamu.edu> * sysdeps/alpha/elf/start.S: Make _start global again. hertz. here. Wed Sep 4 16:16:13 1996 Ulrich Drepper <drepper@cygnus.com> * sysdeps/mach/hurd/send.c (__send): De-ANSI-fy. * sysdeps/mach/hurd/sendto.c (sendto): Likewise.
Diffstat (limited to 'sysdeps/unix')
-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 |
9 files changed, 246 insertions, 19 deletions
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 */ |