Эх сурвалжийг харах

More reorg. A place for everything and everything in its place...

Eric Andersen 24 жил өмнө
parent
commit
5606e4d6f9

+ 0 - 4
include/sys/socket.h

@@ -117,8 +117,6 @@ extern int getsockname __P ((int __fd, __SOCKADDR_ARG __addr,
    For connectionless socket types, just set the default address to send to
    For connectionless socket types, just set the default address to send to
    and the only address from which to accept transmissions.
    and the only address from which to accept transmissions.
    Return 0 on success, -1 for errors.  */
    Return 0 on success, -1 for errors.  */
-extern int __connect __P ((int __fd,
-			   __CONST_SOCKADDR_ARG __addr, socklen_t __len));
 extern int connect __P ((int __fd,
 extern int connect __P ((int __fd,
 			 __CONST_SOCKADDR_ARG __addr, socklen_t __len));
 			 __CONST_SOCKADDR_ARG __addr, socklen_t __len));
 
 
@@ -129,8 +127,6 @@ extern int getpeername __P ((int __fd, __SOCKADDR_ARG __addr,
 
 
 
 
 /* Send N bytes of BUF to socket FD.  Returns the number sent or -1.  */
 /* Send N bytes of BUF to socket FD.  Returns the number sent or -1.  */
-extern int __send __P ((int __fd, __const __ptr_t __buf, size_t __n,
-			int __flags));
 extern int send __P ((int __fd, __const __ptr_t __buf, size_t __n,
 extern int send __P ((int __fd, __const __ptr_t __buf, size_t __n,
 		      int __flags));
 		      int __flags));
 
 

+ 10 - 1
libc/inet/Makefile

@@ -35,7 +35,12 @@ MOBJ2=encodeh.o decodeh.o encoded.o decoded.o lengthd.o encodeq.o \
 	formquery.o dnslookup.o resolveaddress.o resolvemailbox.o \
 	formquery.o dnslookup.o resolveaddress.o resolvemailbox.o \
 	opennameservers.o closenameservers.o resolvename.o gethostbyname.o\
 	opennameservers.o closenameservers.o resolvename.o gethostbyname.o\
 	gethostbyaddr.o
 	gethostbyaddr.o
-OBJS=$(MOBJ) $(MOBJ2)
+
+MSRC3=socketcalls.c
+MOBJ3= accept.o bind.o connect.o getpeername.o getsockname.o getsockopt.o \
+	listen.o recv.o recvfrom.o recvmsg.o send.o sendmsg.o sendto.o \
+	setsockopt.o shutdown.o socket.o socketpair.o 
+OBJS=$(MOBJ) $(MOBJ2) $(MOBJ3)
 
 
 
 
 all: $(OBJS) $(LIBC)
 all: $(OBJS) $(LIBC)
@@ -53,6 +58,10 @@ $(MOBJ2): $(MSRC2)
 	$(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
 	$(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
 	$(STRIPTOOL) -x -R .note -R .comment $*.o
 	$(STRIPTOOL) -x -R .note -R .comment $*.o
 
 
+$(MOBJ3): $(MSRC2)
+	$(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
+	$(STRIPTOOL) -x -R .note -R .comment $*.o
+
 $(OBJS): Makefile
 $(OBJS): Makefile
 
 
 clean: subdirs_clean
 clean: subdirs_clean

+ 232 - 0
libc/inet/socketcalls.c

@@ -0,0 +1,232 @@
+#include <errno.h>
+#include <syscall.h>
+#include <sys/socket.h>
+#include <sys/socketcall.h>
+
+extern int socketcall(int call, unsigned long *args);
+
+#ifdef L_accept
+int accept(int s, struct sockaddr *addr, socklen_t * addrlen)
+{
+	unsigned long args[3];
+
+	args[0] = s;
+	args[1] = (unsigned long) addr;
+	args[2] = (unsigned long) addrlen;
+	return socketcall(SYS_ACCEPT, args);
+}
+#endif
+
+#ifdef L_bind
+int bind(int sockfd, const struct sockaddr *myaddr, socklen_t addrlen)
+{
+	unsigned long args[3];
+
+	args[0] = sockfd;
+	args[1] = (unsigned long) myaddr;
+	args[2] = addrlen;
+	return socketcall(SYS_BIND, args);
+}
+#endif
+
+#ifdef L_connect
+int connect(int sockfd, const struct sockaddr *saddr, socklen_t addrlen)
+{
+	unsigned long args[3];
+
+	args[0] = sockfd;
+	args[1] = (unsigned long) saddr;
+	args[2] = addrlen;
+	return socketcall(SYS_CONNECT, args);
+}
+#endif
+
+#ifdef L_getpeername
+int getpeername(int sockfd, struct sockaddr *addr, socklen_t * paddrlen)
+{
+	unsigned long args[3];
+
+	args[0] = sockfd;
+	args[1] = (unsigned long) addr;
+	args[2] = (unsigned long) paddrlen;
+	return socketcall(SYS_GETPEERNAME, args);
+}
+#endif
+
+#ifdef L_getsockname
+int getsockname(int sockfd, struct sockaddr *addr, socklen_t * paddrlen)
+{
+	unsigned long args[3];
+
+	args[0] = sockfd;
+	args[1] = (unsigned long) addr;
+	args[2] = (unsigned long) paddrlen;
+	return socketcall(SYS_GETSOCKNAME, args);
+}
+#endif
+
+#ifdef L_getsockopt
+int getsockopt(int fd, int level, int optname, __ptr_t optval,
+		   socklen_t * optlen)
+{
+	unsigned long args[5];
+
+	args[0] = fd;
+	args[1] = level;
+	args[2] = optname;
+	args[3] = (unsigned long) optval;
+	args[4] = (unsigned long) optlen;
+	return (socketcall(SYS_GETSOCKOPT, args));
+}
+#endif
+
+#ifdef L_listen
+int listen(int sockfd, unsigned int backlog)
+{
+	unsigned long args[2];
+
+	args[0] = sockfd;
+	args[1] = backlog;
+	return socketcall(SYS_LISTEN, args);
+}
+#endif
+
+#ifdef L_recv
+/* recv, recvfrom added by bir7@leland.stanford.edu */
+int recv(int sockfd, __ptr_t buffer, size_t len, int flags)
+{
+	unsigned long args[4];
+
+	args[0] = sockfd;
+	args[1] = (unsigned long) buffer;
+	args[2] = len;
+	args[3] = flags;
+	return (socketcall(SYS_RECV, args));
+}
+#endif
+
+#ifdef L_recvfrom
+/* recv, recvfrom added by bir7@leland.stanford.edu */
+int recvfrom(int sockfd, __ptr_t buffer, size_t len, int flags,
+		 struct sockaddr *to, socklen_t * tolen)
+{
+	unsigned long args[6];
+
+	args[0] = sockfd;
+	args[1] = (unsigned long) buffer;
+	args[2] = len;
+	args[3] = flags;
+	args[4] = (unsigned long) to;
+	args[5] = (unsigned long) tolen;
+	return (socketcall(SYS_RECVFROM, args));
+}
+#endif
+
+#ifdef L_recvmsg
+int recvmsg(int sockfd, struct msghdr *msg, int flags)
+{
+	unsigned long args[3];
+
+	args[0] = sockfd;
+	args[1] = (unsigned long) msg;
+	args[2] = flags;
+	return (socketcall(SYS_RECVMSG, args));
+}
+#endif
+
+#ifdef L_send
+/* send, sendto added by bir7@leland.stanford.edu */
+int send(int sockfd, const void *buffer, size_t len, int flags)
+{
+	unsigned long args[4];
+
+	args[0] = sockfd;
+	args[1] = (unsigned long) buffer;
+	args[2] = len;
+	args[3] = flags;
+	return (socketcall(SYS_SEND, args));
+}
+#endif
+
+#ifdef L_sendmsg
+int sendmsg(int sockfd, const struct msghdr *msg, int flags)
+{
+	unsigned long args[3];
+
+	args[0] = sockfd;
+	args[1] = (unsigned long) msg;
+	args[2] = flags;
+	return (socketcall(SYS_SENDMSG, args));
+}
+#endif
+
+#ifdef L_sendto
+/* send, sendto added by bir7@leland.stanford.edu */
+int sendto(int sockfd, const void *buffer, size_t len, int flags,
+	   const struct sockaddr *to, socklen_t tolen)
+{
+	unsigned long args[6];
+
+	args[0] = sockfd;
+	args[1] = (unsigned long) buffer;
+	args[2] = len;
+	args[3] = flags;
+	args[4] = (unsigned long) to;
+	args[5] = tolen;
+	return (socketcall(SYS_SENDTO, args));
+}
+#endif
+
+#ifdef L_setsockopt
+/* [sg]etsockoptions by bir7@leland.stanford.edu */
+int setsockopt(int fd, int level, int optname, const void *optval,
+		   socklen_t optlen)
+{
+	unsigned long args[5];
+
+	args[0] = fd;
+	args[1] = level;
+	args[2] = optname;
+	args[3] = (unsigned long) optval;
+	args[4] = optlen;
+	return (socketcall(SYS_SETSOCKOPT, args));
+}
+#endif
+
+#ifdef L_shutdown
+/* shutdown by bir7@leland.stanford.edu */
+int shutdown(int sockfd, int how)
+{
+	unsigned long args[2];
+
+	args[0] = sockfd;
+	args[1] = how;
+	return (socketcall(SYS_SHUTDOWN, args));
+}
+#endif
+
+#ifdef L_socket
+int socket(int family, int type, int protocol)
+{
+	unsigned long args[3];
+
+	args[0] = family;
+	args[1] = type;
+	args[2] = (unsigned long) protocol;
+	return socketcall(SYS_SOCKET, args);
+}
+#endif
+
+#ifdef L_socketpair
+int socketpair(int family, int type, int protocol, int sockvec[2])
+{
+	unsigned long args[4];
+
+	args[0] = family;
+	args[1] = type;
+	args[2] = protocol;
+	args[3] = (unsigned long) sockvec;
+	return socketcall(SYS_SOCKETPAIR, args);
+}
+#endif
+

+ 1 - 1
libc/misc/time/Makefile

@@ -25,7 +25,7 @@ include $(TOPDIR)Rules.mak
 LIBC=$(TOPDIR)libc.a
 LIBC=$(TOPDIR)libc.a
 
 
 CSRC=localtime.c gmtime.c asctime.c ctime.c asc_conv.c tm_conv.c mktime.c \
 CSRC=localtime.c gmtime.c asctime.c ctime.c asc_conv.c tm_conv.c mktime.c \
-	localtime_r.c gmtime_r.c asctime_r.c ctime_r.c
+	localtime_r.c gmtime_r.c asctime_r.c ctime_r.c utimes.c adjtime.c
 COBJS=$(patsubst %.c,%.o, $(CSRC))
 COBJS=$(patsubst %.c,%.o, $(CSRC))
 OBJS=$(COBJS)
 OBJS=$(COBJS)
 
 

+ 51 - 0
libc/misc/time/adjtime.c

@@ -0,0 +1,51 @@
+#include <limits.h>
+#include <sys/time.h>
+#include <sys/timex.h>
+#include <errno.h>
+
+#define MAX_SEC	(LONG_MAX / 1000000L - 2)
+#define MIN_SEC	(LONG_MIN / 1000000L + 2)
+
+#ifndef MOD_OFFSET
+#define modes mode
+#endif
+
+int
+adjtime(const struct timeval * itv, struct timeval * otv)
+{
+  struct timex tntx;
+
+  if (itv)
+  {
+    struct timeval tmp;
+
+    /* We will do some check here. */
+    tmp.tv_sec = itv->tv_sec + itv->tv_usec / 1000000L;
+    tmp.tv_usec = itv->tv_usec % 1000000L;
+    if (tmp.tv_sec > MAX_SEC || tmp.tv_sec < MIN_SEC)
+    {
+	errno = EINVAL;
+	return -1;
+    }
+    tntx.offset = tmp.tv_usec + tmp.tv_sec * 1000000L;
+    tntx.modes = ADJ_OFFSET_SINGLESHOT;
+  }
+  else
+  {
+    tntx.modes = 0;
+  }
+  if (adjtimex(&tntx) < 0) return -1;
+  if (otv) {
+    if (tntx.offset < 0)
+      {
+	otv->tv_usec = -(-tntx.offset % 1000000);
+	otv->tv_sec  = -(-tntx.offset / 1000000);
+      }
+    else
+      {
+	otv->tv_usec = tntx.offset % 1000000;
+	otv->tv_sec  = tntx.offset / 1000000;
+      }
+  }
+  return 0;
+}

+ 16 - 0
libc/misc/time/utimes.c

@@ -0,0 +1,16 @@
+#include <utime.h>
+#include <sys/time.h>
+
+int utimes(const char *path, struct timeval tvp[2])
+{
+	struct utimbuf buf, *times;
+
+	if (tvp) {
+		times = &buf;
+		times->actime = tvp[0].tv_sec;
+		times->modtime = tvp[1].tv_sec;
+	}
+	else
+		times = NULL;
+	return utime(path, times);
+}

+ 2 - 1
libc/signal/Makefile

@@ -24,7 +24,8 @@ TOPDIR=../
 include $(TOPDIR)Rules.mak
 include $(TOPDIR)Rules.mak
 LIBC=$(TOPDIR)libc.a
 LIBC=$(TOPDIR)libc.a
 
 
-CSRC=raise.c
+CSRC=bsd_sig.c raise.c sigblock.c siggtmsk.c sigjmp.c signal.c sigpause.c sigstmsk.c
+
 COBJS=$(patsubst %.c,%.o, $(CSRC))
 COBJS=$(patsubst %.c,%.o, $(CSRC))
 OBJS=$(COBJS)
 OBJS=$(COBJS)
 
 

+ 34 - 0
libc/signal/bsd_sig.c

@@ -0,0 +1,34 @@
+#define __USE_BSD_SIGNAL
+
+#include <signal.h>
+
+#undef signal
+
+/* The `sig' bit is set if the interrupt on it
+ * is enabled via siginterrupt (). */
+extern sigset_t _sigintr;
+
+__sighandler_t
+__bsd_signal (int sig, __sighandler_t handler)
+{
+  int ret;
+  struct sigaction action, oaction;
+  action.sa_handler = handler;
+  __sigemptyset (&action.sa_mask);
+  if (!__sigismember (&_sigintr, sig)) {
+#ifdef SA_RESTART
+    action.sa_flags = SA_RESTART;
+#else
+    action.sa_flags = 0;
+#endif
+  }
+  else {
+#ifdef SA_INTERRUPT
+    action.sa_flags = SA_INTERRUPT;
+#else
+    action.sa_flags = 0;
+#endif
+  }
+  ret = __sigaction (sig, &action, &oaction); 
+  return (ret == -1) ? SIG_ERR : oaction.sa_handler;
+}

+ 45 - 0
libc/signal/sigblock.c

@@ -0,0 +1,45 @@
+/* Copyright (C) 1991 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 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., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <errno.h>
+#define __USE_BSD
+#include <signal.h>
+
+/* Block signals in MASK, returning the old mask.  */
+int sigblock (int mask)
+{
+  register int sig;
+  sigset_t set, oset;
+
+  if (sigemptyset(&set) < 0)
+    return -1;
+  
+  for (sig = 1; sig < NSIG; ++sig)
+    if ((mask & sigmask(sig)) && sigaddset(&set, sig) < 0)
+      return -1;
+
+  if (sigprocmask(SIG_BLOCK, &set, &oset) < 0)
+    return -1;
+
+  mask = 0;
+  for (sig = 1; sig < NSIG; ++sig)
+    if (sigismember(&oset, sig))
+      mask |= sigmask(sig);
+
+  return mask;
+}

+ 39 - 0
libc/signal/siggtmsk.c

@@ -0,0 +1,39 @@
+/* Copyright (C) 1993 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 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., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <errno.h>
+#define __USE_BSD
+#include <signal.h>
+
+/* Get the mask of blocked signals.  */
+int siggetmask()
+{
+  sigset_t oset;
+  register int sig;
+  int mask;
+
+  if (sigprocmask(SIG_SETMASK, 0, &oset) < 0)
+    return -1;
+
+  mask = 0;
+  for (sig = 1; sig < NSIG; ++sig)
+    if (sigismember(&oset, sig) == 1)
+      mask |= sigmask(sig);
+
+  return mask;
+}

+ 35 - 0
libc/signal/sigjmp.c

@@ -0,0 +1,35 @@
+/* Copyright (C) 1992, 1994, 1997 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 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 <stddef.h>
+#include <setjmp.h>
+#include <signal.h>
+
+/* This function is called by the `sigsetjmp' macro
+   before doing a `__setjmp' on ENV[0].__jmpbuf.
+   Always return zero.  */
+
+int
+__sigjmp_save (sigjmp_buf env, int savemask)
+{
+  env[0].__mask_was_saved = (savemask &&
+			     sigprocmask (SIG_BLOCK, (sigset_t *) NULL,
+					    &env[0].__saved_mask) == 0);
+
+  return 0;
+}

+ 20 - 0
libc/signal/signal.c

@@ -0,0 +1,20 @@
+#include <string.h>
+#include <signal.h>
+
+__sighandler_t
+__signal (int sig, __sighandler_t handler, int flags)
+{
+  int ret;
+  struct sigaction action, oaction;
+  memset(&action, 0, sizeof(struct sigaction));
+  action.sa_handler = handler;
+  action.sa_flags = flags;
+  ret = sigaction (sig, &action, &oaction); 
+  return (ret == -1) ? SIG_ERR : oaction.sa_handler;
+}
+
+__sighandler_t
+signal (int sig, __sighandler_t handler)
+{
+  return __signal(sig, handler, (SA_ONESHOT | SA_NOMASK | SA_INTERRUPT) & ~SA_RESTART);
+}

+ 37 - 0
libc/signal/sigpause.c

@@ -0,0 +1,37 @@
+/* Copyright (C) 1991, 1992 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 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., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <errno.h>
+#include <signal.h>
+
+#undef sigpause
+
+/* Set the mask of blocked signals to MASK,
+   wait for a signal to arrive, and then restore the mask.  */
+int sigpause(int mask)
+{
+  sigset_t set;
+  int sig;
+
+  sigemptyset(&set);
+  for (sig = 1; sig < NSIG; ++sig)
+    if (mask & sigmask(sig))
+      sigaddset(&set, sig);
+
+  return sigsuspend (&set);
+}

+ 46 - 0
libc/signal/sigstmsk.c

@@ -0,0 +1,46 @@
+/* Copyright (C) 1993 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 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., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <errno.h>
+#define __USE_BSD
+#include <signal.h>
+
+/* Set the mask of blocked signals to MASK, returning the old mask.  */
+int sigsetmask (int mask)
+{
+  register int sig;
+  sigset_t set, oset;
+
+  if (sigemptyset(&set) < 0)
+    return -1;
+  
+  for (sig = 1; sig < NSIG; ++sig)
+    if ((mask & sigmask(sig)) &&
+      sigaddset(&set, sig) < 0)
+      return -1;
+
+  if (sigprocmask(SIG_SETMASK, &set, &oset) < 0)
+    return -1;
+
+  mask = 0;
+  for (sig = 1; sig < NSIG; ++sig)
+    if (sigismember(&oset, sig) == 1)
+      mask |= sigmask(sig);
+
+  return mask;
+}

+ 1 - 1
libc/string/Makefile

@@ -34,7 +34,7 @@ MOBJ1=index.o rindex.o
 
 
 CSRC=strpbrk.c strsep.c strstr.c strtok.c strcspn.c config.c strspn.c \
 CSRC=strpbrk.c strsep.c strstr.c strtok.c strcspn.c config.c strspn.c \
 	strcasecmp.c strncasecmp.c strerror.c bcopy.c bzero.c bcmp.c \
 	strcasecmp.c strncasecmp.c strerror.c bcopy.c bzero.c bcmp.c \
-	strsignal.c
+	strsignal.c sys_errlist.c
 COBJS=$(patsubst %.c,%.o, $(CSRC))
 COBJS=$(patsubst %.c,%.o, $(CSRC))
 OBJS=$(MOBJ) $(MOBJ1) $(COBJS)
 OBJS=$(MOBJ) $(MOBJ1) $(COBJS)
 
 

+ 6 - 5
libc/string/strsignal.c

@@ -8,7 +8,7 @@
 #include <malloc.h>
 #include <malloc.h>
 #include <signal.h>
 #include <signal.h>
 
 
-const char *const sys_siglist[NSIG] = {
+const char *const sys_siglist[] = {
 	"Unknown signal",
 	"Unknown signal",
 	"Hangup",
 	"Hangup",
 	"Interrupt",
 	"Interrupt",
@@ -32,20 +32,21 @@ const char *const sys_siglist[NSIG] = {
 	"Stopped",
 	"Stopped",
 	"Stopped (tty input)",
 	"Stopped (tty input)",
 	"Stopped (tty output)",
 	"Stopped (tty output)",
-	"Possible I/O",
+	"Urgent condition",
 	"CPU time limit exceeded",
 	"CPU time limit exceeded",
 	"File size limit exceeded",
 	"File size limit exceeded",
 	"Virtual time alarm",
 	"Virtual time alarm",
 	"Profile signal",
 	"Profile signal",
 	"Window size changed",
 	"Window size changed",
-	"File lock lost",
+	"Possible I/O",
 	"Power failure",
 	"Power failure",
-	"Unused signal"
+	"Unused signal",
+	NULL
 };
 };
 
 
 /********************** Function strsignal ************************************/
 /********************** Function strsignal ************************************/
 
 
-char *strsignal (int sig)
+char *strsignal(int sig)
 {
 {
 	static char retbuf[80];
 	static char retbuf[80];
 
 

+ 140 - 0
libc/string/sys_errlist.c

@@ -0,0 +1,140 @@
+#include <stddef.h>
+#if 0
+#include <errno.h>
+#endif
+
+/* This is a list of all known signal numbers.  */
+
+const char * const sys_errlist[] = {
+	"Success",				/* 0 */
+	"Operation not permitted", 		/* EPERM */
+	"No such file or directory", 		/* ENOENT */
+	"No such process", 			/* ESRCH */
+	"Interrupted system call", 		/* EINTR */
+	"I/O error", 				/* EIO */
+	"No such device or address", 		/* ENXIO */
+	"Arg list too long", 			/* E2BIG */
+	"Exec format error", 			/* ENOEXEC */
+	"Bad file number", 			/* EBADF */
+	"No child processes", 			/* ECHILD */
+	"Try again", 				/* EAGAIN */
+	"Out of memory", 			/* ENOMEM */
+	"Permission denied", 			/* EACCES */
+	"Bad address", 				/* EFAULT */
+	"Block device required", 		/* ENOTBLK */
+	"Device or resource busy", 		/* EBUSY */
+	"File exists", 				/* EEXIST */
+	"Cross-device link", 			/* EXDEV */
+	"No such device", 			/* ENODEV */
+	"Not a directory", 			/* ENOTDIR */
+	"Is a directory", 			/* EISDIR */
+	"Invalid argument", 			/* EINVAL */
+	"File table overflow", 			/* ENFILE */
+	"Too many open files", 			/* EMFILE */
+	"Not a typewriter", 			/* ENOTTY */
+	"Text file busy", 			/* ETXTBSY */
+	"File too large", 			/* EFBIG */
+	"No space left on device", 		/* ENOSPC */
+	"Illegal seek", 			/* ESPIPE */
+	"Read-only file system", 		/* EROFS */
+	"Too many links", 			/* EMLINK */
+	"Broken pipe", 				/* EPIPE */
+	"Math argument out of domain of func", 	/* EDOM */
+	"Math result not representable", 	/* ERANGE */
+	"Resource deadlock would occur", 	/* EDEADLK */
+	"File name too long", 			/* ENAMETOOLONG */
+	"No record locks available", 		/* ENOLCK */
+	"Function not implemented", 		/* ENOSYS */
+	"Directory not empty", 			/* ENOTEMPTY */
+	"Too many symbolic links encountered", 	/* ELOOP */
+	"Operation would block", 		/* EWOULDBLOCK */
+	"No message of desired type", 		/* ENOMSG */
+	"Identifier removed", 			/* EIDRM */
+	"Channel number out of range", 		/* ECHRNG */
+	"Level 2 not synchronized", 		/* EL2NSYNC */
+	"Level 3 halted", 			/* EL3HLT */
+	"Level 3 reset", 			/* EL3RST */
+	"Link number out of range", 		/* ELNRNG */
+	"Protocol driver not attached", 	/* EUNATCH */
+	"No CSI structure available", 		/* ENOCSI */
+	"Level 2 halted", 			/* EL2HLT */
+	"Invalid exchange", 			/* EBADE */
+	"Invalid request descriptor", 		/* EBADR */
+	"Exchange full", 			/* EXFULL */
+	"No anode", 				/* ENOANO */
+	"Invalid request code", 		/* EBADRQC */
+	"Invalid slot", 			/* EBADSLT */
+	"File locking deadlock error", 		/* EDEADLOCK */
+	"Bad font file format", 		/* EBFONT */
+	"Device not a stream", 			/* ENOSTR */
+	"No data available", 			/* ENODATA */
+	"Timer expired", 			/* ETIME */
+	"Out of streams resources", 		/* ENOSR */
+	"Machine is not on the network", 	/* ENONET */
+	"Package not installed", 		/* ENOPKG */
+	"Object is remote", 			/* EREMOTE */
+	"Link has been severed", 		/* ENOLINK */
+	"Advertise error", 			/* EADV */
+	"Srmount error", 			/* ESRMNT */
+	"Communication error on send", 		/* ECOMM */
+	"Protocol error", 			/* EPROTO */
+	"Multihop attempted", 			/* EMULTIHOP */
+	"RFS specific error", 			/* EDOTDOT */
+	"Not a data message", 			/* EBADMSG */
+	"Value too large for defined data type", 	/* EOVERFLOW */
+	"Name not unique on network", 		/* ENOTUNIQ */
+	"File descriptor in bad state", 	/* EBADFD */
+	"Remote address changed", 		/* EREMCHG */
+	"Can not access a needed shared library", 	/* ELIBACC */
+	"Accessing a corrupted shared library", 	/* ELIBBAD */
+	".lib section in a.out corrupted", 	/* ELIBSCN */
+	"Attempting to link in too many shared libraries", 	/* ELIBMAX */
+	"Cannot exec a shared library directly", 	/* ELIBEXEC */
+	"Illegal byte sequence", 		/* EILSEQ */
+	"Interrupted system call should be restarted", 	/* ERESTART */
+	"Streams pipe error", 			/* ESTRPIPE */
+	"Too many users", 			/* EUSERS */
+	"Socket operation on non-socket", 	/* ENOTSOCK */
+	"Destination address required", 	/* EDESTADDRREQ */
+	"Message too long", 			/* EMSGSIZE */
+	"Protocol wrong type for socket", 	/* EPROTOTYPE */
+	"Protocol not available", 		/* ENOPROTOOPT */
+	"Protocol not supported", 		/* EPROTONOSUPPORT */
+	"Socket type not supported", 		/* ESOCKTNOSUPPORT */
+	"Operation not supported on transport endpoint", 	/* EOPNOTSUPP */
+	"Protocol family not supported", 	/* EPFNOSUPPORT */
+	"Address family not supported by protocol", 	/* EAFNOSUPPORT */
+	"Address already in use", 		/* EADDRINUSE */
+	"Cannot assign requested address", 	/* EADDRNOTAVAIL */
+	"Network is down", 			/* ENETDOWN */
+	"Network is unreachable", 		/* ENETUNREACH */
+	"Network dropped connection because of reset", 	/* ENETRESET */
+	"Software caused connection abort", 	/* ECONNABORTED */
+	"Connection reset by peer", 		/* ECONNRESET */
+	"No buffer space available", 		/* ENOBUFS */
+	"Transport endpoint is already connected", 	/* EISCONN */
+	"Transport endpoint is not connected", 	/* ENOTCONN */
+	"Cannot send after transport endpoint shutdown", 	/* ESHUTDOWN */
+	"Too many references: cannot splice", 	/* ETOOMANYREFS */
+	"Connection timed out", 		/* ETIMEDOUT */
+	"Connection refused", 			/* ECONNREFUSED */
+	"Host is down", 			/* EHOSTDOWN */
+	"No route to host", 			/* EHOSTUNREACH */
+	"Operation already in progress", 	/* EALREADY */
+	"Operation now in progress", 		/* EINPROGRESS */
+	"Stale NFS file handle", 		/* ESTALE */
+	"Structure needs cleaning", 		/* EUCLEAN */
+	"Not a XENIX named type file", 		/* ENOTNAM */
+	"No XENIX semaphores available", 	/* ENAVAIL */
+	"Is a named type file", 		/* EISNAM */
+	"Remote I/O error", 			/* EREMOTEIO */
+	"Quota exceeded", 			/* EDQUOT */
+	"No medium found",			/* ENOMEDIUM */
+	"Wrong medium type",			/* EMEDIUMTYPE */
+	NULL
+};
+
+
+#define NR_ERRORS ((sizeof (sys_errlist))/(sizeof(char *))-1)
+
+const int sys_nerr = NR_ERRORS;

+ 1 - 1
libc/sysdeps/linux/common/setegid.c

@@ -2,5 +2,5 @@
 
 
 int setegid(gid_t gid)
 int setegid(gid_t gid)
 {
 {
-	return __setregid(-1, gid);
+	return setregid(-1, gid);
 }
 }

+ 0 - 10
libc/sysdeps/linux/common/waitpid.c

@@ -1,10 +0,0 @@
-#include <syscall.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/resource.h>
-
-__pid_t
-waitpid(__pid_t pid, int *wait_stat, int options)
-{
-	return wait4(pid, (__WAIT_STATUS) wait_stat, options, NULL);
-}