From: Ben Gras Date: Wed, 3 Aug 2005 11:35:41 +0000 (+0000) Subject: Removed socket library, there is a socket library in libc now X-Git-Tag: v3.1.0~467 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/migration-4to9?a=commitdiff_plain;h=5c9d34b62a98e4d5fd163abe42cd9ef487aaf313;p=minix.git Removed socket library, there is a socket library in libc now --- diff --git a/lib/Makefile b/lib/Makefile index f5bd6c3fb..125be1f58 100755 --- a/lib/Makefile +++ b/lib/Makefile @@ -30,7 +30,6 @@ all: test `arch` = i86 || { cd regex && $(MAKE); } cd rts && $(MAKE) cd stdio && $(MAKE) - #cd socket && $(MAKE) cd syscall && $(MAKE) cd syslib && $(MAKE) cd util && $(MAKE) @@ -144,7 +143,6 @@ install_i386: \ $(LIB386)/libcurses.a \ $(LIB386)/libedit.a \ $(LIB386)/liby.a \ -# $(LIB386)/libsocket.a \ # $(LIB86)/libc.a \ # $(LIB86)/end.a \ @@ -202,9 +200,6 @@ $(LIB386)/libedit.a: libedit.a $(LIB386)/liby.a: liby.a install -c -o bin $? $@ -#$(LIB386)/libsocket.a: libsocket.a -# install -c -o bin $? $@ -# #$(LIB86)/libc.a: libc86.a # install -c -o bin $? $@ # diff --git a/lib/socket/Makefile b/lib/socket/Makefile deleted file mode 100644 index ac99b763f..000000000 --- a/lib/socket/Makefile +++ /dev/null @@ -1,39 +0,0 @@ - -CFLAGS = -O -D_MINIX -D_POSIX_SOURCE -I../../servers -CC1 = $(CC) $(CFLAGS) -c - -LIBRARY = ../libsocket.a -all: $(LIBRARY) - -OBJECTS = \ - $(LIBRARY)(socket.o) \ - $(LIBRARY)(listen.o) \ - $(LIBRARY)(connect.o) \ - $(LIBRARY)(shutdown.o) \ - $(LIBRARY)(extra.o) \ - $(LIBRARY)(bind.o) - -$(LIBRARY): $(OBJECTS) - aal cr $@ *.o - rm *.o - -$(LIBRARY)(socket.o): socket.c - $(CC1) socket.c - -$(LIBRARY)(connect.o): connect.c - $(CC1) connect.c - -$(LIBRARY)(listen.o): listen.c - $(CC1) listen.c - -$(LIBRARY)(shutdown.o): shutdown.c - $(CC1) shutdown.c - -$(LIBRARY)(extra.o): extra.c - $(CC1) extra.c - -$(LIBRARY)(bind.o): bind.c - $(CC1) bind.c - -clean: - -rm *.o $(LIBRARY) diff --git a/lib/socket/bind.c b/lib/socket/bind.c deleted file mode 100644 index 3ad6661f1..000000000 --- a/lib/socket/bind.c +++ /dev/null @@ -1,34 +0,0 @@ - -/* bsd-socket(2)-lookalike */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -int -bind(int s, struct sockaddr *addr, socklen_t len) -{ - nwio_tcpconf_t tcpconf; - struct sockaddr_in *in_local; - - in_local = (struct sockaddr_in *) addr; - - memset(&tcpconf, 0, sizeof(tcpconf)); - tcpconf.nwtc_flags = NWTC_EXCL | NWTC_LP_SET | NWTC_UNSET_RA | NWTC_UNSET_RP; - tcpconf.nwtc_locport = in_local->sin_port; - - if(ioctl(s, NWIOSTCPCONF, &tcpconf) < 0) - return -1; - - return 0; -} - diff --git a/lib/socket/connect.c b/lib/socket/connect.c deleted file mode 100644 index c794eb177..000000000 --- a/lib/socket/connect.c +++ /dev/null @@ -1,46 +0,0 @@ - -/* bsd-socket(2)-lookalike */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -int -connect(int s, struct sockaddr *peer, socklen_t len) -{ - nwio_tcpcl_t tcpopt; - nwio_tcpconf_t tcpconf; - struct sockaddr_in *in_peer; - - if(!peer || peer->sa_family != AF_INET || - len != sizeof(struct sockaddr_in)) { - errno = EAFNOSUPPORT; - return -1; - } - - in_peer = (struct sockaddr_in *) peer; - - memset(&tcpconf, 0, sizeof(tcpconf)); - tcpconf.nwtc_flags = NWTC_EXCL | NWTC_LP_SEL | NWTC_SET_RA | NWTC_SET_RP; - tcpconf.nwtc_remaddr = in_peer->sin_addr.s_addr; - tcpconf.nwtc_remport = in_peer->sin_port; - - if(ioctl(s, NWIOSTCPCONF, &tcpconf) < 0) - return -1; - - tcpopt.nwtcl_flags = 0; - tcpopt.nwtcl_ttl = 0; - - if(ioctl(s, NWIOTCPCONN, &tcpopt) < 0) - return -1; - - return 0; -} - diff --git a/lib/socket/extra.c b/lib/socket/extra.c deleted file mode 100644 index c51fdec09..000000000 --- a/lib/socket/extra.c +++ /dev/null @@ -1,28 +0,0 @@ - -/* bsd-socket(2)-lookalike */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -ssize_t -recv(int s, void *buf, size_t len, int flags) -{ - return read(s, buf, len); -} - -ssize_t -send(int s, void *buf, size_t len, int flags) -{ - return write(s, buf, len); -} - diff --git a/lib/socket/listen.c b/lib/socket/listen.c deleted file mode 100644 index ab271d0a9..000000000 --- a/lib/socket/listen.c +++ /dev/null @@ -1,26 +0,0 @@ - -/* bsd-socket(2)-lookalike */ - -#include -#include -#include -#include -#include -#include -#include -#include - -int -listen(int s, int backlog) -{ - nwio_tcpcl_t tcpopt; - struct sockaddr_in *in_peer; - - tcpopt.nwtcl_flags = tcpopt.nwtcl_ttl = 0; - - if(ioctl(s, NWIOTCPLISTEN, &tcpopt) < 0) - return -1; - - return 0; -} - diff --git a/lib/socket/shutdown.c b/lib/socket/shutdown.c deleted file mode 100644 index c65034aff..000000000 --- a/lib/socket/shutdown.c +++ /dev/null @@ -1,26 +0,0 @@ - -/* bsd-socket(2)-lookalike */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -int -shutdown(int s, int how) -{ - nwio_tcpcl_t tcpopt; - - if(ioctl(s, NWIOTCPSHUTDOWN, NULL) < 0) - return -1; - - return 0; -} - diff --git a/lib/socket/socket.c b/lib/socket/socket.c deleted file mode 100644 index a064380c1..000000000 --- a/lib/socket/socket.c +++ /dev/null @@ -1,57 +0,0 @@ - -/* bsd-socket(2)-lookalike */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -int -socket(int domain, int type, int protocol) -{ - int s; - char *tcpname; - - /* only domain is AF_INET */ - if(domain != AF_INET) { - errno = EAFNOSUPPORT; - return -1; - } - - /* only type is SOCK_STREAM */ - if(type != SOCK_STREAM) { - errno = EPROTONOSUPPORT; - return -1; - } - - /* default protocol type is TCP */ - if(!protocol) - protocol = IPPROTO_TCP; - - /* only protocol type is TCP */ - if(protocol != IPPROTO_TCP) { - errno = EPROTONOSUPPORT; - return -1; - } - - /* tcp device name */ - if(!tcpname) - tcpname = getenv("TCP_DEVICE"); - if(!tcpname || !*tcpname) - tcpname = "/dev/tcp"; - - if((s = open(tcpname, O_RDWR)) < 0) { - perror(tcpname); - return -1; - } - - return s; -} -