aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1996-09-07 04:10:57 +0000
committerUlrich Drepper <drepper@redhat.com>1996-09-07 04:10:57 +0000
commitedf5b2d7168982e1725f41e142b77e5ec88d7bf2 (patch)
treed8f99738ad6b0db07f474b26ebb8db432c147056 /sysdeps
parent474be527c80085dfdc48568f44e1359e5452c47e (diff)
downloadglibc-edf5b2d7168982e1725f41e142b77e5ec88d7bf2.zip
glibc-edf5b2d7168982e1725f41e142b77e5ec88d7bf2.tar.gz
glibc-edf5b2d7168982e1725f41e142b77e5ec88d7bf2.tar.bz2
update from main archive 960906cvs/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')
-rw-r--r--sysdeps/alpha/elf/start.S1
-rw-r--r--sysdeps/generic/gnu/types.h3
-rw-r--r--sysdeps/generic/prof-freq.c57
-rw-r--r--sysdeps/i386/dl-machine.h7
-rw-r--r--sysdeps/mach/hurd/prof-freq.c2
-rw-r--r--sysdeps/posix/sysconf.c4
-rw-r--r--sysdeps/stub/libc-lock.h6
-rw-r--r--sysdeps/unix/alpha/sysdep.S56
-rw-r--r--sysdeps/unix/i386/sysdep.S27
-rw-r--r--sysdeps/unix/opendir.c2
-rw-r--r--sysdeps/unix/sysv/linux/errnos.h32
-rw-r--r--sysdeps/unix/sysv/linux/gnu/types.h4
-rw-r--r--sysdeps/unix/sysv/linux/i386/sysdep.S32
-rw-r--r--sysdeps/unix/sysv/linux/i386/sysdep.h31
-rw-r--r--sysdeps/unix/sysv/linux/schedbits.h51
-rw-r--r--sysdeps/unix/sysv/linux/waitflags.h30
16 files changed, 321 insertions, 24 deletions
diff --git a/sysdeps/alpha/elf/start.S b/sysdeps/alpha/elf/start.S
index d20a009..c8b374a 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 decd26c..614252a 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 4e952e7..c69b43e 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 83b6f8d..5bd0f82 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 a370703..5c0d307 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 5b2caf6..29d0613 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 a8608df..ca2d77c 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 336eb02..8d70bda 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 95e2fd5..7dced7c 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 890d428..7161cec 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 be1e4d3..868819e 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 abfcb6e..745d2d8 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 0130ad0..7d5444d 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 c77bbbb..96470a1 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 0000000..ac27b9e
--- /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 0000000..0be2825
--- /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 */