aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysv')
-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
6 files changed, 170 insertions, 10 deletions
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 */