• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revision5606e4d6f92c10af214b54a01db79cf561067e58 (tree)
Time2000-10-24 08:23:54
AuthorEric Andersen <andersen@code...>
CommiterEric Andersen

Log Message

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

Change Summary

Incremental Difference

--- a/include/sys/socket.h
+++ b/include/sys/socket.h
@@ -117,8 +117,6 @@ extern int getsockname __P ((int __fd, __SOCKADDR_ARG __addr,
117117 For connectionless socket types, just set the default address to send to
118118 and the only address from which to accept transmissions.
119119 Return 0 on success, -1 for errors. */
120-extern int __connect __P ((int __fd,
121- __CONST_SOCKADDR_ARG __addr, socklen_t __len));
122120 extern int connect __P ((int __fd,
123121 __CONST_SOCKADDR_ARG __addr, socklen_t __len));
124122
@@ -129,8 +127,6 @@ extern int getpeername __P ((int __fd, __SOCKADDR_ARG __addr,
129127
130128
131129 /* Send N bytes of BUF to socket FD. Returns the number sent or -1. */
132-extern int __send __P ((int __fd, __const __ptr_t __buf, size_t __n,
133- int __flags));
134130 extern int send __P ((int __fd, __const __ptr_t __buf, size_t __n,
135131 int __flags));
136132
--- a/libc/inet/Makefile
+++ b/libc/inet/Makefile
@@ -35,7 +35,12 @@ MOBJ2=encodeh.o decodeh.o encoded.o decoded.o lengthd.o encodeq.o \
3535 formquery.o dnslookup.o resolveaddress.o resolvemailbox.o \
3636 opennameservers.o closenameservers.o resolvename.o gethostbyname.o\
3737 gethostbyaddr.o
38-OBJS=$(MOBJ) $(MOBJ2)
38+
39+MSRC3=socketcalls.c
40+MOBJ3= accept.o bind.o connect.o getpeername.o getsockname.o getsockopt.o \
41+ listen.o recv.o recvfrom.o recvmsg.o send.o sendmsg.o sendto.o \
42+ setsockopt.o shutdown.o socket.o socketpair.o
43+OBJS=$(MOBJ) $(MOBJ2) $(MOBJ3)
3944
4045
4146 all: $(OBJS) $(LIBC)
@@ -53,6 +58,10 @@ $(MOBJ2): $(MSRC2)
5358 $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
5459 $(STRIPTOOL) -x -R .note -R .comment $*.o
5560
61+$(MOBJ3): $(MSRC2)
62+ $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
63+ $(STRIPTOOL) -x -R .note -R .comment $*.o
64+
5665 $(OBJS): Makefile
5766
5867 clean: subdirs_clean
--- /dev/null
+++ b/libc/inet/socketcalls.c
@@ -0,0 +1,232 @@
1+#include <errno.h>
2+#include <syscall.h>
3+#include <sys/socket.h>
4+#include <sys/socketcall.h>
5+
6+extern int socketcall(int call, unsigned long *args);
7+
8+#ifdef L_accept
9+int accept(int s, struct sockaddr *addr, socklen_t * addrlen)
10+{
11+ unsigned long args[3];
12+
13+ args[0] = s;
14+ args[1] = (unsigned long) addr;
15+ args[2] = (unsigned long) addrlen;
16+ return socketcall(SYS_ACCEPT, args);
17+}
18+#endif
19+
20+#ifdef L_bind
21+int bind(int sockfd, const struct sockaddr *myaddr, socklen_t addrlen)
22+{
23+ unsigned long args[3];
24+
25+ args[0] = sockfd;
26+ args[1] = (unsigned long) myaddr;
27+ args[2] = addrlen;
28+ return socketcall(SYS_BIND, args);
29+}
30+#endif
31+
32+#ifdef L_connect
33+int connect(int sockfd, const struct sockaddr *saddr, socklen_t addrlen)
34+{
35+ unsigned long args[3];
36+
37+ args[0] = sockfd;
38+ args[1] = (unsigned long) saddr;
39+ args[2] = addrlen;
40+ return socketcall(SYS_CONNECT, args);
41+}
42+#endif
43+
44+#ifdef L_getpeername
45+int getpeername(int sockfd, struct sockaddr *addr, socklen_t * paddrlen)
46+{
47+ unsigned long args[3];
48+
49+ args[0] = sockfd;
50+ args[1] = (unsigned long) addr;
51+ args[2] = (unsigned long) paddrlen;
52+ return socketcall(SYS_GETPEERNAME, args);
53+}
54+#endif
55+
56+#ifdef L_getsockname
57+int getsockname(int sockfd, struct sockaddr *addr, socklen_t * paddrlen)
58+{
59+ unsigned long args[3];
60+
61+ args[0] = sockfd;
62+ args[1] = (unsigned long) addr;
63+ args[2] = (unsigned long) paddrlen;
64+ return socketcall(SYS_GETSOCKNAME, args);
65+}
66+#endif
67+
68+#ifdef L_getsockopt
69+int getsockopt(int fd, int level, int optname, __ptr_t optval,
70+ socklen_t * optlen)
71+{
72+ unsigned long args[5];
73+
74+ args[0] = fd;
75+ args[1] = level;
76+ args[2] = optname;
77+ args[3] = (unsigned long) optval;
78+ args[4] = (unsigned long) optlen;
79+ return (socketcall(SYS_GETSOCKOPT, args));
80+}
81+#endif
82+
83+#ifdef L_listen
84+int listen(int sockfd, unsigned int backlog)
85+{
86+ unsigned long args[2];
87+
88+ args[0] = sockfd;
89+ args[1] = backlog;
90+ return socketcall(SYS_LISTEN, args);
91+}
92+#endif
93+
94+#ifdef L_recv
95+/* recv, recvfrom added by bir7@leland.stanford.edu */
96+int recv(int sockfd, __ptr_t buffer, size_t len, int flags)
97+{
98+ unsigned long args[4];
99+
100+ args[0] = sockfd;
101+ args[1] = (unsigned long) buffer;
102+ args[2] = len;
103+ args[3] = flags;
104+ return (socketcall(SYS_RECV, args));
105+}
106+#endif
107+
108+#ifdef L_recvfrom
109+/* recv, recvfrom added by bir7@leland.stanford.edu */
110+int recvfrom(int sockfd, __ptr_t buffer, size_t len, int flags,
111+ struct sockaddr *to, socklen_t * tolen)
112+{
113+ unsigned long args[6];
114+
115+ args[0] = sockfd;
116+ args[1] = (unsigned long) buffer;
117+ args[2] = len;
118+ args[3] = flags;
119+ args[4] = (unsigned long) to;
120+ args[5] = (unsigned long) tolen;
121+ return (socketcall(SYS_RECVFROM, args));
122+}
123+#endif
124+
125+#ifdef L_recvmsg
126+int recvmsg(int sockfd, struct msghdr *msg, int flags)
127+{
128+ unsigned long args[3];
129+
130+ args[0] = sockfd;
131+ args[1] = (unsigned long) msg;
132+ args[2] = flags;
133+ return (socketcall(SYS_RECVMSG, args));
134+}
135+#endif
136+
137+#ifdef L_send
138+/* send, sendto added by bir7@leland.stanford.edu */
139+int send(int sockfd, const void *buffer, size_t len, int flags)
140+{
141+ unsigned long args[4];
142+
143+ args[0] = sockfd;
144+ args[1] = (unsigned long) buffer;
145+ args[2] = len;
146+ args[3] = flags;
147+ return (socketcall(SYS_SEND, args));
148+}
149+#endif
150+
151+#ifdef L_sendmsg
152+int sendmsg(int sockfd, const struct msghdr *msg, int flags)
153+{
154+ unsigned long args[3];
155+
156+ args[0] = sockfd;
157+ args[1] = (unsigned long) msg;
158+ args[2] = flags;
159+ return (socketcall(SYS_SENDMSG, args));
160+}
161+#endif
162+
163+#ifdef L_sendto
164+/* send, sendto added by bir7@leland.stanford.edu */
165+int sendto(int sockfd, const void *buffer, size_t len, int flags,
166+ const struct sockaddr *to, socklen_t tolen)
167+{
168+ unsigned long args[6];
169+
170+ args[0] = sockfd;
171+ args[1] = (unsigned long) buffer;
172+ args[2] = len;
173+ args[3] = flags;
174+ args[4] = (unsigned long) to;
175+ args[5] = tolen;
176+ return (socketcall(SYS_SENDTO, args));
177+}
178+#endif
179+
180+#ifdef L_setsockopt
181+/* [sg]etsockoptions by bir7@leland.stanford.edu */
182+int setsockopt(int fd, int level, int optname, const void *optval,
183+ socklen_t optlen)
184+{
185+ unsigned long args[5];
186+
187+ args[0] = fd;
188+ args[1] = level;
189+ args[2] = optname;
190+ args[3] = (unsigned long) optval;
191+ args[4] = optlen;
192+ return (socketcall(SYS_SETSOCKOPT, args));
193+}
194+#endif
195+
196+#ifdef L_shutdown
197+/* shutdown by bir7@leland.stanford.edu */
198+int shutdown(int sockfd, int how)
199+{
200+ unsigned long args[2];
201+
202+ args[0] = sockfd;
203+ args[1] = how;
204+ return (socketcall(SYS_SHUTDOWN, args));
205+}
206+#endif
207+
208+#ifdef L_socket
209+int socket(int family, int type, int protocol)
210+{
211+ unsigned long args[3];
212+
213+ args[0] = family;
214+ args[1] = type;
215+ args[2] = (unsigned long) protocol;
216+ return socketcall(SYS_SOCKET, args);
217+}
218+#endif
219+
220+#ifdef L_socketpair
221+int socketpair(int family, int type, int protocol, int sockvec[2])
222+{
223+ unsigned long args[4];
224+
225+ args[0] = family;
226+ args[1] = type;
227+ args[2] = protocol;
228+ args[3] = (unsigned long) sockvec;
229+ return socketcall(SYS_SOCKETPAIR, args);
230+}
231+#endif
232+
--- a/libc/misc/time/Makefile
+++ b/libc/misc/time/Makefile
@@ -25,7 +25,7 @@ include $(TOPDIR)Rules.mak
2525 LIBC=$(TOPDIR)libc.a
2626
2727 CSRC=localtime.c gmtime.c asctime.c ctime.c asc_conv.c tm_conv.c mktime.c \
28- localtime_r.c gmtime_r.c asctime_r.c ctime_r.c
28+ localtime_r.c gmtime_r.c asctime_r.c ctime_r.c utimes.c adjtime.c
2929 COBJS=$(patsubst %.c,%.o, $(CSRC))
3030 OBJS=$(COBJS)
3131
--- /dev/null
+++ b/libc/misc/time/adjtime.c
@@ -0,0 +1,51 @@
1+#include <limits.h>
2+#include <sys/time.h>
3+#include <sys/timex.h>
4+#include <errno.h>
5+
6+#define MAX_SEC (LONG_MAX / 1000000L - 2)
7+#define MIN_SEC (LONG_MIN / 1000000L + 2)
8+
9+#ifndef MOD_OFFSET
10+#define modes mode
11+#endif
12+
13+int
14+adjtime(const struct timeval * itv, struct timeval * otv)
15+{
16+ struct timex tntx;
17+
18+ if (itv)
19+ {
20+ struct timeval tmp;
21+
22+ /* We will do some check here. */
23+ tmp.tv_sec = itv->tv_sec + itv->tv_usec / 1000000L;
24+ tmp.tv_usec = itv->tv_usec % 1000000L;
25+ if (tmp.tv_sec > MAX_SEC || tmp.tv_sec < MIN_SEC)
26+ {
27+ errno = EINVAL;
28+ return -1;
29+ }
30+ tntx.offset = tmp.tv_usec + tmp.tv_sec * 1000000L;
31+ tntx.modes = ADJ_OFFSET_SINGLESHOT;
32+ }
33+ else
34+ {
35+ tntx.modes = 0;
36+ }
37+ if (adjtimex(&tntx) < 0) return -1;
38+ if (otv) {
39+ if (tntx.offset < 0)
40+ {
41+ otv->tv_usec = -(-tntx.offset % 1000000);
42+ otv->tv_sec = -(-tntx.offset / 1000000);
43+ }
44+ else
45+ {
46+ otv->tv_usec = tntx.offset % 1000000;
47+ otv->tv_sec = tntx.offset / 1000000;
48+ }
49+ }
50+ return 0;
51+}
--- /dev/null
+++ b/libc/misc/time/utimes.c
@@ -0,0 +1,16 @@
1+#include <utime.h>
2+#include <sys/time.h>
3+
4+int utimes(const char *path, struct timeval tvp[2])
5+{
6+ struct utimbuf buf, *times;
7+
8+ if (tvp) {
9+ times = &buf;
10+ times->actime = tvp[0].tv_sec;
11+ times->modtime = tvp[1].tv_sec;
12+ }
13+ else
14+ times = NULL;
15+ return utime(path, times);
16+}
--- a/libc/signal/Makefile
+++ b/libc/signal/Makefile
@@ -24,7 +24,8 @@ TOPDIR=../
2424 include $(TOPDIR)Rules.mak
2525 LIBC=$(TOPDIR)libc.a
2626
27-CSRC=raise.c
27+CSRC=bsd_sig.c raise.c sigblock.c siggtmsk.c sigjmp.c signal.c sigpause.c sigstmsk.c
28+
2829 COBJS=$(patsubst %.c,%.o, $(CSRC))
2930 OBJS=$(COBJS)
3031
--- /dev/null
+++ b/libc/signal/bsd_sig.c
@@ -0,0 +1,34 @@
1+#define __USE_BSD_SIGNAL
2+
3+#include <signal.h>
4+
5+#undef signal
6+
7+/* The `sig' bit is set if the interrupt on it
8+ * is enabled via siginterrupt (). */
9+extern sigset_t _sigintr;
10+
11+__sighandler_t
12+__bsd_signal (int sig, __sighandler_t handler)
13+{
14+ int ret;
15+ struct sigaction action, oaction;
16+ action.sa_handler = handler;
17+ __sigemptyset (&action.sa_mask);
18+ if (!__sigismember (&_sigintr, sig)) {
19+#ifdef SA_RESTART
20+ action.sa_flags = SA_RESTART;
21+#else
22+ action.sa_flags = 0;
23+#endif
24+ }
25+ else {
26+#ifdef SA_INTERRUPT
27+ action.sa_flags = SA_INTERRUPT;
28+#else
29+ action.sa_flags = 0;
30+#endif
31+ }
32+ ret = __sigaction (sig, &action, &oaction);
33+ return (ret == -1) ? SIG_ERR : oaction.sa_handler;
34+}
--- /dev/null
+++ b/libc/signal/sigblock.c
@@ -0,0 +1,45 @@
1+/* Copyright (C) 1991 Free Software Foundation, Inc.
2+This file is part of the GNU C Library.
3+
4+The GNU C Library is free software; you can redistribute it and/or
5+modify it under the terms of the GNU Library General Public License as
6+published by the Free Software Foundation; either version 2 of the
7+License, or (at your option) any later version.
8+
9+The GNU C Library is distributed in the hope that it will be useful,
10+but WITHOUT ANY WARRANTY; without even the implied warranty of
11+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+Library General Public License for more details.
13+
14+You should have received a copy of the GNU Library General Public
15+License along with the GNU C Library; see the file COPYING.LIB. If
16+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17+Cambridge, MA 02139, USA. */
18+
19+#include <errno.h>
20+#define __USE_BSD
21+#include <signal.h>
22+
23+/* Block signals in MASK, returning the old mask. */
24+int sigblock (int mask)
25+{
26+ register int sig;
27+ sigset_t set, oset;
28+
29+ if (sigemptyset(&set) < 0)
30+ return -1;
31+
32+ for (sig = 1; sig < NSIG; ++sig)
33+ if ((mask & sigmask(sig)) && sigaddset(&set, sig) < 0)
34+ return -1;
35+
36+ if (sigprocmask(SIG_BLOCK, &set, &oset) < 0)
37+ return -1;
38+
39+ mask = 0;
40+ for (sig = 1; sig < NSIG; ++sig)
41+ if (sigismember(&oset, sig))
42+ mask |= sigmask(sig);
43+
44+ return mask;
45+}
--- /dev/null
+++ b/libc/signal/siggtmsk.c
@@ -0,0 +1,39 @@
1+/* Copyright (C) 1993 Free Software Foundation, Inc.
2+This file is part of the GNU C Library.
3+
4+The GNU C Library is free software; you can redistribute it and/or
5+modify it under the terms of the GNU Library General Public License as
6+published by the Free Software Foundation; either version 2 of the
7+License, or (at your option) any later version.
8+
9+The GNU C Library is distributed in the hope that it will be useful,
10+but WITHOUT ANY WARRANTY; without even the implied warranty of
11+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+Library General Public License for more details.
13+
14+You should have received a copy of the GNU Library General Public
15+License along with the GNU C Library; see the file COPYING.LIB. If
16+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17+Cambridge, MA 02139, USA. */
18+
19+#include <errno.h>
20+#define __USE_BSD
21+#include <signal.h>
22+
23+/* Get the mask of blocked signals. */
24+int siggetmask()
25+{
26+ sigset_t oset;
27+ register int sig;
28+ int mask;
29+
30+ if (sigprocmask(SIG_SETMASK, 0, &oset) < 0)
31+ return -1;
32+
33+ mask = 0;
34+ for (sig = 1; sig < NSIG; ++sig)
35+ if (sigismember(&oset, sig) == 1)
36+ mask |= sigmask(sig);
37+
38+ return mask;
39+}
--- /dev/null
+++ b/libc/signal/sigjmp.c
@@ -0,0 +1,35 @@
1+/* Copyright (C) 1992, 1994, 1997 Free Software Foundation, Inc.
2+ This file is part of the GNU C Library.
3+
4+ The GNU C Library is free software; you can redistribute it and/or
5+ modify it under the terms of the GNU Library General Public License as
6+ published by the Free Software Foundation; either version 2 of the
7+ License, or (at your option) any later version.
8+
9+ The GNU C Library is distributed in the hope that it will be useful,
10+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+ Library General Public License for more details.
13+
14+ You should have received a copy of the GNU Library General Public
15+ License along with the GNU C Library; see the file COPYING.LIB. If not,
16+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17+ Boston, MA 02111-1307, USA. */
18+
19+#include <stddef.h>
20+#include <setjmp.h>
21+#include <signal.h>
22+
23+/* This function is called by the `sigsetjmp' macro
24+ before doing a `__setjmp' on ENV[0].__jmpbuf.
25+ Always return zero. */
26+
27+int
28+__sigjmp_save (sigjmp_buf env, int savemask)
29+{
30+ env[0].__mask_was_saved = (savemask &&
31+ sigprocmask (SIG_BLOCK, (sigset_t *) NULL,
32+ &env[0].__saved_mask) == 0);
33+
34+ return 0;
35+}
--- /dev/null
+++ b/libc/signal/signal.c
@@ -0,0 +1,20 @@
1+#include <string.h>
2+#include <signal.h>
3+
4+__sighandler_t
5+__signal (int sig, __sighandler_t handler, int flags)
6+{
7+ int ret;
8+ struct sigaction action, oaction;
9+ memset(&action, 0, sizeof(struct sigaction));
10+ action.sa_handler = handler;
11+ action.sa_flags = flags;
12+ ret = sigaction (sig, &action, &oaction);
13+ return (ret == -1) ? SIG_ERR : oaction.sa_handler;
14+}
15+
16+__sighandler_t
17+signal (int sig, __sighandler_t handler)
18+{
19+ return __signal(sig, handler, (SA_ONESHOT | SA_NOMASK | SA_INTERRUPT) & ~SA_RESTART);
20+}
--- /dev/null
+++ b/libc/signal/sigpause.c
@@ -0,0 +1,37 @@
1+/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
2+This file is part of the GNU C Library.
3+
4+The GNU C Library is free software; you can redistribute it and/or
5+modify it under the terms of the GNU Library General Public License as
6+published by the Free Software Foundation; either version 2 of the
7+License, or (at your option) any later version.
8+
9+The GNU C Library is distributed in the hope that it will be useful,
10+but WITHOUT ANY WARRANTY; without even the implied warranty of
11+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+Library General Public License for more details.
13+
14+You should have received a copy of the GNU Library General Public
15+License along with the GNU C Library; see the file COPYING.LIB. If
16+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17+Cambridge, MA 02139, USA. */
18+
19+#include <errno.h>
20+#include <signal.h>
21+
22+#undef sigpause
23+
24+/* Set the mask of blocked signals to MASK,
25+ wait for a signal to arrive, and then restore the mask. */
26+int sigpause(int mask)
27+{
28+ sigset_t set;
29+ int sig;
30+
31+ sigemptyset(&set);
32+ for (sig = 1; sig < NSIG; ++sig)
33+ if (mask & sigmask(sig))
34+ sigaddset(&set, sig);
35+
36+ return sigsuspend (&set);
37+}
--- /dev/null
+++ b/libc/signal/sigstmsk.c
@@ -0,0 +1,46 @@
1+/* Copyright (C) 1993 Free Software Foundation, Inc.
2+This file is part of the GNU C Library.
3+
4+The GNU C Library is free software; you can redistribute it and/or
5+modify it under the terms of the GNU Library General Public License as
6+published by the Free Software Foundation; either version 2 of the
7+License, or (at your option) any later version.
8+
9+The GNU C Library is distributed in the hope that it will be useful,
10+but WITHOUT ANY WARRANTY; without even the implied warranty of
11+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+Library General Public License for more details.
13+
14+You should have received a copy of the GNU Library General Public
15+License along with the GNU C Library; see the file COPYING.LIB. If
16+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17+Cambridge, MA 02139, USA. */
18+
19+#include <errno.h>
20+#define __USE_BSD
21+#include <signal.h>
22+
23+/* Set the mask of blocked signals to MASK, returning the old mask. */
24+int sigsetmask (int mask)
25+{
26+ register int sig;
27+ sigset_t set, oset;
28+
29+ if (sigemptyset(&set) < 0)
30+ return -1;
31+
32+ for (sig = 1; sig < NSIG; ++sig)
33+ if ((mask & sigmask(sig)) &&
34+ sigaddset(&set, sig) < 0)
35+ return -1;
36+
37+ if (sigprocmask(SIG_SETMASK, &set, &oset) < 0)
38+ return -1;
39+
40+ mask = 0;
41+ for (sig = 1; sig < NSIG; ++sig)
42+ if (sigismember(&oset, sig) == 1)
43+ mask |= sigmask(sig);
44+
45+ return mask;
46+}
--- a/libc/string/Makefile
+++ b/libc/string/Makefile
@@ -34,7 +34,7 @@ MOBJ1=index.o rindex.o
3434
3535 CSRC=strpbrk.c strsep.c strstr.c strtok.c strcspn.c config.c strspn.c \
3636 strcasecmp.c strncasecmp.c strerror.c bcopy.c bzero.c bcmp.c \
37- strsignal.c
37+ strsignal.c sys_errlist.c
3838 COBJS=$(patsubst %.c,%.o, $(CSRC))
3939 OBJS=$(MOBJ) $(MOBJ1) $(COBJS)
4040
--- a/libc/string/strsignal.c
+++ b/libc/string/strsignal.c
@@ -8,7 +8,7 @@
88 #include <malloc.h>
99 #include <signal.h>
1010
11-const char *const sys_siglist[NSIG] = {
11+const char *const sys_siglist[] = {
1212 "Unknown signal",
1313 "Hangup",
1414 "Interrupt",
@@ -32,20 +32,21 @@ const char *const sys_siglist[NSIG] = {
3232 "Stopped",
3333 "Stopped (tty input)",
3434 "Stopped (tty output)",
35- "Possible I/O",
35+ "Urgent condition",
3636 "CPU time limit exceeded",
3737 "File size limit exceeded",
3838 "Virtual time alarm",
3939 "Profile signal",
4040 "Window size changed",
41- "File lock lost",
41+ "Possible I/O",
4242 "Power failure",
43- "Unused signal"
43+ "Unused signal",
44+ NULL
4445 };
4546
4647 /********************** Function strsignal ************************************/
4748
48-char *strsignal (int sig)
49+char *strsignal(int sig)
4950 {
5051 static char retbuf[80];
5152
--- /dev/null
+++ b/libc/string/sys_errlist.c
@@ -0,0 +1,140 @@
1+#include <stddef.h>
2+#if 0
3+#include <errno.h>
4+#endif
5+
6+/* This is a list of all known signal numbers. */
7+
8+const char * const sys_errlist[] = {
9+ "Success", /* 0 */
10+ "Operation not permitted", /* EPERM */
11+ "No such file or directory", /* ENOENT */
12+ "No such process", /* ESRCH */
13+ "Interrupted system call", /* EINTR */
14+ "I/O error", /* EIO */
15+ "No such device or address", /* ENXIO */
16+ "Arg list too long", /* E2BIG */
17+ "Exec format error", /* ENOEXEC */
18+ "Bad file number", /* EBADF */
19+ "No child processes", /* ECHILD */
20+ "Try again", /* EAGAIN */
21+ "Out of memory", /* ENOMEM */
22+ "Permission denied", /* EACCES */
23+ "Bad address", /* EFAULT */
24+ "Block device required", /* ENOTBLK */
25+ "Device or resource busy", /* EBUSY */
26+ "File exists", /* EEXIST */
27+ "Cross-device link", /* EXDEV */
28+ "No such device", /* ENODEV */
29+ "Not a directory", /* ENOTDIR */
30+ "Is a directory", /* EISDIR */
31+ "Invalid argument", /* EINVAL */
32+ "File table overflow", /* ENFILE */
33+ "Too many open files", /* EMFILE */
34+ "Not a typewriter", /* ENOTTY */
35+ "Text file busy", /* ETXTBSY */
36+ "File too large", /* EFBIG */
37+ "No space left on device", /* ENOSPC */
38+ "Illegal seek", /* ESPIPE */
39+ "Read-only file system", /* EROFS */
40+ "Too many links", /* EMLINK */
41+ "Broken pipe", /* EPIPE */
42+ "Math argument out of domain of func", /* EDOM */
43+ "Math result not representable", /* ERANGE */
44+ "Resource deadlock would occur", /* EDEADLK */
45+ "File name too long", /* ENAMETOOLONG */
46+ "No record locks available", /* ENOLCK */
47+ "Function not implemented", /* ENOSYS */
48+ "Directory not empty", /* ENOTEMPTY */
49+ "Too many symbolic links encountered", /* ELOOP */
50+ "Operation would block", /* EWOULDBLOCK */
51+ "No message of desired type", /* ENOMSG */
52+ "Identifier removed", /* EIDRM */
53+ "Channel number out of range", /* ECHRNG */
54+ "Level 2 not synchronized", /* EL2NSYNC */
55+ "Level 3 halted", /* EL3HLT */
56+ "Level 3 reset", /* EL3RST */
57+ "Link number out of range", /* ELNRNG */
58+ "Protocol driver not attached", /* EUNATCH */
59+ "No CSI structure available", /* ENOCSI */
60+ "Level 2 halted", /* EL2HLT */
61+ "Invalid exchange", /* EBADE */
62+ "Invalid request descriptor", /* EBADR */
63+ "Exchange full", /* EXFULL */
64+ "No anode", /* ENOANO */
65+ "Invalid request code", /* EBADRQC */
66+ "Invalid slot", /* EBADSLT */
67+ "File locking deadlock error", /* EDEADLOCK */
68+ "Bad font file format", /* EBFONT */
69+ "Device not a stream", /* ENOSTR */
70+ "No data available", /* ENODATA */
71+ "Timer expired", /* ETIME */
72+ "Out of streams resources", /* ENOSR */
73+ "Machine is not on the network", /* ENONET */
74+ "Package not installed", /* ENOPKG */
75+ "Object is remote", /* EREMOTE */
76+ "Link has been severed", /* ENOLINK */
77+ "Advertise error", /* EADV */
78+ "Srmount error", /* ESRMNT */
79+ "Communication error on send", /* ECOMM */
80+ "Protocol error", /* EPROTO */
81+ "Multihop attempted", /* EMULTIHOP */
82+ "RFS specific error", /* EDOTDOT */
83+ "Not a data message", /* EBADMSG */
84+ "Value too large for defined data type", /* EOVERFLOW */
85+ "Name not unique on network", /* ENOTUNIQ */
86+ "File descriptor in bad state", /* EBADFD */
87+ "Remote address changed", /* EREMCHG */
88+ "Can not access a needed shared library", /* ELIBACC */
89+ "Accessing a corrupted shared library", /* ELIBBAD */
90+ ".lib section in a.out corrupted", /* ELIBSCN */
91+ "Attempting to link in too many shared libraries", /* ELIBMAX */
92+ "Cannot exec a shared library directly", /* ELIBEXEC */
93+ "Illegal byte sequence", /* EILSEQ */
94+ "Interrupted system call should be restarted", /* ERESTART */
95+ "Streams pipe error", /* ESTRPIPE */
96+ "Too many users", /* EUSERS */
97+ "Socket operation on non-socket", /* ENOTSOCK */
98+ "Destination address required", /* EDESTADDRREQ */
99+ "Message too long", /* EMSGSIZE */
100+ "Protocol wrong type for socket", /* EPROTOTYPE */
101+ "Protocol not available", /* ENOPROTOOPT */
102+ "Protocol not supported", /* EPROTONOSUPPORT */
103+ "Socket type not supported", /* ESOCKTNOSUPPORT */
104+ "Operation not supported on transport endpoint", /* EOPNOTSUPP */
105+ "Protocol family not supported", /* EPFNOSUPPORT */
106+ "Address family not supported by protocol", /* EAFNOSUPPORT */
107+ "Address already in use", /* EADDRINUSE */
108+ "Cannot assign requested address", /* EADDRNOTAVAIL */
109+ "Network is down", /* ENETDOWN */
110+ "Network is unreachable", /* ENETUNREACH */
111+ "Network dropped connection because of reset", /* ENETRESET */
112+ "Software caused connection abort", /* ECONNABORTED */
113+ "Connection reset by peer", /* ECONNRESET */
114+ "No buffer space available", /* ENOBUFS */
115+ "Transport endpoint is already connected", /* EISCONN */
116+ "Transport endpoint is not connected", /* ENOTCONN */
117+ "Cannot send after transport endpoint shutdown", /* ESHUTDOWN */
118+ "Too many references: cannot splice", /* ETOOMANYREFS */
119+ "Connection timed out", /* ETIMEDOUT */
120+ "Connection refused", /* ECONNREFUSED */
121+ "Host is down", /* EHOSTDOWN */
122+ "No route to host", /* EHOSTUNREACH */
123+ "Operation already in progress", /* EALREADY */
124+ "Operation now in progress", /* EINPROGRESS */
125+ "Stale NFS file handle", /* ESTALE */
126+ "Structure needs cleaning", /* EUCLEAN */
127+ "Not a XENIX named type file", /* ENOTNAM */
128+ "No XENIX semaphores available", /* ENAVAIL */
129+ "Is a named type file", /* EISNAM */
130+ "Remote I/O error", /* EREMOTEIO */
131+ "Quota exceeded", /* EDQUOT */
132+ "No medium found", /* ENOMEDIUM */
133+ "Wrong medium type", /* EMEDIUMTYPE */
134+ NULL
135+};
136+
137+
138+#define NR_ERRORS ((sizeof (sys_errlist))/(sizeof(char *))-1)
139+
140+const int sys_nerr = NR_ERRORS;
--- a/libc/sysdeps/linux/common/setegid.c
+++ b/libc/sysdeps/linux/common/setegid.c
@@ -2,5 +2,5 @@
22
33 int setegid(gid_t gid)
44 {
5- return __setregid(-1, gid);
5+ return setregid(-1, gid);
66 }
--- a/libc/sysdeps/linux/common/waitpid.c
+++ /dev/null
@@ -1,10 +0,0 @@
1-#include <syscall.h>
2-#include <sys/types.h>
3-#include <sys/wait.h>
4-#include <sys/resource.h>
5-
6-__pid_t
7-waitpid(__pid_t pid, int *wait_stat, int options)
8-{
9- return wait4(pid, (__WAIT_STATUS) wait_stat, options, NULL);
10-}