#endif /* __USE_BSD */
+#define __set_errno(val) errno = (val)
+
#endif /* <errno.h> included. */
-/* 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
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)
-/* 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
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>
/* 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)
-/* 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
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>
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)
-/* 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
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;
save = errno;
is_tty = __ioctl (fd, TIOCGETP, &term) == 0;
- errno = save;
+ __set_errno (save);
return is_tty;
}
{
if (gid == (gid_t) ~0)
{
- errno = EINVAL;
+ __set_errno (EINVAL);
return -1;
}
{
if (uid == (uid_t) ~0)
{
- errno = EINVAL;
+ __set_errno (EINVAL);
return -1;
}
-/* 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
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>
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;
if (__getpgid (pid) == pid)
{
/* Already the leader. */
- errno = EPERM;
+ __set_errno (EPERM);
return -1;
}
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;
}
-/* 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
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>
/* 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;
}
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));
-/* 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
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>
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;
switch (how)
{
case SIG_BLOCK:
- mask = __sigblock(mask);
+ mask = __sigblock (mask);
break;
case SIG_UNBLOCK:
/* 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;
-/* 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
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>
/* 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);
}
-/* 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
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>
/* 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)
-/* 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
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>
/* 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:
`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)
}
default:
- errno = EINVAL;
+ __set_errno (EINVAL);
return -1;
}
}
-/* 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
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>
/* 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;
arg = FREAD | FWRITE;
break;
default:
- errno = EINVAL;
+ __set_errno (EINVAL);
return -1;
}
-/* 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
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;
if (termios_p == NULL)
{
- errno = EINVAL;
+ __set_errno (EINVAL);
return -1;
}
-/* 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
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"
-CONST speed_t __bsd_speeds[] =
+const speed_t __bsd_speeds[] =
{
0,
50,
/* 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;
#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)
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;
}
}
if (buf.sg_ispeed == -1 || buf.sg_ospeed == -1)
{
- errno = EINVAL;
+ __set_errno (EINVAL);
return -1;
}
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;
}
-/* 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
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>
__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));
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)
-/* 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
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>
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;
/* Get limit on file size. */
struct rlimit fsize;
- status = getrlimit(RLIMIT_FSIZE, &fsize);
+ status = getrlimit (RLIMIT_FSIZE, &fsize);
if (status < 0)
return -1;
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;
}
}
if (dirp == NULL)
{
- errno = EINVAL;
+ __set_errno (EINVAL);
return -1;
}
{
if (vers != _STAT_VER)
{
- errno = EINVAL;
+ __set_errno (EINVAL);
return -1;
}
-/* 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
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);
}
weak_alias (__getdirentries, getdirentries)
-
{
if (errno == ESRCH)
/* The caller expects ENOENT if nothing is found. */
- errno = ENOENT;
+ __set_errno (ENOENT);
result = NULL;
}
else
if (result < 0)
{
- errno = err;
+ __set_errno (err);
return err;
}
}
-/* 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
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>
/* 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;
if (path == NULL)
{
- errno = EINVAL;
+ __set_errno (EINVAL);
return -1;
}
}
else
{
- errno = EEXIST;
+ __set_errno (EEXIST);
return -1;
}
/* 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
-/* 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
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>
/* 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);
-/* 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
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>
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;
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;
}
{
/* POSIX.1-1990 says an empty name gets ENOENT;
but `open' might like it fine. */
- errno = ENOENT;
+ __set_errno (ENOENT);
return NULL;
}
goto lose;
if (! S_ISDIR (statbuf.st_mode))
{
- errno = ENOTDIR;
+ __set_errno (ENOTDIR);
goto lose;
}
{
int save = errno;
(void) __close (fd);
- errno = save;
+ __set_errno (save);
return NULL;
}
int save = errno;
free (dirp);
(void) __close (fd);
- errno = save;
+ __set_errno (save);
return NULL;
}
if (dirp == NULL || dirp->data == NULL)
{
- errno = EINVAL;
+ __set_errno (EINVAL);
return NULL;
}
-/* 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
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>
/* 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;
if (path == NULL)
{
- errno = EINVAL;
+ __set_errno (EINVAL);
return -1;
}
return -1;
if (!S_ISDIR (statbuf.st_mode))
{
- errno = ENOTDIR;
+ __set_errno (ENOTDIR);
return -1;
}
/* 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;
-/* 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
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>
#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. */
/* 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
-/* 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
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;
}
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
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
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
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
{
if (vers != _MKNOD_VER)
{
- errno = EINVAL;
+ __set_errno (EINVAL);
return -1;
}
{
if (vers != _STAT_VER)
{
- errno = EINVAL;
+ __set_errno (EINVAL);
return -1;
}