diff options
Diffstat (limited to 'sysdeps/unix')
86 files changed, 449 insertions, 382 deletions
diff --git a/sysdeps/unix/bsd/bsd4.4/errnos.h b/sysdeps/unix/bsd/bsd4.4/errnos.h index dcfdd9c47f..c2a9c08413 100644 --- a/sysdeps/unix/bsd/bsd4.4/errnos.h +++ b/sysdeps/unix/bsd/bsd4.4/errnos.h @@ -165,4 +165,6 @@ #endif /* __USE_BSD */ +#define __set_errno(val) errno = (val) + #endif /* <errno.h> included. */ diff --git a/sysdeps/unix/bsd/bsd4.4/tcdrain.c b/sysdeps/unix/bsd/bsd4.4/tcdrain.c index ac7c9cd2a1..feaa652aa7 100644 --- a/sysdeps/unix/bsd/bsd4.4/tcdrain.c +++ b/sysdeps/unix/bsd/bsd4.4/tcdrain.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1994 Free Software Foundation, Inc. +/* Copyright (C) 1992, 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,13 +16,13 @@ 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 <stddef.h> #include <sys/ioctl.h> /* Wait for pending output to be written on FD. */ int -DEFUN(tcdrain, (fd), int fd) +__libc_tcdrain (int fd) { return __ioctl (fd, TIOCDRAIN); } +weak_alias (__libc_tcdrain, tcdrain) diff --git a/sysdeps/unix/bsd/bsd4.4/wait.c b/sysdeps/unix/bsd/bsd4.4/wait.c index a29a99f9b9..29225f8638 100644 --- a/sysdeps/unix/bsd/bsd4.4/wait.c +++ b/sysdeps/unix/bsd/bsd4.4/wait.c @@ -1,4 +1,4 @@ -/* 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 @@ -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 <sys/wait.h> #include <errno.h> #include <sys/resource.h> @@ -25,9 +24,10 @@ Cambridge, MA 02139, USA. */ /* Wait for a child to die. When one does, put its status in *STAT_LOC and return its process ID. For errors, return (pid_t) -1. */ __pid_t -DEFUN(__wait, (stat_loc), __WAIT_STATUS_DEFN stat_loc) +__libc_wait (__WAIT_STATUS_DEFN stat_loc) { return __wait4 (WAIT_ANY, stat_loc, 0, (struct rusage *) NULL); } -weak_alias (__wait, wait) +weak_alias (__libc_wait, __wait) +weak_alias (__libc_wait, wait) diff --git a/sysdeps/unix/bsd/bsd4.4/waitpid.c b/sysdeps/unix/bsd/bsd4.4/waitpid.c index b5a34c32d0..2a21e3cef8 100644 --- a/sysdeps/unix/bsd/bsd4.4/waitpid.c +++ b/sysdeps/unix/bsd/bsd4.4/waitpid.c @@ -1,4 +1,4 @@ -/* 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 @@ -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> @@ -35,10 +34,10 @@ Cambridge, MA 02139, USA. */ Return (pid_t) -1 for errors. If the WUNTRACED bit is set in OPTIONS, 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) { return __wait4 (pid, (union wait *) stat_loc, options, NULL); } -weak_alias (__waitpid, waitpid) +weak_alias (__libc_waitpid, __waitpid) +weak_alias (__libc_waitpid, waitpid) diff --git a/sysdeps/unix/bsd/isatty.c b/sysdeps/unix/bsd/isatty.c index c3e80eb1c3..f6e34e865b 100644 --- a/sysdeps/unix/bsd/isatty.c +++ b/sysdeps/unix/bsd/isatty.c @@ -1,4 +1,4 @@ -/* 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 @@ -16,14 +16,14 @@ 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 <unistd.h> #include <sys/ioctl.h> /* Return 1 if FD is a terminal, 0 if not. */ int -DEFUN(__isatty, (fd), int fd) +__isatty (fd) + int fd; { int save; int is_tty; @@ -31,7 +31,7 @@ DEFUN(__isatty, (fd), int fd) save = errno; is_tty = __ioctl (fd, TIOCGETP, &term) == 0; - errno = save; + __set_errno (save); return is_tty; } diff --git a/sysdeps/unix/bsd/setegid.c b/sysdeps/unix/bsd/setegid.c index c4a3780f6d..420751bfc1 100644 --- a/sysdeps/unix/bsd/setegid.c +++ b/sysdeps/unix/bsd/setegid.c @@ -26,7 +26,7 @@ setegid (gid) { if (gid == (gid_t) ~0) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } diff --git a/sysdeps/unix/bsd/seteuid.c b/sysdeps/unix/bsd/seteuid.c index f6aa37f153..06fd1a3f29 100644 --- a/sysdeps/unix/bsd/seteuid.c +++ b/sysdeps/unix/bsd/seteuid.c @@ -26,7 +26,7 @@ seteuid (uid) { if (uid == (uid_t) ~0) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } diff --git a/sysdeps/unix/bsd/setsid.c b/sysdeps/unix/bsd/setsid.c index e057694589..1da7865ac6 100644 --- a/sysdeps/unix/bsd/setsid.c +++ b/sysdeps/unix/bsd/setsid.c @@ -1,4 +1,4 @@ -/* 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 @@ -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 <unistd.h> #include <sys/ioctl.h> @@ -27,7 +26,7 @@ Cambridge, MA 02139, USA. */ The process group IDs of the session and the calling process are set to the process ID of the calling process, which is returned. */ int -DEFUN_VOID(__setsid) +__setsid () { pid_t pid = getpid (); int tty; @@ -36,7 +35,7 @@ DEFUN_VOID(__setsid) if (__getpgid (pid) == pid) { /* Already the leader. */ - errno = EPERM; + __set_errno (EPERM); return -1; } @@ -46,13 +45,13 @@ DEFUN_VOID(__setsid) tty = open ("/dev/tty", 0); if (tty < 0) { - errno = save; + __set_errno (save); return 0; } (void) __ioctl (tty, TIOCNOTTY, 0); (void) __close (tty); - errno = save; + __set_errno (save); return 0; } diff --git a/sysdeps/unix/bsd/sigaction.c b/sysdeps/unix/bsd/sigaction.c index aa1c53f6cd..f20968d68e 100644 --- a/sysdeps/unix/bsd/sigaction.c +++ b/sysdeps/unix/bsd/sigaction.c @@ -1,4 +1,4 @@ -/* 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 @@ -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,14 +25,16 @@ 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; { struct sigvec vec, ovec; if (sig <= 0 || sig >= NSIG) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } @@ -50,7 +51,7 @@ DEFUN(__sigaction, (sig, act, oact), if (oact != NULL) { - oact->sa_handler = (void EXFUN((*), (int))) ovec.sv_handler; + oact->sa_handler = (void (*) __P ((int))) ovec.sv_handler; oact->sa_mask = ovec.sv_mask; oact->sa_flags = (((ovec.sv_flags & SV_ONSTACK) ? SA_ONSTACK : 0) | (!(ovec.sv_flags & SV_INTERRUPT) ? SA_RESTART : 0)); diff --git a/sysdeps/unix/bsd/sigprocmask.c b/sysdeps/unix/bsd/sigprocmask.c index 31ebb743a8..3421eb4f31 100644 --- a/sysdeps/unix/bsd/sigprocmask.c +++ b/sysdeps/unix/bsd/sigprocmask.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 @@ -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> @@ -26,8 +25,10 @@ Cambridge, MA 02139, USA. */ according to HOW, which may be SIG_BLOCK, SIG_UNBLOCK or SIG_SETMASK. If OSET is not NULL, store the old set of blocked signals in *OSET. */ int -DEFUN(__sigprocmask, (how, set, oset), - int how AND CONST sigset_t *set AND sigset_t *oset) +__sigprocmask (how, set, oset) + int how; + const sigset_t *set; + sigset_t *oset; { int mask; @@ -37,7 +38,7 @@ DEFUN(__sigprocmask, (how, set, oset), switch (how) { case SIG_BLOCK: - mask = __sigblock(mask); + mask = __sigblock (mask); break; case SIG_UNBLOCK: @@ -45,16 +46,16 @@ DEFUN(__sigprocmask, (how, set, oset), /* Fall through. */ case SIG_SETMASK: - mask = __sigsetmask(mask); + mask = __sigsetmask (mask); break; default: - errno = EINVAL; + __set_errno (EINVAL); return -1; } } else - mask = __sigblock(0); + mask = __sigblock (0); if (oset != NULL) *oset = mask; diff --git a/sysdeps/unix/bsd/sigsuspend.c b/sysdeps/unix/bsd/sigsuspend.c index fff56a950f..4c045aa663 100644 --- a/sysdeps/unix/bsd/sigsuspend.c +++ b/sysdeps/unix/bsd/sigsuspend.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 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> @@ -26,21 +25,22 @@ Cambridge, MA 02139, USA. */ /* 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; { int mask; int sig; if (set == NULL) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } mask = 0; for (sig = 1; sig <= NSIG; ++sig) - if (__sigismember(set, sig)) - mask |= sigmask(sig); + if (__sigismember (set, sig)) + mask |= sigmask (sig); - return __sigpause(mask); + return __sigpause (mask); } diff --git a/sysdeps/unix/bsd/sun/m68k/sigtramp.c b/sysdeps/unix/bsd/sun/m68k/sigtramp.c index 32a2c2047e..db9ffb5135 100644 --- a/sysdeps/unix/bsd/sun/m68k/sigtramp.c +++ b/sysdeps/unix/bsd/sun/m68k/sigtramp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993 Free Software Foundation, Inc. +/* Copyright (C) 1993, 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,8 +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> - #ifndef __GNUC__ #error This file uses GNU C extensions; you must compile with GCC. #endif @@ -52,8 +50,8 @@ Cambridge, MA 02139, USA. */ #include <errno.h> /* Defined in __sigvec.S. */ -extern int EXFUN(__raw_sigvec, (int sig, CONST struct sigvec *vec, - struct sigvec *ovec)); +extern int __raw_sigvec (int sig, const struct sigvec *vec, + struct sigvec *ovec); /* User-specified signal handlers. */ #define mytramp 1 @@ -70,8 +68,11 @@ extern __sighandler_t _sigfunc[]; Saves and restores the general regs %g2-%g7, the %y register, and all the FPU regs (including %fsr), around calling the user's handler. */ static void -DEFUN(trampoline, (sig, code, context, addr), - int sig AND int code AND struct sigcontext *context AND PTR addr) +trampoline (sig, code, context, addr) + int sig; + int code; + struct sigcontext *context; + void *addr; { int save[4]; @@ -81,7 +82,7 @@ DEFUN(trampoline, (sig, code, context, addr), /* XXX should save/restore FP regs */ /* Call the user's handler. */ - (*((void EXFUN((*), (int sig, int code, struct sigcontext *context, + (*((void (*) __P ((int sig, int code, struct sigcontext *context, PTR addr))) handlers[sig])) (sig, code, context, addr); @@ -95,8 +96,10 @@ DEFUN(trampoline, (sig, code, context, addr), #endif int -DEFUN(__sigvec, (sig, vec, ovec), - int sig AND CONST struct sigvec *vec AND struct sigvec *ovec) +__sigvec (sig, vec, ovec) + int sig; + const struct sigvec *vec; + struct sigvec *ovec; { #ifndef mytramp extern void _sigtramp (int); @@ -108,7 +111,7 @@ DEFUN(__sigvec, (sig, vec, ovec), if (sig <= 0 || sig >= NSIG) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } diff --git a/sysdeps/unix/bsd/sun/sparc/sigtramp.c b/sysdeps/unix/bsd/sun/sparc/sigtramp.c index 54f62933a8..11ce1945ff 100644 --- a/sysdeps/unix/bsd/sun/sparc/sigtramp.c +++ b/sysdeps/unix/bsd/sun/sparc/sigtramp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1994 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 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,8 +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> - #ifndef __GNUC__ #error This file uses GNU C extensions; you must compile with GCC. #endif @@ -52,8 +50,8 @@ Cambridge, MA 02139, USA. */ #include <errno.h> /* Defined in __sigvec.S. */ -extern int EXFUN(__raw_sigvec, (int sig, CONST struct sigvec *vec, - struct sigvec *ovec)); +extern int __raw_sigvec __P ((int sig, CONST struct sigvec *vec, + struct sigvec *ovec)); /* User-specified signal handlers. */ #define mytramp 1 @@ -70,7 +68,8 @@ extern __sighandler_t _sigfunc[]; Saves and restores the general regs %g2-%g7, the %y register, and all the FPU regs (including %fsr), around calling the user's handler. */ static void -DEFUN(trampoline, (sig), int sig) +trampoline (sig) + int sig; { /* We use `double' and `long long int' so `std' (store doubleword) insns, which might be faster than single-word stores, will be generated. */ @@ -97,7 +96,7 @@ DEFUN(trampoline, (sig), int sig) int code; register struct sigcontext *context asm("%i0"); /* See end of fn. */ - PTR addr; + void *addr; int y; double fpsave[16]; int fsr; @@ -147,8 +146,8 @@ DEFUN(trampoline, (sig), int sig) glsave[2] = g6; /* Call the user's handler. */ - (*((void EXFUN((*), (int sig, int code, struct sigcontext *context, - PTR addr))) handlers[sig])) + (*((void (*) __P ((int sig, int code, struct sigcontext *context, + void *addr))) handlers[sig])) (sig, code, context, addr); /* Restore the Y register. */ @@ -199,8 +198,10 @@ DEFUN(trampoline, (sig), int sig) #endif int -DEFUN(__sigvec, (sig, vec, ovec), - int sig AND CONST struct sigvec *vec AND struct sigvec *ovec) +__sigvec (sig, vec, ovec) + int sig; + const struct sigvec *vec; + struct sigvec *ovec; { #ifndef mytramp extern void _sigtramp (int); @@ -212,11 +213,11 @@ DEFUN(__sigvec, (sig, vec, ovec), if (sig <= 0 || sig >= NSIG) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } - mask = __sigblock(sigmask(sig)); + mask = __sigblock (sigmask(sig)); ohandler = handlers[sig]; @@ -240,7 +241,7 @@ DEFUN(__sigvec, (sig, vec, ovec), if (ovec != NULL && ovec->sv_handler == trampoline) ovec->sv_handler = ohandler; - (void) __sigsetmask(mask); + (void) __sigsetmask (mask); return 0; } diff --git a/sysdeps/unix/bsd/sun/sunos4/speed.c b/sysdeps/unix/bsd/sun/sunos4/speed.c index 1c09d55dab..de6870a51d 100644 --- a/sysdeps/unix/bsd/sun/sunos4/speed.c +++ b/sysdeps/unix/bsd/sun/sunos4/speed.c @@ -1,5 +1,5 @@ /* `struct termios' speed frobnication functions. SunOS 4 version. -Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. +Copyright (C) 1991, 1992, 1993, 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 @@ -17,12 +17,11 @@ 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 <stddef.h> #include <errno.h> #include <termios.h> -static CONST speed_t speeds[] = +static const speed_t speeds[] = { 0, 50, @@ -45,28 +44,31 @@ static CONST speed_t speeds[] = /* Return the output baud rate stored in *TERMIOS_P. */ speed_t -DEFUN(cfgetospeed, (termios_p), CONST struct termios *termios_p) +cfgetospeed (termios_p) + const struct termios *termios_p; { return termios_p->c_cflag & CBAUD; } /* Return the input baud rate stored in *TERMIOS_P. */ speed_t -DEFUN(cfgetispeed, (termios_p), CONST struct termios *termios_p) +cfgetispeed (termios_p) + const struct termios *termios_p; { return (termios_p->c_cflag & CIBAUD) >> IBSHIFT; } /* Set the output baud rate stored in *TERMIOS_P to SPEED. */ int -DEFUN(cfsetospeed, (termios_p, speed), - struct termios *termios_p AND speed_t speed) +cfsetospeed (termios_p, speed) + struct termios *termios_p; + speed_t speed; { register unsigned int i; if (termios_p == NULL) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } @@ -82,20 +84,21 @@ DEFUN(cfsetospeed, (termios_p, speed), return 0; } - errno = EINVAL; + __set_errno (EINVAL); return -1; } /* Set the input baud rate stored in *TERMIOS_P to SPEED. */ int -DEFUN(cfsetispeed, (termios_p, speed), - struct termios *termios_p AND speed_t speed) +cfsetispeed (termios_p, speed) + struct termios *termios_p; + speed_t speed; { register unsigned int i; if (termios_p == NULL) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } @@ -108,6 +111,6 @@ DEFUN(cfsetispeed, (termios_p, speed), return 0; } - errno = EINVAL; + __set_errno (EINVAL); return -1; } diff --git a/sysdeps/unix/bsd/sun/sunos4/tcsetattr.c b/sysdeps/unix/bsd/sun/sunos4/tcsetattr.c index f88951ff9d..f825d41ab8 100644 --- a/sysdeps/unix/bsd/sun/sunos4/tcsetattr.c +++ b/sysdeps/unix/bsd/sun/sunos4/tcsetattr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993 Free Software Foundation, Inc. +/* Copyright (C) 1993, 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> @@ -24,8 +23,10 @@ Cambridge, MA 02139, USA. */ /* 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; { unsigned long cmd; @@ -41,7 +42,7 @@ DEFUN(tcsetattr, (fd, optional_actions, termios_p), cmd = TCSETSF; break; default: - errno = EINVAL; + __set_errno (EINVAL); return -1; } diff --git a/sysdeps/unix/bsd/tcdrain.c b/sysdeps/unix/bsd/tcdrain.c index c9ed18d4f8..84bc06813d 100644 --- a/sysdeps/unix/bsd/tcdrain.c +++ b/sysdeps/unix/bsd/tcdrain.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 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,13 +25,14 @@ Cambridge, MA 02139, USA. */ /* Wait for pending output to be written on FD. */ int -DEFUN(tcdrain, (fd), int fd) +__libc_tcdrain (int fd) { /* The TIOCSETP control waits for pending output to be written before affecting its changes, so we use that without changing anything. */ struct sgttyb b; - if (__ioctl(fd, TIOCGETP, (PTR) &b) < 0 || - __ioctl(fd, TIOCSETP, (PTR) &b) < 0) + if (__ioctl (fd, TIOCGETP, (void *) &b) < 0 || + __ioctl (fd, TIOCSETP, (void *) &b) < 0) return -1; return 0; } +weak_alias (__libc_tcdrain, tcdrain) diff --git a/sysdeps/unix/bsd/tcflow.c b/sysdeps/unix/bsd/tcflow.c index 06de144a45..1919d6d9ea 100644 --- a/sysdeps/unix/bsd/tcflow.c +++ b/sysdeps/unix/bsd/tcflow.c @@ -1,4 +1,4 @@ -/* 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 @@ -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,14 +25,16 @@ 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) { case TCOOFF: - return __ioctl(fd, TIOCSTOP, (PTR) NULL); + return __ioctl (fd, TIOCSTOP, (PTR) NULL); case TCOON: - return __ioctl(fd, TIOCSTART, (PTR) NULL); + return __ioctl (fd, TIOCSTART, (PTR) NULL); case TCIOFF: case TCION: @@ -42,7 +43,7 @@ DEFUN(tcflow, (fd, action), int fd AND int action) `write'. Is there another way to do this? */ struct termios attr; unsigned char c; - if (tcgetattr(fd, &attr) < 0) + if (tcgetattr (fd, &attr) < 0) return -1; c = attr.c_cc[action == TCIOFF ? VSTOP : VSTART]; if (c != _POSIX_VDISABLE && write (fd, &c, 1) < 1) @@ -51,7 +52,7 @@ DEFUN(tcflow, (fd, action), int fd AND int action) } default: - errno = EINVAL; + __set_errno (EINVAL); return -1; } } diff --git a/sysdeps/unix/bsd/tcflush.c b/sysdeps/unix/bsd/tcflush.c index 46454b8229..14f7db8dad 100644 --- a/sysdeps/unix/bsd/tcflush.c +++ b/sysdeps/unix/bsd/tcflush.c @@ -1,4 +1,4 @@ -/* 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 @@ -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,7 +25,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; { int arg; @@ -42,7 +43,7 @@ DEFUN(tcflush, (fd, queue_selector), int fd AND int queue_selector) arg = FREAD | FWRITE; break; default: - errno = EINVAL; + __set_errno (EINVAL); return -1; } diff --git a/sysdeps/unix/bsd/tcgetattr.c b/sysdeps/unix/bsd/tcgetattr.c index 0e6e3785dd..5d17bd5dde 100644 --- a/sysdeps/unix/bsd/tcgetattr.c +++ b/sysdeps/unix/bsd/tcgetattr.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 @@ -16,19 +16,19 @@ 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> #include "bsdtty.h" -extern CONST speed_t __bsd_speeds[]; /* Defined in tcsetattr.c. */ +extern const speed_t __bsd_speeds[]; /* Defined in tcsetattr.c. */ /* 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 sgttyb buf; struct tchars tchars; @@ -40,7 +40,7 @@ DEFUN(__tcgetattr, (fd, termios_p), if (termios_p == NULL) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } diff --git a/sysdeps/unix/bsd/tcsetattr.c b/sysdeps/unix/bsd/tcsetattr.c index e731d830f6..770bc98b79 100644 --- a/sysdeps/unix/bsd/tcsetattr.c +++ b/sysdeps/unix/bsd/tcsetattr.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1993 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1993, 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> @@ -24,7 +23,7 @@ Cambridge, MA 02139, USA. */ #include "bsdtty.h" -CONST speed_t __bsd_speeds[] = +const speed_t __bsd_speeds[] = { 0, 50, @@ -47,8 +46,10 @@ CONST speed_t __bsd_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 sgttyb buf; struct tchars tchars; @@ -59,18 +60,18 @@ DEFUN(tcsetattr, (fd, optional_actions, termios_p), #endif size_t i; - if (__ioctl(fd, TIOCGETP, &buf) < 0 || - __ioctl(fd, TIOCGETC, &tchars) < 0 || - __ioctl(fd, TIOCGLTC, <chars) < 0 || + if (__ioctl (fd, TIOCGETP, &buf) < 0 || + __ioctl (fd, TIOCGETC, &tchars) < 0 || + __ioctl (fd, TIOCGLTC, <chars) < 0 || #ifdef TIOCGETX - __ioctl(fd, TIOCGETX, &extra) < 0 || + __ioctl (fd, TIOCGETX, &extra) < 0 || #endif - __ioctl(fd, TIOCLGET, &local) < 0) + __ioctl (fd, TIOCLGET, &local) < 0) return -1; if (termios_p == NULL) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } switch (optional_actions) @@ -78,15 +79,15 @@ DEFUN(tcsetattr, (fd, optional_actions, termios_p), case TCSANOW: break; case TCSADRAIN: - if (tcdrain(fd) < 0) + if (tcdrain (fd) < 0) return -1; break; case TCSAFLUSH: - if (tcflush(fd, TCIFLUSH) < 0) + if (tcflush (fd, TCIFLUSH) < 0) return -1; break; default: - errno = EINVAL; + __set_errno (EINVAL); return -1; } @@ -100,7 +101,7 @@ DEFUN(tcsetattr, (fd, optional_actions, termios_p), } if (buf.sg_ispeed == -1 || buf.sg_ospeed == -1) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } @@ -174,13 +175,13 @@ DEFUN(tcsetattr, (fd, optional_actions, termios_p), tchars.t_startc = termios_p->c_cc[VSTART]; tchars.t_stopc = termios_p->c_cc[VSTOP]; - if (__ioctl(fd, TIOCSETP, &buf) < 0 || - __ioctl(fd, TIOCSETC, &tchars) < 0 || - __ioctl(fd, TIOCSLTC, <chars) < 0 || + if (__ioctl (fd, TIOCSETP, &buf) < 0 || + __ioctl (fd, TIOCSETC, &tchars) < 0 || + __ioctl (fd, TIOCSLTC, <chars) < 0 || #ifdef TIOCGETX - __ioctl(fd, TIOCSETX, &extra) < 0 || + __ioctl (fd, TIOCSETX, &extra) < 0 || #endif - __ioctl(fd, TIOCLSET, &local) < 0) + __ioctl (fd, TIOCLSET, &local) < 0) return -1; return 0; } diff --git a/sysdeps/unix/bsd/times.c b/sysdeps/unix/bsd/times.c index edf3e90972..8277ce5a76 100644 --- a/sysdeps/unix/bsd/times.c +++ b/sysdeps/unix/bsd/times.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1993, 1995 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 93, 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 <errno.h> #include <stddef.h> #include <sys/times.h> @@ -31,7 +30,8 @@ extern time_t _posix_start_time; __inline #endif static clock_t -DEFUN(timeval_to_clock_t, (tv), CONST struct timeval *tv) +timeval_to_clock_t (tv) + const struct timeval *tv; { return (clock_t) ((tv->tv_sec * CLK_TCK) + (tv->tv_usec * CLK_TCK / 1000000L)); @@ -42,27 +42,28 @@ DEFUN(timeval_to_clock_t, (tv), CONST struct timeval *tv) Return the elapsed real time, or (clock_t) -1 for errors. All times are in CLK_TCKths of a second. */ clock_t -DEFUN(__times, (buffer), struct tms *buffer) +__times (buffer) + struct tms *buffer; { struct rusage usage; if (buffer == NULL) { - errno = EINVAL; + __set_errno (EINVAL); return (clock_t) -1; } - if (__getrusage(RUSAGE_SELF, &usage) < 0) + if (__getrusage (RUSAGE_SELF, &usage) < 0) return (clock_t) -1; - buffer->tms_utime = (clock_t) timeval_to_clock_t(&usage.ru_utime); - buffer->tms_stime = (clock_t) timeval_to_clock_t(&usage.ru_stime); + buffer->tms_utime = (clock_t) timeval_to_clock_t (&usage.ru_utime); + buffer->tms_stime = (clock_t) timeval_to_clock_t (&usage.ru_stime); - if (__getrusage(RUSAGE_CHILDREN, &usage) < 0) + if (__getrusage (RUSAGE_CHILDREN, &usage) < 0) return (clock_t) -1; - buffer->tms_cutime = (clock_t) timeval_to_clock_t(&usage.ru_utime); - buffer->tms_cstime = (clock_t) timeval_to_clock_t(&usage.ru_stime); + buffer->tms_cutime = (clock_t) timeval_to_clock_t (&usage.ru_utime); + buffer->tms_cstime = (clock_t) timeval_to_clock_t (&usage.ru_stime); - return (time((time_t *) NULL) - _posix_start_time) * CLK_TCK; + return (time ((time_t *) NULL) - _posix_start_time) * CLK_TCK; } weak_alias (__times, times) diff --git a/sysdeps/unix/bsd/ulimit.c b/sysdeps/unix/bsd/ulimit.c index 912faf42e2..f90692a11c 100644 --- a/sysdeps/unix/bsd/ulimit.c +++ b/sysdeps/unix/bsd/ulimit.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1992, 1994 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1992, 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 <sysdep.h> #include <sys/resource.h> #include <unistd.h> @@ -37,8 +36,9 @@ extern int _etext; can open. Returns -1 on errors. */ long int -DEFUN(ulimit, (cmd, newlimit), - int cmd AND long int newlimit) +ulimit (cmd, newlimit) + int cmd; + long int newlimit; { int status; @@ -49,7 +49,7 @@ DEFUN(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; @@ -62,25 +62,25 @@ DEFUN(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 3: /* Get maximum address for `brk'. */ { struct rlimit dsize; - status = getrlimit(RLIMIT_DATA, &dsize); + status = getrlimit (RLIMIT_DATA, &dsize); if (status < 0) return -1; return ((long int) &_etext) + dsize.rlim_cur; } 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/bsd/ultrix4/mips/start.S b/sysdeps/unix/bsd/ultrix4/mips/start.S index 24bcbb4e00..aec5885252 100644 --- a/sysdeps/unix/bsd/ultrix4/mips/start.S +++ b/sysdeps/unix/bsd/ultrix4/mips/start.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 1995 Free Software Foundation, Inc. +/* Copyright (C) 1993, 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 @@ -18,6 +18,7 @@ Cambridge, MA 02139, USA. */ #include <sysdep.h> +__errno: .comm errno, 4 ENTRY(__start) diff --git a/sysdeps/unix/bsd/ultrix4/sysconf.c b/sysdeps/unix/bsd/ultrix4/sysconf.c index a9f3c5bbbe..a24c1c5ce8 100644 --- a/sysdeps/unix/bsd/ultrix4/sysconf.c +++ b/sysdeps/unix/bsd/ultrix4/sysconf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1995 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1995, 1996 Free Software Foundation, Inc. Contributed by Ian Lance Taylor (ian@airs.com). The GNU C Library is free software; you can redistribute it and/or @@ -20,20 +20,19 @@ Cambridge, MA 02139, USA. */ value for _SC_CHILD_MAX. Everything else is from <sys/param.h>, which the default sysconf already knows how to handle. */ -#include <ansidecl.h> #include <unistd.h> #include <errno.h> /* This is an Ultrix header file. */ #include <sys/sysinfo.h> -extern int EXFUN(__getsysinfo, (unsigned int op, void *buffer, - size_t nbytes, int *start, - void *arg)); -extern long int EXFUN(__default_sysconf, (int name)); +extern int __getsysinfo __P ((unsigned int op, void *buffer, + size_t nbytes, int *start, void *arg)); +extern long int __default_sysconf __P ((int name)); long int -DEFUN(__sysconf, (name), int name) +__sysconf (name) + int name; { if (name == _SC_CHILD_MAX) { @@ -46,11 +45,11 @@ DEFUN(__sysconf, (name), int name) if (__getsysinfo (GSI_MAX_UPROCS, &ret, sizeof (ret), &start, (void *) 0) > 0) { - errno = save; + __set_errno (save); return ret; } - errno = save; + __set_errno (save); } return __default_sysconf (name); diff --git a/sysdeps/unix/closedir.c b/sysdeps/unix/closedir.c index 5b938a8272..a46d47ac35 100644 --- a/sysdeps/unix/closedir.c +++ b/sysdeps/unix/closedir.c @@ -32,7 +32,7 @@ __closedir (DIR *dirp) if (dirp == NULL) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } diff --git a/sysdeps/unix/common/lxstat.c b/sysdeps/unix/common/lxstat.c index 499a0838ac..f33279979a 100644 --- a/sysdeps/unix/common/lxstat.c +++ b/sysdeps/unix/common/lxstat.c @@ -28,7 +28,7 @@ __lxstat (int vers, const char *file, struct stat *buf) { if (vers != _STAT_VER) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } diff --git a/sysdeps/unix/common/pause.c b/sysdeps/unix/common/pause.c index b2fafb958e..a073dd2b3a 100644 --- a/sysdeps/unix/common/pause.c +++ b/sysdeps/unix/common/pause.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 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 <signal.h> #include <unistd.h> @@ -25,7 +24,8 @@ Cambridge, MA 02139, USA. */ This always returns -1 and sets errno to EINTR. */ int -DEFUN_VOID(pause) +__libc_pause (void) { - return __sigpause(__sigblock(0)); + return __sigpause (__sigblock (0)); } +weak_alias (__libc_pause, pause) diff --git a/sysdeps/unix/common/tcsendbrk.c b/sysdeps/unix/common/tcsendbrk.c index 348321a492..7d768267c4 100644 --- a/sysdeps/unix/common/tcsendbrk.c +++ b/sysdeps/unix/common/tcsendbrk.c @@ -40,8 +40,7 @@ tcsendbreak (int fd, 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; #endif } - diff --git a/sysdeps/unix/fxstat.c b/sysdeps/unix/fxstat.c index 522d3fd052..29cab5177c 100644 --- a/sysdeps/unix/fxstat.c +++ b/sysdeps/unix/fxstat.c @@ -29,7 +29,7 @@ __fxstat (int vers, int fd, struct stat *buf) { if (vers != _STAT_VER) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } diff --git a/sysdeps/unix/getdents.c b/sysdeps/unix/getdents.c index 485faa13c2..6dec0dc5b5 100644 --- a/sysdeps/unix/getdents.c +++ b/sysdeps/unix/getdents.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 1995 Free Software Foundation, Inc. +/* Copyright (C) 1993, 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,15 +16,16 @@ 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 <stddef.h> -#include <errno.h> #include <sys/types.h> #include <unistd.h> int -DEFUN(__getdirentries, (fd, buf, nbytes, basep), - int fd AND char *buf AND size_t nbytes AND off_t *basep) +__getdirentries (fd, buf, nbytes, basep) + int fd; + char *buf; + size_t nbytes; + off_t *basep; { if (basep) *basep = __lseek (fd, (off_t) 0, SEEK_CUR); @@ -33,4 +34,3 @@ DEFUN(__getdirentries, (fd, buf, nbytes, basep), } weak_alias (__getdirentries, getdirentries) - diff --git a/sysdeps/unix/getlogin.c b/sysdeps/unix/getlogin.c index e23ffa46f5..ef985f2d2f 100644 --- a/sysdeps/unix/getlogin.c +++ b/sysdeps/unix/getlogin.c @@ -58,7 +58,7 @@ getlogin (void) { if (errno == ESRCH) /* The caller expects ENOENT if nothing is found. */ - errno = ENOENT; + __set_errno (ENOENT); result = NULL; } else diff --git a/sysdeps/unix/getlogin_r.c b/sysdeps/unix/getlogin_r.c index 154a9d3a59..f80b2c7518 100644 --- a/sysdeps/unix/getlogin_r.c +++ b/sysdeps/unix/getlogin_r.c @@ -53,7 +53,7 @@ getlogin_r (name, name_len) if (result < 0) { - errno = err; + __set_errno (err); return err; } } diff --git a/sysdeps/unix/mkdir.c b/sysdeps/unix/mkdir.c index 16713f9e48..ff87f9a74f 100644 --- a/sysdeps/unix/mkdir.c +++ b/sysdeps/unix/mkdir.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 <errno.h> #include <stddef.h> #include <sys/stat.h> @@ -27,7 +26,9 @@ Cambridge, MA 02139, USA. */ /* Create a directory named PATH with protections MODE. */ int -DEFUN(__mkdir, (path, mode), CONST char *path AND mode_t mode) +__mkdir (path, mode) + const char *path; + mode_t mode; { char *cmd = __alloca (80 + strlen (path)); char *p; @@ -38,7 +39,7 @@ DEFUN(__mkdir, (path, mode), CONST char *path AND mode_t mode) if (path == NULL) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } @@ -51,7 +52,7 @@ DEFUN(__mkdir, (path, mode), CONST char *path AND mode_t mode) } else { - errno = EEXIST; + __set_errno (EEXIST); return -1; } @@ -83,11 +84,11 @@ DEFUN(__mkdir, (path, mode), CONST char *path AND mode_t mode) /* If system doesn't set errno, but the mkdir fails, we really have no idea what went wrong. EIO is the vaguest error I can think of, so I'll use that. */ - errno = EIO; + __set_errno (EIO); status = system (cmd); if (WIFEXITED (status) && WEXITSTATUS (status) == 0) { - errno = save; + __set_errno (save); return 0; } else diff --git a/sysdeps/unix/mman/syscalls.list b/sysdeps/unix/mman/syscalls.list index 2211e8fa3c..a5f44e465b 100644 --- a/sysdeps/unix/mman/syscalls.list +++ b/sysdeps/unix/mman/syscalls.list @@ -3,5 +3,5 @@ madvise - madvise 3 madvise mmap - mmap 6 __mmap mmap mprotect - mprotect 3 __mprotect mprotect -msync - msync 2 msync +msync - msync 2 __libc_msync msync munmap - munmap 2 __munmap munmap diff --git a/sysdeps/unix/nice.c b/sysdeps/unix/nice.c index 01f1412adf..d5a44e5d64 100644 --- a/sysdeps/unix/nice.c +++ b/sysdeps/unix/nice.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 <unistd.h> #include <sys/resource.h> @@ -24,21 +23,22 @@ Cambridge, MA 02139, USA. */ /* Increment the scheduling priority of the calling process by INCR. The superuser may use a negative INCR to decrement the priority. */ int -DEFUN(nice, (incr), int incr) +nice (incr) + int incr; { int save; int prio; /* -1 is a valid priority, so we use errno to check for an error. */ save = errno; - errno = 0; + __set_errno (0); prio = getpriority (PRIO_PROCESS, 0); if (prio == -1) { if (errno != 0) return -1; else - errno = save; + __set_errno (save); } return setpriority (PRIO_PROCESS, 0, prio + incr); diff --git a/sysdeps/unix/nlist.c b/sysdeps/unix/nlist.c index 5389f65e89..b40aedbc82 100644 --- a/sysdeps/unix/nlist.c +++ b/sysdeps/unix/nlist.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991 Free Software Foundation, Inc. +/* Copyright (C) 1991, 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 @@ -15,7 +15,6 @@ You should have received a copy of the GNU General Public License along with the GNU C Library; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <ansidecl.h> #include <errno.h> #include <a.out.h> #include <stdio.h> @@ -27,8 +26,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ which is terminated by an element with a NULL `n_un.n_name' member, and fill in the elements of NL. */ int -DEFUN(nlist, (file, nl), - CONST char *file AND struct nlist *nl) +nlist (file, nl) + const char *file; + struct nlist *nl; { FILE *f; struct exec header; @@ -40,52 +40,53 @@ DEFUN(nlist, (file, nl), if (nl == NULL) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } - f = fopen(file, "r"); + f = fopen (file, "r"); if (f == NULL) return -1; - if (fread((PTR) &header, sizeof(header), 1, f) != 1) + if (fread ((void *) &header, sizeof (header), 1, f) != 1) goto lose; - if (fseek(f, N_SYMOFF(header), SEEK_SET) != 0) + if (fseek (f, N_SYMOFF (header), SEEK_SET) != 0) goto lose; - symbols = (struct nlist *) __alloca(header.a_syms); - nsymbols = header.a_syms / sizeof(symbols[0]); + symbols = (struct nlist *) __alloca (header.a_syms); + nsymbols = header.a_syms / sizeof (symbols[0]); - if (fread((PTR) symbols, sizeof(symbols[0]), nsymbols, f) != nsymbols) + if (fread ((void *) symbols, sizeof (symbols[0]), nsymbols, f) != nsymbols) goto lose; - if (fread((PTR) &string_table_size, sizeof(string_table_size), 1, f) != 1) + if (fread ((void *) &string_table_size, sizeof (string_table_size), 1, f) + != 1) goto lose; - string_table_size -= sizeof(string_table_size); + string_table_size -= sizeof (string_table_size); - string_table = (char *) __alloca(string_table_size); - if (fread((PTR) string_table, string_table_size, 1, f) != 1) + string_table = (char *) __alloca (string_table_size); + if (fread ((void *) string_table, string_table_size, 1, f) != 1) goto lose; for (i = 0; i < nsymbols; ++i) { register struct nlist *nlp; for (nlp = nl; nlp->n_un.n_name != NULL; ++nlp) - if (!strcmp(nlp->n_un.n_name, - &string_table[symbols[i].n_un.n_strx - - sizeof(string_table_size)])) + if (!strcmp (nlp->n_un.n_name, + &string_table[symbols[i].n_un.n_strx - + sizeof (string_table_size)])) { - char *CONST name = nlp->n_un.n_name; + char *const name = nlp->n_un.n_name; *nlp = symbols[i]; nlp->n_un.n_name = name; } } - (void) fclose(f); + (void) fclose (f); return 0; lose:; - (void) fclose(f); + (void) fclose (f); return -1; } diff --git a/sysdeps/unix/opendir.c b/sysdeps/unix/opendir.c index 7161cec6e9..c38c8d478a 100644 --- a/sysdeps/unix/opendir.c +++ b/sysdeps/unix/opendir.c @@ -41,7 +41,7 @@ __opendir (const char *name) { /* POSIX.1-1990 says an empty name gets ENOENT; but `open' might like it fine. */ - errno = ENOENT; + __set_errno (ENOENT); return NULL; } @@ -56,7 +56,7 @@ __opendir (const char *name) goto lose; if (! S_ISDIR (statbuf.st_mode)) { - errno = ENOTDIR; + __set_errno (ENOTDIR); goto lose; } @@ -66,7 +66,7 @@ __opendir (const char *name) { int save = errno; (void) __close (fd); - errno = save; + __set_errno (save); return NULL; } @@ -85,7 +85,7 @@ __opendir (const char *name) int save = errno; free (dirp); (void) __close (fd); - errno = save; + __set_errno (save); return NULL; } diff --git a/sysdeps/unix/readdir.c b/sysdeps/unix/readdir.c index 46f2caff87..491469bcd1 100644 --- a/sysdeps/unix/readdir.c +++ b/sysdeps/unix/readdir.c @@ -36,7 +36,7 @@ __readdir (DIR *dirp) if (dirp == NULL || dirp->data == NULL) { - errno = EINVAL; + __set_errno (EINVAL); return NULL; } diff --git a/sysdeps/unix/rmdir.c b/sysdeps/unix/rmdir.c index 52a130ce3e..7bb40211c1 100644 --- a/sysdeps/unix/rmdir.c +++ b/sysdeps/unix/rmdir.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 <sys/stat.h> @@ -27,7 +26,8 @@ Cambridge, MA 02139, USA. */ /* Create a directory named PATH with protections MODE. */ int -DEFUN(__rmdir, (path), CONST char *path) +__rmdir (path) + const char *path; { char *cmd = __alloca (80 + strlen (path)); char *p; @@ -37,7 +37,7 @@ DEFUN(__rmdir, (path), CONST char *path) if (path == NULL) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } @@ -46,7 +46,7 @@ DEFUN(__rmdir, (path), CONST char *path) return -1; if (!S_ISDIR (statbuf.st_mode)) { - errno = ENOTDIR; + __set_errno (ENOTDIR); return -1; } @@ -64,12 +64,12 @@ DEFUN(__rmdir, (path), CONST char *path) /* If system doesn't set errno, but the rmdir fails, we really have no idea what went wrong. EIO is the vaguest error I can think of, so I'll use that. */ - errno = EIO; + __set_errno (EIO); status = system (cmd); if (WIFEXITED (status) && WEXITSTATUS (status) == 0) { return 0; - errno = save; + __set_errno (save); } else return -1; diff --git a/sysdeps/unix/sparc/start.c b/sysdeps/unix/sparc/start.c index f8567d2103..6c18b5c09c 100644 --- a/sysdeps/unix/sparc/start.c +++ b/sysdeps/unix/sparc/start.c @@ -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 @@ -40,7 +40,9 @@ int __data_start = 0; weak_alias (__data_start, data_start) #endif -VOLATILE int errno; +VOLATILE int __errno; +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)); @@ -117,7 +119,7 @@ DEFUN_VOID(init_shlib) caddr_t sobssmap; void (*ldstart) (int, int); struct exec soexec; - struct + struct { caddr_t crt_ba; int crt_dzfd; @@ -126,7 +128,7 @@ DEFUN_VOID(init_shlib) char **crt_ep; caddr_t crt_bp; } soarg; - + /* If not dynamically linked, do nothing. */ if (&_DYNAMIC == 0) return; @@ -137,7 +139,7 @@ DEFUN_VOID(init_shlib) || soexec.a_magic != ZMAGIC) { static CONST char emsg[] = "crt0: no /usr/lib/ld.so\n"; - + syscall (SYS_write, 2, emsg, sizeof (emsg) - 1); syscall (SYS_exit, 127); } @@ -165,7 +167,7 @@ DEFUN_VOID(init_shlib) soarg.crt_dp = &_DYNAMIC; soarg.crt_ep = __environ; soarg.crt_bp = (caddr_t) &&retaddr; - + ldstart = (__typeof (ldstart)) (somap + soexec.a_entry); (*ldstart) (1, (char *) &soarg - (char *) sp); diff --git a/sysdeps/unix/start.c b/sysdeps/unix/start.c index e58bb3804d..8112d2142a 100644 --- a/sysdeps/unix/start.c +++ b/sysdeps/unix/start.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1993, 1995 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1993, 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 modify @@ -15,7 +15,6 @@ You should have received a copy of the GNU General Public License along with the GNU C Library; see the file COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <ansidecl.h> #include <errno.h> #include <stdlib.h> #include <unistd.h> @@ -36,11 +35,12 @@ weak_alias (__data_start, data_start) #endif #ifndef errno -volatile int errno; +volatile int __errno; +string_alias (__errno, errno) #endif -extern void EXFUN(__libc_init, (int argc, char **argv, char **envp)); -extern int EXFUN(main, (int argc, char **argv, char **envp)); +extern void __libc_init __P ((int argc, char **argv, char **envp)); +extern int main __P ((int argc, char **argv, char **envp)); /* Not a prototype because it gets called strangely. */ @@ -51,9 +51,9 @@ static void start1(); /* N.B.: It is important that this be the first function. This file is the first thing in the text section. */ void -DEFUN_VOID(_start) +_start () { - start1(); + start1 (); } #ifndef NO_UNDERSCORES diff --git a/sysdeps/unix/stime.c b/sysdeps/unix/stime.c index be928e8f39..869a28ad2e 100644 --- a/sysdeps/unix/stime.c +++ b/sysdeps/unix/stime.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,20 +16,20 @@ 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 system clock to *WHEN. */ int -DEFUN(stime, (when), CONST time_t *when) +stime (when) + const time_t *when; { struct timeval tv; if (when == NULL) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } diff --git a/sysdeps/unix/syscalls.list b/sysdeps/unix/syscalls.list index 0da9d17b07..fba1245730 100644 --- a/sysdeps/unix/syscalls.list +++ b/sysdeps/unix/syscalls.list @@ -6,12 +6,13 @@ chdir - chdir 1 __chdir chdir chmod - chmod 2 __chmod chmod chown - chown 3 __chown chown chroot - chroot 1 chroot -close - close 1 __close close +close - close 1 __libc_close __close close dup - dup 2 __dup dup dup2 - dup2 2 __dup2 dup2 fchdir - fchdir 1 fchdir -fcntl - fcntl 3 __fcntl fcntl -fsync - fsync 1 fsync +fcntl - fcntl 3 __libc_fcntl __fcntl fcntl +fstatfs - fstatfs 2 __fstatfs fstatfs +fsync - fsync 1 __libc_fsync fsync getdomain - getdomainname 2 getdomainname getgid - getgid 0 __getgid getgid getgroups - getgroups 2 __getgroups getgroups @@ -23,12 +24,12 @@ getuid - getuid 0 __getuid getuid ioctl - ioctl 3 __ioctl ioctl kill - kill 2 __kill kill link - link 2 __link link -lseek - lseek 3 __lseek lseek +lseek - lseek 3 __libc_lseek __lseek lseek mkdir - mkdir 2 __mkdir mkdir -open - open 3 __open open +open - open 3 __libc_open __open open profil - profil 4 profil ptrace - ptrace 4 ptrace -read - read 3 __read read +read - read 3 __libc_read __read read readlink - readlink 3 __readlink readlink readv - readv 3 readv reboot - reboot 1 reboot @@ -48,6 +49,7 @@ settimeofday - settimeofday 2 __settimeofday settimeofday setuid - setuid 1 __setuid setuid sigsuspend - sigsuspend 1 sigsuspend sstk - sstk 1 sstk +statfs - statfs 2 __statfs statfs swapoff - swapoff 1 swapoff swapon - swapon 1 swapon symlink - symlink 2 __symlink symlink @@ -55,11 +57,9 @@ sync - sync 0 sync sys_fstat fxstat fstat 2 __syscall_fstat sys_mknod xmknod mknod 3 __syscall_mknod sys_stat xstat stat 2 __syscall_stat -statfs - statfs 2 __statfs statfs -fstatfs - fstatfs 2 __fstatfs fstatfs umask - umask 1 __umask umask uname - uname 1 uname unlink - unlink 1 __unlink unlink utimes - utimes 2 __utimes utimes -write - write 3 __write write +write - write 3 __libc_write __write write writev - writev 3 writev 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; } diff --git a/sysdeps/unix/xmknod.c b/sysdeps/unix/xmknod.c index 81c794a435..21bd3f48bd 100644 --- a/sysdeps/unix/xmknod.c +++ b/sysdeps/unix/xmknod.c @@ -31,7 +31,7 @@ __xmknod (int vers, const char *path, mode_t mode, dev_t *dev) { if (vers != _MKNOD_VER) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } diff --git a/sysdeps/unix/xstat.c b/sysdeps/unix/xstat.c index 3b1b112234..1a53c88cf2 100644 --- a/sysdeps/unix/xstat.c +++ b/sysdeps/unix/xstat.c @@ -28,7 +28,7 @@ __xstat (int vers, const char *file, struct stat *buf) { if (vers != _STAT_VER) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } |