diff options
Diffstat (limited to 'sysdeps/unix/sysv')
41 files changed, 179 insertions, 129 deletions
diff --git a/sysdeps/unix/sysv/irix4/getpriority.c b/sysdeps/unix/sysv/irix4/getpriority.c index 70a9431890..6ba6219791 100644 --- a/sysdeps/unix/sysv/irix4/getpriority.c +++ b/sysdeps/unix/sysv/irix4/getpriority.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994 Free Software Foundation, Inc. +/* Copyright (C) 1994, 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 @@ -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 <errno.h> #include <sys/resource.h> #include <sys/sysmp.h> @@ -28,8 +27,9 @@ extern int __sysmp __P ((int, ...)); or user (as specified by WHO) is used. A lower priority number means higher priority. Priorities range from PRIO_MIN to PRIO_MAX. */ int -DEFUN(getpriority, (which, who), - enum __priority_which which AND int who) +getpriority (which, who) + enum __priority_which which; + int who; { switch (which) { @@ -41,6 +41,6 @@ DEFUN(getpriority, (which, who), return __sysmp (MP_SCHED, MPTS_GTNICE_USER, who); } - errno = EINVAL; + __set_errno (EINVAL); return -1; } diff --git a/sysdeps/unix/sysv/irix4/setpriority.c b/sysdeps/unix/sysv/irix4/setpriority.c index a632953423..322813a7dd 100644 --- a/sysdeps/unix/sysv/irix4/setpriority.c +++ b/sysdeps/unix/sysv/irix4/setpriority.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994 Free Software Foundation, Inc. +/* Copyright (C) 1994, 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 @@ -16,14 +16,15 @@ 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 <errno.h> #include <sys/resource.h> #include <sys/sysmp.h> int -DEFUN(setpriority, (which, who, prio), - enum __priority_which which AND int who AND int prio) +setpriority (which, who, prio) + enum __priority_which which; + int who; + int prio; { switch (which) { @@ -35,7 +36,6 @@ DEFUN(setpriority, (which, who, prio), return __sysmp (MP_SCHED, MPTS_RENICE_USER, who, prio); } - errno = EINVAL; + __set_errno (EINVAL); return -1; } - diff --git a/sysdeps/unix/sysv/irix4/start.c b/sysdeps/unix/sysv/irix4/start.c index cd86f85244..b11d27b6ed 100644 --- a/sysdeps/unix/sysv/irix4/start.c +++ b/sysdeps/unix/sysv/irix4/start.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 @@ -28,7 +28,8 @@ Cambridge, MA 02139, USA. */ /* The first piece of initialized data. */ int __data_start = 0; -VOLATILE int errno = 0; +VOLATILE int __errno = 0; +strong_alias (__errno, errno) extern void EXFUN(__libc_init, (int argc, char **argv, char **envp)); extern int EXFUN(main, (int argc, char **argv, char **envp)); diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 33220df5f6..7cfa06db66 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 44a0cbbdb5..be42ed337c 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 731059e600..924fc473b2 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 868819e6b3..8a7055aa6a 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 2883441c5b..a1d141b142 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 4b7720d414..8a01fff073 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 81946b422f..c4c6fd78f6 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 f9e92dde5e..d11c3c40d9 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 58e637eed5..f3ecd4bd15 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 0f3e31dbce..213af51548 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 cbd7b5553b..1bf20bd718 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 3fd547545e..402dfc56f7 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 b47e167159..407c2d393c 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 9de750c326..cfc9b04af0 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 32cc990119..ede413a43c 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 53510b9648..1aeda8224a 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 0000000000..1094df5129 --- /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 0ad48a23d8..9dd5e2f269 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 0000000000..43006438e3 --- /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 0000000000..33b873f49c --- /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 0000000000..098fae1c33 --- /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 0000000000..834abfbc8f --- /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 d9dd3d100a..3601b5f357 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 20cc809c6f..bd561b6d9e 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 2b1193085a..7493eaf5f3 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 d4ee06bf1b..bbb98a49db 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) diff --git a/sysdeps/unix/sysv/setrlimit.c b/sysdeps/unix/sysv/setrlimit.c index be4158e16e..2b005e39d6 100644 --- a/sysdeps/unix/sysv/setrlimit.c +++ b/sysdeps/unix/sysv/setrlimit.c @@ -1,6 +1,6 @@ /* setrlimit function for systems with ulimit system call (SYSV). -Copyright (C) 1991, 1992 Free Software Foundation, Inc. +Copyright (C) 1991, 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 @@ -20,7 +20,6 @@ Cambridge, MA 02139, USA. */ /* This only implements those functions which are available via ulimit. */ -#include <ansidecl.h> #include <sys/resource.h> #include <stddef.h> #include <errno.h> @@ -29,30 +28,31 @@ Cambridge, MA 02139, USA. */ Only the super-user can increase hard limits. Return 0 if successful, -1 if not (and sets errno). */ int -DEFUN(setrlimit, (resource, rlimits), - enum __rlimit_resource resource AND struct rlimit *rlimits) +setrlimit (resource, rlimits) + enum __rlimit_resource resource; + struct rlimit *rlimits; { if (rlimits == NULL) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } switch (resource) { case RLIMIT_FSIZE: - return __ulimit(2, rlimits->rlim_cur); + return __ulimit (2, rlimits->rlim_cur); case RLIMIT_DATA: case RLIMIT_CPU: case RLIMIT_STACK: case RLIMIT_CORE: case RLIMIT_RSS: - errno = ENOSYS; + __set_errno (ENOSYS); return -1; default: - errno = EINVAL; + __set_errno (EINVAL); return -1; } } diff --git a/sysdeps/unix/sysv/settimeofday.c b/sysdeps/unix/sysv/settimeofday.c index 1217c6beee..147f796a6c 100644 --- a/sysdeps/unix/sysv/settimeofday.c +++ b/sysdeps/unix/sysv/settimeofday.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 @@ -16,27 +16,27 @@ 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 <errno.h> #include <sys/time.h> /* Set the current time of day and timezone information. This call is restricted to the super-user. */ int -DEFUN(__settimeofday, (tv, tz), - CONST struct timeval *tv AND CONST struct timezone *tz) +__settimeofday (tv, tz) + const struct timeval *tv; + const struct timezone *tz; { time_t when; if (tv == NULL) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } if (tz != NULL || tv->tv_usec % 1000000 != 0) { - errno = ENOSYS; + __set_errno (ENOSYS); return -1; } diff --git a/sysdeps/unix/sysv/sigaction.c b/sysdeps/unix/sysv/sigaction.c index ebb42cf756..eafaec7289 100644 --- a/sysdeps/unix/sysv/sigaction.c +++ b/sysdeps/unix/sysv/sigaction.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1994, 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 @@ -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 <errno.h> #include <stddef.h> @@ -26,15 +25,17 @@ Cambridge, MA 02139, USA. */ /* If ACT is not NULL, change the action for SIG to *ACT. If OACT is not NULL, put the old action for SIG in *OACT. */ int -DEFUN(__sigaction, (sig, act, oact), - int sig AND CONST struct sigaction *act AND struct sigaction *oact) +__sigaction (sig, act, oact) + int sig; + const struct sigaction *act; + struct sigaction *oact; { sighandler_t handler; int save; if (sig <= 0 || sig >= NSIG) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } @@ -48,7 +49,7 @@ DEFUN(__sigaction, (sig, act, oact), return -1; save = errno; (void) signal (sig, handler); - errno = save; + __set_errno (save); } else { @@ -57,7 +58,7 @@ DEFUN(__sigaction, (sig, act, oact), if (act->sa_flags != 0) { unimplemented: - errno = ENOSYS; + __set_errno (ENOSYS); return -1; } diff --git a/sysdeps/unix/sysv/sysv4/sigaction.c b/sysdeps/unix/sysv/sysv4/sigaction.c index 68fd7a1846..37893fa649 100644 --- a/sysdeps/unix/sysv/sysv4/sigaction.c +++ b/sysdeps/unix/sysv/sysv4/sigaction.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1994, 1995 Free Software Foundation, Inc. +/* Copyright (C) 1994, 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 @@ -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 <errno.h> #include <signal.h> #include <stddef.h> @@ -38,15 +37,17 @@ trampoline (int sig, int code, struct sigcontext *context) /* If ACT is not NULL, change the action for SIG to *ACT. If OACT is not NULL, put the old action for SIG in *OACT. */ int -DEFUN(__sigaction, (sig, act, oact), - int sig AND CONST struct sigaction *act AND struct sigaction *oact) +__sigaction (sig, act, oact) + int sig; + const struct sigaction *act; + struct sigaction *oact; { struct sigaction myact; __sighandler_t ohandler; if (sig <= 0 || sig >= NSIG) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } diff --git a/sysdeps/unix/sysv/sysv4/sysconf.c b/sysdeps/unix/sysv/sysv4/sysconf.c index 81d660fe64..cd0e84480f 100644 --- a/sysdeps/unix/sysv/sysv4/sysconf.c +++ b/sysdeps/unix/sysv/sysv4/sysconf.c @@ -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 <errno.h> #include <limits.h> #include <unistd.h> @@ -24,16 +23,17 @@ Cambridge, MA 02139, USA. */ #include <time.h> #include <sysconfig.h> -extern int EXFUN(__sysconfig, (int)); +extern int __sysconfig __P ((int)); /* Get the value of the system variable NAME. */ long int -DEFUN(__sysconf, (name), int name) +__sysconf (name) + int name; { switch (name) { default: - errno = EINVAL; + __set_errno (EINVAL); return -1; case _SC_ARG_MAX: diff --git a/sysdeps/unix/sysv/sysv4/waitpid.c b/sysdeps/unix/sysv/sysv4/waitpid.c index f54df4bf6b..586a374ce9 100644 --- a/sysdeps/unix/sysv/sysv4/waitpid.c +++ b/sysdeps/unix/sysv/sysv4/waitpid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc. Contributed by Brendan Kehoe (brendan@zen.org). 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 <errno.h> #include <sys/wait.h> #include <sys/types.h> @@ -53,8 +52,7 @@ extern int __waitid __P ((__idtype_t idtype, __pid_t id, return status for stopped children; otherwise don't. */ __pid_t -DEFUN(__waitpid, (pid, stat_loc, options), - __pid_t pid AND int *stat_loc AND int options) +__libc_waitpid (__pid_t pid, int *stat_loc, int options) { __idtype_t idtype; __pid_t tmp_pid = pid; @@ -117,4 +115,5 @@ DEFUN(__waitpid, (pid, stat_loc, options), return infop.__pid; } -weak_alias (__waitpid, waitpid) +weak_alias (__libc_waitpid, __waitpid) +weak_alias (__libc_waitpid, waitpid) diff --git a/sysdeps/unix/sysv/tcdrain.c b/sysdeps/unix/sysv/tcdrain.c index 37144799e4..92bd7aa3c7 100644 --- a/sysdeps/unix/sysv/tcdrain.c +++ b/sysdeps/unix/sysv/tcdrain.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992 Free Software Foundation, Inc. +/* 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 @@ -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 <errno.h> #include <stddef.h> #include <termios.h> @@ -26,8 +25,9 @@ Cambridge, MA 02139, USA. */ /* Wait for pending output to be written on FD. */ int -DEFUN(tcdrain, (fd), int fd) +__libc_tcdrain (int fd) { /* With an argument of 1, TCSBRK just waits for output to drain. */ return __ioctl (fd, _TCSBRK, 1); } +weak_alias (__libc_tcdrain, tcdrain) diff --git a/sysdeps/unix/sysv/tcflow.c b/sysdeps/unix/sysv/tcflow.c index fecb40dd82..ac9e79731d 100644 --- a/sysdeps/unix/sysv/tcflow.c +++ b/sysdeps/unix/sysv/tcflow.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992 Free Software Foundation, Inc. +/* 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 @@ -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 <errno.h> #include <stddef.h> #include <termios.h> @@ -27,7 +26,9 @@ Cambridge, MA 02139, USA. */ /* Suspend or restart transmission on FD. */ int -DEFUN(tcflow, (fd, action), int fd AND int action) +tcflow (fd, action) + int fd; + int action; { switch (action) { @@ -40,7 +41,7 @@ DEFUN(tcflow, (fd, action), int fd AND int action) case TCION: return __ioctl (fd, _TCXONC, 3); default: - errno = EINVAL; + __set_errno (EINVAL); return -1; } } diff --git a/sysdeps/unix/sysv/tcflush.c b/sysdeps/unix/sysv/tcflush.c index 88574a5c4b..47250425ef 100644 --- a/sysdeps/unix/sysv/tcflush.c +++ b/sysdeps/unix/sysv/tcflush.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992 Free Software Foundation, Inc. +/* 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 @@ -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 <errno.h> #include <stddef.h> #include <termios.h> @@ -27,7 +26,9 @@ Cambridge, MA 02139, USA. */ /* Flush pending data on FD. */ int -DEFUN(tcflush, (fd, queue_selector), int fd AND int queue_selector) +tcflush (fd, queue_selector) + int fd; + int queue_selector; { switch (queue_selector) { @@ -38,7 +39,7 @@ DEFUN(tcflush, (fd, queue_selector), int fd AND int queue_selector) case TCIOFLUSH: return __ioctl (fd, _TCFLSH, 2); default: - errno = EINVAL; + __set_errno (EINVAL); return -1; } } diff --git a/sysdeps/unix/sysv/tcgetattr.c b/sysdeps/unix/sysv/tcgetattr.c index dd914a2955..cd98e0cd67 100644 --- a/sysdeps/unix/sysv/tcgetattr.c +++ b/sysdeps/unix/sysv/tcgetattr.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 @@ -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 <errno.h> #include <stddef.h> #include <sysv_termio.h> @@ -25,15 +24,16 @@ Cambridge, MA 02139, USA. */ /* Put the state of FD into *TERMIOS_P. */ int -DEFUN(__tcgetattr, (fd, termios_p), - int fd AND struct termios *termios_p) +__tcgetattr (fd, termios_p) + int fd; + struct termios *termios_p; { struct __sysv_termio buf; int termio_speed; if (termios_p == NULL) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } diff --git a/sysdeps/unix/sysv/tcsendbrk.c b/sysdeps/unix/sysv/tcsendbrk.c index 78fe2c542a..614b52a57c 100644 --- a/sysdeps/unix/sysv/tcsendbrk.c +++ b/sysdeps/unix/sysv/tcsendbrk.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992 Free Software Foundation, Inc. +/* 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 @@ -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 <errno.h> #include <stddef.h> #include <signal.h> @@ -27,7 +26,9 @@ Cambridge, MA 02139, USA. */ /* Send zero bits on FD. */ int -DEFUN(tcsendbreak, (fd, duration), int fd AND int duration) +tcsendbreak (fd, duration) + int fd; + int duration; { /* The break lasts 0.25 to 0.5 seconds if DURATION is zero, and an implementation-defined period if DURATION is nonzero. @@ -38,6 +39,6 @@ DEFUN(tcsendbreak, (fd, duration), int fd AND int duration) /* ioctl can't send a break of any other duration for us. This could be changed to use trickery (e.g. lower speed and send a '\0') to send the break, but for now just return an error. */ - errno = EINVAL; + __set_errno (EINVAL); return -1; } diff --git a/sysdeps/unix/sysv/tcsetattr.c b/sysdeps/unix/sysv/tcsetattr.c index 230a258e42..76d0192e5b 100644 --- a/sysdeps/unix/sysv/tcsetattr.c +++ b/sysdeps/unix/sysv/tcsetattr.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 @@ -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 <errno.h> #include <stddef.h> #include <termios.h> @@ -25,7 +24,7 @@ Cambridge, MA 02139, USA. */ #include <sysv_termio.h> -CONST speed_t __unix_speeds[] = +const speed_t __unix_speeds[] = { 0, 50, @@ -48,8 +47,10 @@ CONST speed_t __unix_speeds[] = /* Set the state of FD to *TERMIOS_P. */ int -DEFUN(tcsetattr, (fd, optional_actions, termios_p), - int fd AND int optional_actions AND CONST struct termios *termios_p) +tcsetattr (fd, optional_actions, termios_p) + int fd; + int optional_actions; + const struct termios *termios_p; { struct __sysv_termio buf; int ioctl_function; @@ -57,7 +58,7 @@ DEFUN(tcsetattr, (fd, optional_actions, termios_p), if (termios_p == NULL) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } switch (optional_actions) @@ -72,13 +73,13 @@ DEFUN(tcsetattr, (fd, optional_actions, termios_p), ioctl_function = _TCSETAF; break; default: - errno = EINVAL; + __set_errno (EINVAL); return -1; } if (termios_p->__ispeed != termios_p->__ospeed) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } buf.c_cflag = -1; @@ -89,7 +90,7 @@ DEFUN(tcsetattr, (fd, optional_actions, termios_p), } if (buf.c_cflag == -1) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } |