]> Zhao Yanbai Git Server - minix.git/commitdiff
Removed socket library, there is a socket library in libc now
authorBen Gras <ben@minix3.org>
Wed, 3 Aug 2005 11:35:41 +0000 (11:35 +0000)
committerBen Gras <ben@minix3.org>
Wed, 3 Aug 2005 11:35:41 +0000 (11:35 +0000)
lib/Makefile
lib/socket/Makefile [deleted file]
lib/socket/bind.c [deleted file]
lib/socket/connect.c [deleted file]
lib/socket/extra.c [deleted file]
lib/socket/listen.c [deleted file]
lib/socket/shutdown.c [deleted file]
lib/socket/socket.c [deleted file]

index f5bd6c3fb5c025fcc68dbaac78a2ae288ff586ee..125be1f58c62ed31e2272641315cbf561fb4036b 100755 (executable)
@@ -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 (file)
index ac99b76..0000000
+++ /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 (file)
index 3ad6661..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-
-/* bsd-socket(2)-lookalike */
-
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <net/ioctl.h>
-#include <net/gen/socket.h>
-#include <net/gen/emu.h>
-#include <net/gen/tcp.h>
-#include <net/gen/in.h>
-#include <net/gen/tcp_hdr.h>
-#include <net/gen/tcp_io.h>
-
-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 (file)
index c794eb1..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-
-/* bsd-socket(2)-lookalike */
-
-#include <errno.h>
-#include <string.h>
-#include <sys/types.h>
-#include <net/ioctl.h>
-#include <net/gen/in.h>
-#include <net/gen/socket.h>
-#include <net/gen/emu.h>
-#include <net/gen/tcp.h>
-#include <net/gen/tcp_hdr.h>
-#include <net/gen/tcp_io.h>
-
-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 (file)
index c51fdec..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-
-/* bsd-socket(2)-lookalike */
-
-#include <errno.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <net/gen/socket.h>
-#include <net/gen/emu.h>
-#include <net/gen/tcp.h>
-#include <net/gen/in.h>
-#include <net/gen/tcp_hdr.h>
-#include <net/gen/tcp_io.h>
-
-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 (file)
index ab271d0..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-
-/* bsd-socket(2)-lookalike */
-
-#include <sys/types.h>
-#include <net/gen/socket.h>
-#include <net/gen/in.h>
-#include <net/ioctl.h>
-#include <net/gen/emu.h>
-#include <net/gen/tcp.h>
-#include <net/gen/tcp_hdr.h>
-#include <net/gen/tcp_io.h>
-
-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 (file)
index c65034a..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-
-/* bsd-socket(2)-lookalike */
-
-#include <errno.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <net/gen/socket.h>
-#include <net/gen/emu.h>
-#include <net/gen/tcp.h>
-#include <net/gen/in.h>
-#include <net/gen/tcp_hdr.h>
-#include <net/gen/tcp_io.h>
-
-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 (file)
index a064380..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-
-/* bsd-socket(2)-lookalike */
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <net/gen/socket.h>
-#include <net/gen/emu.h>
-#include <net/gen/tcp.h>
-#include <net/gen/in.h>
-#include <net/gen/tcp_hdr.h>
-#include <net/gen/tcp_io.h>
-
-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;
-}
-