diff options
Diffstat (limited to 'sysdeps/unix/sysv/linux')
26 files changed, 96 insertions, 52 deletions
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 33220df..7cfa06d 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -7,7 +7,8 @@ sysdep_routines += sysctl clone sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \ sys/module.h sys/io.h sys/klog.h sys/kdaemon.h \ - sys/user.h syscall-list.h sys/sysmacros.h sys/procfs.h + sys/user.h syscall-list.h sys/sysmacros.h sys/procfs.h \ + sys/debugreg.h sys/kd.h sys/soundcard.h sys/vt.h # Generate the list of SYS_* macros for the system calls (__NR_* macros). $(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/syscall.h diff --git a/sysdeps/unix/sysv/linux/adjtime.c b/sysdeps/unix/sysv/linux/adjtime.c index 44a0cbb..be42ed3 100644 --- a/sysdeps/unix/sysv/linux/adjtime.c +++ b/sysdeps/unix/sysv/linux/adjtime.c @@ -43,7 +43,7 @@ __adjtime (itv, otv) tmp.tv_usec = itv->tv_usec % 1000000L; if (tmp.tv_sec > MAX_SEC || tmp.tv_sec < MIN_SEC) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } tntx.offset = tmp.tv_usec + tmp.tv_sec * 1000000L; diff --git a/sysdeps/unix/sysv/linux/alpha/ioperm.c b/sysdeps/unix/sysv/linux/alpha/ioperm.c index 731059e..924fc47 100644 --- a/sysdeps/unix/sysv/linux/alpha/ioperm.c +++ b/sysdeps/unix/sysv/linux/alpha/ioperm.c @@ -326,7 +326,7 @@ init_iosys (void) fprintf(stderr, "ioperm.init_iosys(): Unable to determine system type.\n" "\t(May need " PATH_ALPHA_SYSTYPE " symlink?)\n"); - errno = ENODEV; + __set_errno (ENODEV); return -1; } } @@ -349,7 +349,7 @@ init_iosys (void) } /* systype is not a know platform name... */ - errno = EINVAL; + __set_errno (EINVAL); return -1; } @@ -366,7 +366,7 @@ _ioperm (unsigned long from, unsigned long num, int turn_on) /* this test isn't as silly as it may look like; consider overflows! */ if (from >= MAX_PORT || from + num > MAX_PORT) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } @@ -391,7 +391,7 @@ _ioperm (unsigned long from, unsigned long num, int turn_on) case IOSYS_APECS: base = APECS_IO_BASE; break; case IOSYS_CIA: base = CIA_IO_BASE; break; default: - errno = ENODEV; + __set_errno (ENODEV); return -1; } addr = port_to_cpu_addr (from, io.sys, 1); @@ -425,7 +425,7 @@ _iopl (unsigned int level) { if (level > 3) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } if (level) diff --git a/sysdeps/unix/sysv/linux/errnos.h b/sysdeps/unix/sysv/linux/errnos.h index 868819e..8a7055a 100644 --- a/sysdeps/unix/sysv/linux/errnos.h +++ b/sysdeps/unix/sysv/linux/errnos.h @@ -29,5 +29,11 @@ extern int __errno; extern int *__errno_location __P ((void)) __attribute__ ((__const__)); #define errno (*__errno_location ()) +#define __set_errno(val) errno = __errno = (val) + +#else /* !__USE_REENTRENT || (_LIBC && !_LIBC_REENTRANT) */ + +#define __set_errno(val) errno = (val) + #endif #endif diff --git a/sysdeps/unix/sysv/linux/gethostid.c b/sysdeps/unix/sysv/linux/gethostid.c index 2883441..a1d141b 100644 --- a/sysdeps/unix/sysv/linux/gethostid.c +++ b/sysdeps/unix/sysv/linux/gethostid.c @@ -32,7 +32,7 @@ sethostid (id) /* Test for appropriate rights to set host ID. */ if (geteuid () || getuid ()) { - errno = EPERM; + __set_errno (EPERM); return -1; } diff --git a/sysdeps/unix/sysv/linux/gethostname.c b/sysdeps/unix/sysv/linux/gethostname.c index 4b7720d..8a01fff 100644 --- a/sysdeps/unix/sysv/linux/gethostname.c +++ b/sysdeps/unix/sysv/linux/gethostname.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1995 Free Software Foundation, Inc. +/* Copyright (C) 1992, 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 @@ -33,7 +33,7 @@ __gethostname (name, len) if (name == NULL) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } @@ -42,7 +42,7 @@ __gethostname (name, len) if (strlen (buf.nodename) + 1 > len) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c index 81946b4..c4c6fd7 100644 --- a/sysdeps/unix/sysv/linux/getsysstats.c +++ b/sysdeps/unix/sysv/linux/getsysstats.c @@ -153,7 +153,7 @@ phys_pages_info (const char *format) if (result == -1) /* We cannot get the needed value: signal an error. */ - errno = ENOSYS; + __set_errno (ENOSYS); return result; } diff --git a/sysdeps/unix/sysv/linux/i386/brk.c b/sysdeps/unix/sysv/linux/i386/brk.c index f9e92dd..d11c3c4 100644 --- a/sysdeps/unix/sysv/linux/i386/brk.c +++ b/sysdeps/unix/sysv/linux/i386/brk.c @@ -45,11 +45,10 @@ __brk (void *addr) if (newbrk < addr) { - errno = ENOMEM; + __set_errno (ENOMEM); return -1; } return 0; } weak_alias (__brk, brk) - diff --git a/sysdeps/unix/sysv/linux/i386/sigaction.c b/sysdeps/unix/sysv/linux/i386/sigaction.c index 58e637e..f3ecd4b 100644 --- a/sysdeps/unix/sysv/linux/i386/sigaction.c +++ b/sysdeps/unix/sysv/linux/i386/sigaction.c @@ -1,5 +1,5 @@ /* POSIX.1 `sigaction' call for Linux/i386. -Copyright (C) 1991, 1995 Free Software Foundation, Inc. +Copyright (C) 1991, 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 @@ -48,7 +48,7 @@ __sigaction (int sig, const struct sigaction *act, struct sigaction *oact) if (result < 0) { - errno = -result; + __set_errno (-result); return -1; } return 0; diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.S b/sysdeps/unix/sysv/linux/i386/sysdep.S index 0f3e31d..213af51 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.S +++ b/sysdeps/unix/sysv/linux/i386/sysdep.S @@ -33,6 +33,9 @@ errno: .zero 4 .globl _errno .type _errno,@object _errno = errno /* This name is expected by hj libc.so.5 startup code. */ + .globl __errno + .type __errno,@object +__errno = errno /* This name is expected by the MT code. */ .text /* The following code is only used in the shared library when we diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.h b/sysdeps/unix/sysv/linux/i386/sysdep.h index cbd7b55..1bf20bd 100644 --- a/sysdeps/unix/sysv/linux/i386/sysdep.h +++ b/sysdeps/unix/sysv/linux/i386/sysdep.h @@ -71,6 +71,8 @@ syscall_error: \ movl %ecx, (%eax); \ movl $-1, %eax; \ ret; +/* A quick note: it is assumed that the call to `__errno_location' does + not modify the parameter value! */ #else #define SYSCALL_ERROR_HANDLER \ .type syscall_error,@function; \ diff --git a/sysdeps/unix/sysv/linux/m68k/brk.c b/sysdeps/unix/sysv/linux/m68k/brk.c index 3fd5475..402dfc5 100644 --- a/sysdeps/unix/sysv/linux/m68k/brk.c +++ b/sysdeps/unix/sysv/linux/m68k/brk.c @@ -42,11 +42,10 @@ __brk (void *addr) if (newbrk < addr) { - errno = ENOMEM; + __set_errno (ENOMEM); return -1; } return 0; } weak_alias (__brk, brk) - diff --git a/sysdeps/unix/sysv/linux/m68k/sysdep.S b/sysdeps/unix/sysv/linux/m68k/sysdep.S index b47e167..407c2d3 100644 --- a/sysdeps/unix/sysv/linux/m68k/sysdep.S +++ b/sysdeps/unix/sysv/linux/m68k/sysdep.S @@ -16,6 +16,8 @@ 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. */ +#include <sysdep.h> + /* Because the Linux version is in fact m68k/ELF and the start.? file for this system (sysdeps/m68k/elf/start.S) is also used by The Hurd and therefore this files must not contain the definition of the @@ -31,6 +33,9 @@ errno: .space 4 .globl _errno .type _errno,@object _errno = errno /* This name is expected by hj libc.so.5 startup code. */ + .globl __errno + .type __errno,@object +__errno = errno /* This name is expected by the MT code. */ .text /* The following code is only used in the shared library when we @@ -39,14 +44,9 @@ _errno = errno /* This name is expected by hj libc.so.5 startup code. */ #ifndef PIC -#include <sysdep.h> -#define _ERRNO_H -#include <errnos.h> - /* The syscall stubs jump here when they detect an error. */ -.globl __syscall_error -__syscall_error: +ENTRY(__syscall_error) neg.l %d0 move.l %d0, errno #ifdef _LIBC_REENTRANT @@ -62,9 +62,7 @@ __syscall_error: .size __syscall_error, . - __syscall_error #endif /* PIC */ - .globl __errno_location - .type __errno_location, @function -__errno_location: +ERRNO(__errno_location) #ifdef PIC move.l (%pc, errno@GOTPC), %a0 #else diff --git a/sysdeps/unix/sysv/linux/m68k/sysdep.h b/sysdeps/unix/sysv/linux/m68k/sysdep.h index 9de750c..cfc9b04 100644 --- a/sysdeps/unix/sysv/linux/m68k/sysdep.h +++ b/sysdeps/unix/sysv/linux/m68k/sysdep.h @@ -86,7 +86,7 @@ syscall_error: \ neg.l %d0; \ move.l %d0, (%a0); \ move.l %d0, -(%sp); \ - jbsr __errno_location@PLTPC \ + jbsr __errno_location@PLTPC; \ move.l (%sp)+, (%a0); \ move.l POUND -1, %d0; \ /* Copy return value to %a0 for syscalls that are declared to return \ diff --git a/sysdeps/unix/sysv/linux/ptrace.c b/sysdeps/unix/sysv/linux/ptrace.c index 32cc990..ede413a 100644 --- a/sysdeps/unix/sysv/linux/ptrace.c +++ b/sysdeps/unix/sysv/linux/ptrace.c @@ -46,12 +46,12 @@ ptrace (enum __ptrace_request request, ...) { if (request > 0 && request < 4) { - errno = 0; + __set_errno (0); return ret; } return res; } - errno = -res; + __set_errno (-res); return -1; } diff --git a/sysdeps/unix/sysv/linux/sigsuspend.c b/sysdeps/unix/sysv/linux/sigsuspend.c index 53510b9..1aeda82 100644 --- a/sysdeps/unix/sysv/linux/sigsuspend.c +++ b/sysdeps/unix/sysv/linux/sigsuspend.c @@ -16,8 +16,6 @@ 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 <ansidecl.h> -#include <errno.h> #include <signal.h> #include <stddef.h> #include <unistd.h> @@ -27,7 +25,8 @@ extern int __syscall_sigsuspend (int, unsigned long, unsigned long); /* Change the set of blocked signals to SET, wait until a signal arrives, and restore the set of blocked signals. */ int -DEFUN(sigsuspend, (set), CONST sigset_t *set) +sigsuspend (set) + const sigset_t *set; { return __syscall_sigsuspend (0, 0, *set); } diff --git a/sysdeps/unix/sysv/linux/sleep.c b/sysdeps/unix/sysv/linux/sleep.c new file mode 100644 index 0000000..1094df5 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sleep.c @@ -0,0 +1,36 @@ +/* sleep - Implementation of the POSIX sleep function using nanosleep. +Copyright (C) 1996 Free Software Foundation, Inc. +This file is part of the GNU C Library. +Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. + +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 <time.h> + +unsigned int +sleep (unsigned int seconds) +{ + struct timespec ts = { tv_sec: (long int) seconds, tv_nsec: 0 }; + unsigned int result; + + if (nanosleep (&ts, &ts) == 0) + result = 0; + else + /* Round remaining time. */ + result = (unsigned int) ts.tv_sec + (ts.tv_nsec >= 500000000L); + + return result; +} diff --git a/sysdeps/unix/sysv/linux/speed.c b/sysdeps/unix/sysv/linux/speed.c index 0ad48a2..9dd5e2f 100644 --- a/sysdeps/unix/sysv/linux/speed.c +++ b/sysdeps/unix/sysv/linux/speed.c @@ -79,7 +79,7 @@ cfsetospeed (termios_p, speed) if (termios_p == NULL) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } @@ -97,7 +97,7 @@ cfsetospeed (termios_p, speed) return 0; } - errno = EINVAL; + __set_errno (EINVAL); return -1; } diff --git a/sysdeps/unix/sysv/linux/sys/debugreg.h b/sysdeps/unix/sysv/linux/sys/debugreg.h new file mode 100644 index 0000000..4300643 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sys/debugreg.h @@ -0,0 +1 @@ +#include <linux/debugreg.h> diff --git a/sysdeps/unix/sysv/linux/sys/kd.h b/sysdeps/unix/sysv/linux/sys/kd.h new file mode 100644 index 0000000..33b873f --- /dev/null +++ b/sysdeps/unix/sysv/linux/sys/kd.h @@ -0,0 +1 @@ +#include <linux/kd.h> diff --git a/sysdeps/unix/sysv/linux/sys/soundcard.h b/sysdeps/unix/sysv/linux/sys/soundcard.h new file mode 100644 index 0000000..098fae1 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sys/soundcard.h @@ -0,0 +1 @@ +#include <linux/soundard.h> diff --git a/sysdeps/unix/sysv/linux/sys/vt.h b/sysdeps/unix/sysv/linux/sys/vt.h new file mode 100644 index 0000000..834abfb --- /dev/null +++ b/sysdeps/unix/sysv/linux/sys/vt.h @@ -0,0 +1 @@ +#include <linux/vt.h> diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index d9dd3d1..3601b5f 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -26,7 +26,8 @@ mount EXTRA mount 5 __mount mount mremap - mremap 4 __mremap mremap munlock - munlock 2 __munlock munlock munlockall - munlockall 0 __munlockall munlockall -nanosleep - nanosleep 2 nanosleep +nanosleep - nanosleep 2 __libc_nanosleep nanosleep +pause - pause 0 __libc_pause pause personality init-first personality 1 __personality personality pipe - pipe 1 __pipe pipe s_getpriority getpriority getpriority 2 __syscall_getpriority diff --git a/sysdeps/unix/sysv/linux/tcdrain.c b/sysdeps/unix/sysv/linux/tcdrain.c index 20cc809..bd561b6 100644 --- a/sysdeps/unix/sysv/linux/tcdrain.c +++ b/sysdeps/unix/sysv/linux/tcdrain.c @@ -21,9 +21,9 @@ Cambridge, MA 02139, USA. */ /* Wait for pending output to be written on FD. */ int -tcdrain (fd) - int fd; +__libc_tcdrain (int fd) { /* With an argument of 1, TCSBRK for output to be drain. */ return __ioctl (fd, TCSBRK, 1); } +weak_alias (__libc_tcdrain, tcdrain) diff --git a/sysdeps/unix/sysv/linux/ulimit.c b/sysdeps/unix/sysv/linux/ulimit.c index 2b11930..7493eaf 100644 --- a/sysdeps/unix/sysv/linux/ulimit.c +++ b/sysdeps/unix/sysv/linux/ulimit.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1994, 1995 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 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 @@ -16,7 +16,6 @@ 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. */ -#include <ansidecl.h> #include <sysdep.h> #include <sys/resource.h> #include <unistd.h> @@ -45,7 +44,7 @@ __ulimit (cmd, newlimit) /* Get limit on file size. */ struct rlimit fsize; - status = getrlimit(RLIMIT_FSIZE, &fsize); + status = getrlimit (RLIMIT_FSIZE, &fsize); if (status < 0) return -1; @@ -58,14 +57,14 @@ __ulimit (cmd, newlimit) struct rlimit fsize; fsize.rlim_cur = newlimit * 512; fsize.rlim_max = newlimit * 512; - - return setrlimit(RLIMIT_FSIZE, &fsize); + + return setrlimit (RLIMIT_FSIZE, &fsize); } case 4: - return sysconf(_SC_OPEN_MAX); + return sysconf (_SC_OPEN_MAX); default: - errno = EINVAL; + __set_errno (EINVAL); return -1; } } diff --git a/sysdeps/unix/sysv/linux/waitpid.c b/sysdeps/unix/sysv/linux/waitpid.c index d4ee06b..bbb98a4 100644 --- a/sysdeps/unix/sysv/linux/waitpid.c +++ b/sysdeps/unix/sysv/linux/waitpid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1995 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 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 @@ -21,12 +21,9 @@ Cambridge, MA 02139, USA. */ #include <sys/wait.h> __pid_t -__waitpid (pid, stat_loc, options) - __pid_t pid; - int *stat_loc; - int options; +__libc_waitpid (__pid_t pid, int *stat_loc, int options) { return __wait4 (pid, stat_loc, options, NULL); } - -weak_alias (__waitpid, waitpid) +weak_alias (__libc_waitpid, __waitpid) +weak_alias (__libc_waitpid, waitpid) |