about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/network/accept.c4
-rw-r--r--src/network/bind.c4
-rw-r--r--src/network/connect.c4
-rw-r--r--src/network/getpeername.c4
-rw-r--r--src/network/getsockname.c4
-rw-r--r--src/network/getsockopt.c8
-rw-r--r--src/network/listen.c4
-rw-r--r--src/network/recv.c8
-rw-r--r--src/network/recvfrom.c7
-rw-r--r--src/network/recvmsg.c4
-rw-r--r--src/network/send.c8
-rw-r--r--src/network/sendmsg.c4
-rw-r--r--src/network/sendto.c7
-rw-r--r--src/network/setsockopt.c4
-rw-r--r--src/network/shutdown.c4
-rw-r--r--src/network/sockatmark.c1
-rw-r--r--src/network/socket.c4
-rw-r--r--src/network/socketcall.h24
-rw-r--r--src/network/socketpair.c4
19 files changed, 17 insertions, 94 deletions
diff --git a/src/network/accept.c b/src/network/accept.c
index 83704096..46adff5c 100644
--- a/src/network/accept.c
+++ b/src/network/accept.c
@@ -1,14 +1,12 @@
 #include <sys/socket.h>
 #include "syscall.h"
-#include "socketcall.h"
 #include "libc.h"
 
 int accept(int fd, struct sockaddr *addr, socklen_t *len)
 {
-	unsigned long args[] = { fd, (unsigned long)addr, (unsigned long)len };
 	int ret;
 	CANCELPT_BEGIN;
-	ret = syscall2(__NR_socketcall, SYS_ACCEPT, (long)args);
+	ret = socketcall(accept, fd, addr, len, 0, 0, 0);
 	CANCELPT_END;
 	return ret;
 }
diff --git a/src/network/bind.c b/src/network/bind.c
index 3bef382c..07bb669a 100644
--- a/src/network/bind.c
+++ b/src/network/bind.c
@@ -1,9 +1,7 @@
 #include <sys/socket.h>
 #include "syscall.h"
-#include "socketcall.h"
 
 int bind(int fd, const struct sockaddr *addr, socklen_t len)
 {
-	unsigned long args[] = { fd, (unsigned long)addr, len };
-	return syscall2(__NR_socketcall, SYS_BIND, (long)args);
+	return socketcall(bind, fd, addr, len, 0, 0, 0);
 }
diff --git a/src/network/connect.c b/src/network/connect.c
index 6074122e..29bffbcb 100644
--- a/src/network/connect.c
+++ b/src/network/connect.c
@@ -1,14 +1,12 @@
 #include <sys/socket.h>
 #include "syscall.h"
-#include "socketcall.h"
 #include "libc.h"
 
 int connect(int fd, const struct sockaddr *addr, socklen_t len)
 {
-	unsigned long args[] = { fd, (unsigned long)addr, len };
 	int ret;
 	CANCELPT_BEGIN;
-	ret = syscall2(__NR_socketcall, SYS_CONNECT, (long)args);
+	ret = socketcall(connect, fd, addr, len, 0, 0, 0);
 	CANCELPT_END;
 	return ret;
 }
diff --git a/src/network/getpeername.c b/src/network/getpeername.c
index 7ecbe375..22effdae 100644
--- a/src/network/getpeername.c
+++ b/src/network/getpeername.c
@@ -1,9 +1,7 @@
 #include <sys/socket.h>
 #include "syscall.h"
-#include "socketcall.h"
 
 int getpeername(int fd, struct sockaddr *addr, socklen_t *len)
 {
-	unsigned long args[] = { fd, (unsigned long)addr, (unsigned long)len };
-	return syscall2(__NR_socketcall, SYS_GETPEERNAME, (long)args);
+	return socketcall(getpeername, fd, addr, len, 0, 0, 0);
 }
diff --git a/src/network/getsockname.c b/src/network/getsockname.c
index 4b1002f8..271e3b41 100644
--- a/src/network/getsockname.c
+++ b/src/network/getsockname.c
@@ -1,9 +1,7 @@
 #include <sys/socket.h>
 #include "syscall.h"
-#include "socketcall.h"
 
 int getsockname(int fd, struct sockaddr *addr, socklen_t *len)
 {
-	unsigned long args[] = { fd, (unsigned long)addr, (unsigned long)len };
-	return syscall2(__NR_socketcall, SYS_GETSOCKNAME, (long)args);
+	return socketcall(getsockname, fd, addr, len, 0, 0, 0);
 }
diff --git a/src/network/getsockopt.c b/src/network/getsockopt.c
index 8c818863..a9e0a72d 100644
--- a/src/network/getsockopt.c
+++ b/src/network/getsockopt.c
@@ -1,13 +1,7 @@
 #include <sys/socket.h>
 #include "syscall.h"
-#include "socketcall.h"
 
 int getsockopt(int fd, int level, int optname, void *optval, socklen_t *optlen)
 {
-	unsigned long args[] = {
-		fd, level, optname,
-		(unsigned long)optval,
-		(unsigned long)optlen
-	};
-	return syscall2(__NR_socketcall, SYS_GETSOCKOPT, (long)args);
+	return socketcall(getsockopt, fd, level, optname, optval, optlen, 0);
 }
diff --git a/src/network/listen.c b/src/network/listen.c
index 7c8c1a8a..f84ad03b 100644
--- a/src/network/listen.c
+++ b/src/network/listen.c
@@ -1,9 +1,7 @@
 #include <sys/socket.h>
 #include "syscall.h"
-#include "socketcall.h"
 
 int listen(int fd, int backlog)
 {
-	unsigned long args[] = { fd, backlog };
-	return syscall2(__NR_socketcall, SYS_LISTEN, (long)args);
+	return socketcall(listen, fd, backlog, 0, 0, 0, 0);
 }
diff --git a/src/network/recv.c b/src/network/recv.c
index 521a4b19..d04a54aa 100644
--- a/src/network/recv.c
+++ b/src/network/recv.c
@@ -1,14 +1,8 @@
 #include <sys/socket.h>
 #include "syscall.h"
-#include "socketcall.h"
 #include "libc.h"
 
 ssize_t recv(int fd, void *buf, size_t len, int flags)
 {
-	unsigned long args[] = { fd, (unsigned long)buf, len, flags };
-	ssize_t r;
-	CANCELPT_BEGIN;
-	r = syscall2(__NR_socketcall, SYS_RECV, (long)args);
-	CANCELPT_END;
-	return r;
+	return recvfrom(fd, buf, len, flags, 0, 0);
 }
diff --git a/src/network/recvfrom.c b/src/network/recvfrom.c
index df50114b..d5222932 100644
--- a/src/network/recvfrom.c
+++ b/src/network/recvfrom.c
@@ -1,17 +1,12 @@
 #include <sys/socket.h>
 #include "syscall.h"
-#include "socketcall.h"
 #include "libc.h"
 
 ssize_t recvfrom(int fd, void *buf, size_t len, int flags, struct sockaddr *addr, socklen_t *alen)
 {
-	unsigned long args[] = {
-		fd, (unsigned long)buf, len, flags,
-		(unsigned long)addr, (unsigned long)alen
-	};
 	ssize_t r;
 	CANCELPT_BEGIN;
-	r = syscall2(__NR_socketcall, SYS_RECVFROM, (long)args);
+	r = socketcall(recvfrom, fd, buf, len, flags, addr, alen);
 	CANCELPT_END;
 	return r;
 }
diff --git a/src/network/recvmsg.c b/src/network/recvmsg.c
index ead16f9c..edc5f241 100644
--- a/src/network/recvmsg.c
+++ b/src/network/recvmsg.c
@@ -1,14 +1,12 @@
 #include <sys/socket.h>
 #include "syscall.h"
-#include "socketcall.h"
 #include "libc.h"
 
 ssize_t recvmsg(int fd, struct msghdr *msg, int flags)
 {
-	unsigned long args[] = { fd, (unsigned long)msg, flags };
 	ssize_t r;
 	CANCELPT_BEGIN;
-	r = syscall2(__NR_socketcall, SYS_RECVMSG, (long)args);
+	r = socketcall(recvmsg, fd, msg, flags, 0, 0, 0);
 	CANCELPT_END;
 	return r;
 }
diff --git a/src/network/send.c b/src/network/send.c
index d72fb03c..b6ec3101 100644
--- a/src/network/send.c
+++ b/src/network/send.c
@@ -1,14 +1,8 @@
 #include <sys/socket.h>
 #include "syscall.h"
-#include "socketcall.h"
 #include "libc.h"
 
 ssize_t send(int fd, const void *buf, size_t len, int flags)
 {
-	unsigned long args[] = { fd, (unsigned long)buf, len, flags };
-	ssize_t r;
-	CANCELPT_BEGIN;
-	r = syscall2(__NR_socketcall, SYS_SEND, (long)args);
-	CANCELPT_END;
-	return r;
+	return sendto(fd, buf, len, flags, 0, 0);
 }
diff --git a/src/network/sendmsg.c b/src/network/sendmsg.c
index ea2fe482..5d1123f0 100644
--- a/src/network/sendmsg.c
+++ b/src/network/sendmsg.c
@@ -1,14 +1,12 @@
 #include <sys/socket.h>
 #include "syscall.h"
-#include "socketcall.h"
 #include "libc.h"
 
 ssize_t sendmsg(int fd, const struct msghdr *msg, int flags)
 {
-	unsigned long args[] = { fd, (unsigned long)msg, flags };
 	ssize_t r;
 	CANCELPT_BEGIN;
-	r = syscall2(__NR_socketcall, SYS_SENDMSG, (long)args);
+	r = socketcall(sendmsg, fd, msg, flags, 0, 0, 0);
 	CANCELPT_END;
 	return r;
 }
diff --git a/src/network/sendto.c b/src/network/sendto.c
index 5d224b0b..1cfc621d 100644
--- a/src/network/sendto.c
+++ b/src/network/sendto.c
@@ -1,17 +1,12 @@
 #include <sys/socket.h>
 #include "syscall.h"
-#include "socketcall.h"
 #include "libc.h"
 
 ssize_t sendto(int fd, const void *buf, size_t len, int flags, const struct sockaddr *addr, socklen_t alen)
 {
-	unsigned long args[] = {
-		fd, (unsigned long)buf, len, flags,
-		(unsigned long)addr, alen
-	};
 	ssize_t r;
 	CANCELPT_BEGIN;
-	r = syscall2(__NR_socketcall, SYS_SENDTO, (long)args);
+	r = socketcall(sendto, fd, buf, len, flags, addr, alen);
 	CANCELPT_END;
 	return r;
 }
diff --git a/src/network/setsockopt.c b/src/network/setsockopt.c
index b50303b8..c960c9ca 100644
--- a/src/network/setsockopt.c
+++ b/src/network/setsockopt.c
@@ -1,9 +1,7 @@
 #include <sys/socket.h>
 #include "syscall.h"
-#include "socketcall.h"
 
 int setsockopt(int fd, int level, int optname, const void *optval, socklen_t optlen)
 {
-	unsigned long args[] = { fd, level, optname, (unsigned long)optval, optlen };
-	return syscall2(__NR_socketcall, SYS_SETSOCKOPT, (long)args);
+	return socketcall(setsockopt, fd, level, optname, optval, optlen, 0);
 }
diff --git a/src/network/shutdown.c b/src/network/shutdown.c
index 91950c8a..10ca21aa 100644
--- a/src/network/shutdown.c
+++ b/src/network/shutdown.c
@@ -1,9 +1,7 @@
 #include <sys/socket.h>
 #include "syscall.h"
-#include "socketcall.h"
 
 int shutdown(int fd, int how)
 {
-	unsigned long args[] = { fd, how };
-	return syscall2(__NR_socketcall, SYS_SHUTDOWN, (long)args);
+	return socketcall(shutdown, fd, how, 0, 0, 0, 0);
 }
diff --git a/src/network/sockatmark.c b/src/network/sockatmark.c
index 5328a855..f474551a 100644
--- a/src/network/sockatmark.c
+++ b/src/network/sockatmark.c
@@ -1,6 +1,5 @@
 #include <sys/socket.h>
 #include <sys/ioctl.h>
-#include "socketcall.h"
 
 int sockatmark(int s)
 {
diff --git a/src/network/socket.c b/src/network/socket.c
index afaeb411..4f1e86db 100644
--- a/src/network/socket.c
+++ b/src/network/socket.c
@@ -1,9 +1,7 @@
 #include <sys/socket.h>
 #include "syscall.h"
-#include "socketcall.h"
 
 int socket(int domain, int type, int protocol)
 {
-	unsigned long args[] = { domain, type, protocol };
-	return syscall2(__NR_socketcall, SYS_SOCKET, (long)args);
+	return socketcall(socket, domain, type, protocol, 0, 0, 0);
 }
diff --git a/src/network/socketcall.h b/src/network/socketcall.h
deleted file mode 100644
index 9ae98587..00000000
--- a/src/network/socketcall.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#define SYS_SOCKET      1
-#define SYS_BIND        2
-#define SYS_CONNECT     3
-#define SYS_LISTEN      4
-#define SYS_ACCEPT      5
-#define SYS_GETSOCKNAME 6
-#define SYS_GETPEERNAME 7
-#define SYS_SOCKETPAIR  8
-#define SYS_SEND        9
-#define SYS_RECV        10
-#define SYS_SENDTO      11
-#define SYS_RECVFROM    12
-#define SYS_SHUTDOWN    13
-#define SYS_SETSOCKOPT  14
-#define SYS_GETSOCKOPT  15
-#define SYS_SENDMSG     16
-#define SYS_RECVMSG     17
-
-#define FIOSETOWN       0x8901
-#define SIOCSPGRP       0x8902
-#define FIOGETOWN       0x8903
-#define SIOCGPGRP       0x8904
-#define SIOCATMARK      0x8905
-#define SIOCGSTAMP      0x8906
diff --git a/src/network/socketpair.c b/src/network/socketpair.c
index 65a47fd9..b15f8467 100644
--- a/src/network/socketpair.c
+++ b/src/network/socketpair.c
@@ -1,9 +1,7 @@
 #include <sys/socket.h>
 #include "syscall.h"
-#include "socketcall.h"
 
 int socketpair(int domain, int type, int protocol, int fd[2])
 {
-	unsigned long args[] = { domain, type, protocol, (unsigned long)fd };
-	return syscall2(__NR_socketcall, SYS_SOCKETPAIR, (long)args);
+	return socketcall(socketpair, domain, type, protocol, fd, 0, 0);
 }