test `arch` = i86 || { cd regex && $(MAKE); }
cd rts && $(MAKE)
cd stdio && $(MAKE)
- #cd socket && $(MAKE)
cd syscall && $(MAKE)
cd syslib && $(MAKE)
cd util && $(MAKE)
$(LIB386)/libcurses.a \
$(LIB386)/libedit.a \
$(LIB386)/liby.a \
-# $(LIB386)/libsocket.a \
# $(LIB86)/libc.a \
# $(LIB86)/end.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 $? $@
#
+++ /dev/null
-
-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)
+++ /dev/null
-
-/* 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;
-}
-
+++ /dev/null
-
-/* 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;
-}
-
+++ /dev/null
-
-/* 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);
-}
-
+++ /dev/null
-
-/* 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;
-}
-
+++ /dev/null
-
-/* 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;
-}
-
+++ /dev/null
-
-/* 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;
-}
-