diff options
Diffstat (limited to 'sysdeps/generic')
-rw-r--r-- | sysdeps/generic/ftime.c | 4 | ||||
-rw-r--r-- | sysdeps/generic/pty.c | 8 | ||||
-rw-r--r-- | sysdeps/generic/setenv.c | 2 | ||||
-rw-r--r-- | sysdeps/generic/speed.c | 6 | ||||
-rw-r--r-- | sysdeps/generic/strtok.c | 11 | ||||
-rw-r--r-- | sysdeps/generic/strtok_r.c | 11 | ||||
-rw-r--r-- | sysdeps/generic/sysd-stdio.c | 52 | ||||
-rw-r--r-- | sysdeps/generic/uname.c | 10 | ||||
-rw-r--r-- | sysdeps/generic/vlimit.c | 12 | ||||
-rw-r--r-- | sysdeps/generic/waitstatus.h | 3 |
10 files changed, 56 insertions, 63 deletions
diff --git a/sysdeps/generic/ftime.c b/sysdeps/generic/ftime.c index 600e959245..729c7b2adb 100644 --- a/sysdeps/generic/ftime.c +++ b/sysdeps/generic/ftime.c @@ -27,7 +27,7 @@ ftime (timebuf) int save = errno; struct tm tp; - errno = 0; + __set_errno (0); if (time (&timebuf->time) == (time_t) -1 && errno != 0) return -1; timebuf->millitm = 0; @@ -38,6 +38,6 @@ ftime (timebuf) timebuf->timezone = tp.tm_gmtoff / 60; timebuf->dstflag = tp.tm_isdst; - errno = save; + __set_errno (save); return 0; } diff --git a/sysdeps/generic/pty.c b/sysdeps/generic/pty.c index a539a9bb8b..dda2125836 100644 --- a/sysdeps/generic/pty.c +++ b/sysdeps/generic/pty.c @@ -82,10 +82,10 @@ openpty(amaster, aslave, name, termp, winp) if (name) strcpy(name, line); if (termp) - (void) tcsetattr(slave, + (void) tcsetattr(slave, TCSAFLUSH, termp); if (winp) - (void) ioctl(slave, TIOCSWINSZ, + (void) ioctl(slave, TIOCSWINSZ, (char *)winp); return (0); } @@ -94,7 +94,7 @@ openpty(amaster, aslave, name, termp, winp) } } } - errno = ENOENT; /* out of ptys */ + __set_errno (ENOENT); /* out of ptys */ return (-1); } @@ -114,7 +114,7 @@ forkpty(amaster, name, termp, winp) case -1: return (-1); case 0: - /* + /* * child */ (void) close(master); diff --git a/sysdeps/generic/setenv.c b/sysdeps/generic/setenv.c index a84a8ebf64..44830e9aa7 100644 --- a/sysdeps/generic/setenv.c +++ b/sysdeps/generic/setenv.c @@ -88,7 +88,7 @@ setenv (name, value, replace) if (new_environ[size] == NULL) { free ((char *) new_environ); - errno = ENOMEM; + __set_errno (ENOMEM); UNLOCK; return -1; } diff --git a/sysdeps/generic/speed.c b/sysdeps/generic/speed.c index 1f5a3eeacc..229c0665e2 100644 --- a/sysdeps/generic/speed.c +++ b/sysdeps/generic/speed.c @@ -1,5 +1,5 @@ /* `struct termios' speed frobnication functions. 4.4 BSD/generic GNU 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 @@ -43,7 +43,7 @@ DEFUN(cfsetospeed, (termios_p, speed), { if (termios_p == NULL) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } @@ -58,7 +58,7 @@ DEFUN(cfsetispeed, (termios_p, speed), { if (termios_p == NULL) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } diff --git a/sysdeps/generic/strtok.c b/sysdeps/generic/strtok.c index 954471322b..cb30619a43 100644 --- a/sysdeps/generic/strtok.c +++ b/sysdeps/generic/strtok.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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include <errno.h> #include <string.h> @@ -39,15 +38,7 @@ strtok (s, delim) char *token; if (s == NULL) - { - if (olds == NULL) - { - errno = EINVAL; - return NULL; - } - else - s = olds; - } + s = olds; /* Scan leading delimiters. */ s += strspn (s, delim); diff --git a/sysdeps/generic/strtok_r.c b/sysdeps/generic/strtok_r.c index 08a29361c7..488d3eacfe 100644 --- a/sysdeps/generic/strtok_r.c +++ b/sysdeps/generic/strtok_r.c @@ -17,7 +17,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 <errno.h> #include <string.h> @@ -40,15 +39,7 @@ strtok_r (s, delim, save_ptr) char *token; if (s == NULL) - { - if (*save_ptr == NULL) - { - errno = EINVAL; - return NULL; - } - else - s = *save_ptr; - } + s = *save_ptr; /* Scan leading delimiters. */ s += strspn (s, delim); diff --git a/sysdeps/generic/sysd-stdio.c b/sysdeps/generic/sysd-stdio.c index 7a3f7fc918..d28dde87f1 100644 --- a/sysdeps/generic/sysd-stdio.c +++ b/sysdeps/generic/sysd-stdio.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 @@ -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> -#include <errno.h> #include <stddef.h> #include <stdio.h> #include <stdlib.h> @@ -29,16 +27,18 @@ Cambridge, MA 02139, USA. */ /* Read N bytes into BUF from COOKIE. */ int -DEFUN(__stdio_read, (cookie, buf, n), - PTR cookie AND register char *buf AND register size_t n) +__stdio_read (cookie, buf, n) + void *cookie; + register char *buf; + register size_t n; { - CONST int fd = (int) cookie; + const int fd = (int) cookie; #if defined (EINTR) && defined (EINTR_REPEAT) int save = errno; int nread; try:; - errno = 0; + __set_errno (0); nread = __read (fd, buf, (int) n); if (nread < 0) { @@ -46,7 +46,7 @@ DEFUN(__stdio_read, (cookie, buf, n), goto try; return -1; } - errno = save; + __set_errno (save); return nread; #else /* No EINTR. */ @@ -57,10 +57,12 @@ DEFUN(__stdio_read, (cookie, buf, n), /* Write N bytes from BUF to COOKIE. */ int -DEFUN(__stdio_write, (cookie, buf, n), - PTR cookie AND register CONST char *buf AND register size_t n) +__stdio_write (cookie, buf, n) + void *cookie; + register const char *buf; + register size_t n; { - CONST int fd = (int) cookie; + const int fd = (int) cookie; register size_t written = 0; while (n > 0) @@ -89,8 +91,10 @@ DEFUN(__stdio_write, (cookie, buf, n), The new file position is stored in *POS. Returns zero if successful, nonzero if not. */ int -DEFUN(__stdio_seek, (cookie, pos, whence), - PTR cookie AND fpos_t *pos AND int whence) +__stdio_seek (cookie, pos, whence) + void *cookie; + fpos_t *pos; + int whence; { off_t new; new = __lseek ((int) cookie, (off_t) *pos, whence); @@ -103,7 +107,8 @@ DEFUN(__stdio_seek, (cookie, pos, whence), /* Close COOKIE. */ int -DEFUN(__stdio_close, (cookie), PTR cookie) +__stdio_close (cookie) + void *cookie; { return __close ((int) cookie); } @@ -112,7 +117,8 @@ DEFUN(__stdio_close, (cookie), PTR cookie) or -1 for errors. If COOKIE does not relate to any POSIX.1 file descriptor, this should return -1 with errno set to EOPNOTSUPP. */ int -DEFUN(__stdio_fileno, (cookie), PTR cookie) +__stdio_fileno (cookie) + void *cookie; { return (int) cookie; } @@ -120,8 +126,10 @@ DEFUN(__stdio_fileno, (cookie), PTR cookie) /* Open the given file with the mode given in the __io_mode argument. */ int -DEFUN(__stdio_open, (filename, m, cookieptr), - CONST char *filename AND __io_mode m AND PTR *cookieptr) +__stdio_open (filename, m, cookieptr) + const char *filename; + __io_mode m; + void **cookieptr; { int fd; int mode; @@ -155,11 +163,13 @@ DEFUN(__stdio_open, (filename, m, cookieptr), /* Open FILENAME with the mode in M. Use the same magic cookie already in *COOKIEPTR if possible, closing the old cookie with CLOSEFN. */ int -DEFUN(__stdio_reopen, (filename, m, cookieptr), - CONST char *filename AND __io_mode m AND - PTR *cookieptr AND __io_close_fn closefn) +__stdio_reopen (filename, m, cookieptr) + const char *filename; + __io_mode m; + void **cookieptr; + __io_close_fn closefn; { - PTR newcookie; + void *newcookie; /* We leave the old descriptor open while we open the file. That way ``freopen ("/dev/stdin", "r", stdin)'' works. */ diff --git a/sysdeps/generic/uname.c b/sysdeps/generic/uname.c index b3ecf70ad7..c0bc13e02a 100644 --- a/sysdeps/generic/uname.c +++ b/sysdeps/generic/uname.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 <string.h> #include <sys/utsname.h> @@ -27,13 +26,14 @@ Cambridge, MA 02139, USA. */ /* Put information about the system in NAME. */ int -DEFUN(uname, (name), struct utsname *name) +uname (name) + struct utsname *name; { int save; if (name == NULL) { - errno = EINVAL; + __set_errno (EINVAL); return -1; } @@ -49,7 +49,7 @@ DEFUN(uname, (name), struct utsname *name) #ifdef ENAMETOOLONG else if (errno == ENAMETOOLONG) /* The name was truncated. */ - errno = save; + __set_errno (save); #endif else return -1; diff --git a/sysdeps/generic/vlimit.c b/sysdeps/generic/vlimit.c index 56f1199ab3..235a5abfc2 100644 --- a/sysdeps/generic/vlimit.c +++ b/sysdeps/generic/vlimit.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 @@ -20,7 +20,6 @@ Cambridge, MA 02139, USA. */ or stub versions of getrlimit. Separate versions could be written for efficiency, but it's probably not worth it. */ -#include <ansidecl.h> #include <sys/vlimit.h> #include <sys/resource.h> #include <errno.h> @@ -28,8 +27,9 @@ Cambridge, MA 02139, USA. */ /* Set the soft limit for RESOURCE to be VALUE. Returns 0 for success, -1 for failure. */ int -DEFUN(vlimit, (resource, value), - enum __vlimit_resource resource AND int value) +vlimit (resource, value) + enum __vlimit_resource resource; + int value; { if (resource >= LIM_CPU && resource <= LIM_MAXRSS) { @@ -39,13 +39,13 @@ DEFUN(vlimit, (resource, value), (enum __rlimit_resource) ((int) resource - 1); struct rlimit lims; - if (getrlimit(rlimit_res, &lims) < 0) + if (getrlimit (rlimit_res, &lims) < 0) return -1; lims.rlim_cur = value; return setrlimit(rlimit_res, &lims); } - errno = EINVAL; + __set_errno (EINVAL); return -1; } diff --git a/sysdeps/generic/waitstatus.h b/sysdeps/generic/waitstatus.h index fdb40db7ef..8bdebd88e7 100644 --- a/sysdeps/generic/waitstatus.h +++ b/sysdeps/generic/waitstatus.h @@ -1,5 +1,5 @@ /* Definitions of status bits for `wait' et al. -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 @@ -61,6 +61,7 @@ Cambridge, MA 02139, USA. */ union wait { + int w_status; struct { #if __BYTE_ORDER == __LITTLE_ENDIAN |