summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Reding <thierry.reding@avionic-design.de>2011-05-11 08:40:58 +0200
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2011-05-11 10:04:20 +0200
commit46e3df937b05fa291470e975cd836c5435aa0ecc (patch)
treefcf66711425053b46dd25f431f0bb894b82f083b
parent7a080cd149c7b25d415d76506510d55b34819fc2 (diff)
Implement accept4 system call.
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-rw-r--r--libc/inet/accept.c1
-rw-r--r--libc/inet/socketcalls.c18
2 files changed, 19 insertions, 0 deletions
diff --git a/libc/inet/accept.c b/libc/inet/accept.c
index 0217a6876..b0fd2b2c6 100644
--- a/libc/inet/accept.c
+++ b/libc/inet/accept.c
@@ -5,4 +5,5 @@
*/
#define L_accept
+#define L_accept4
#include "socketcalls.c"
diff --git a/libc/inet/socketcalls.c b/libc/inet/socketcalls.c
index 42a5a563f..ff5fdaa30 100644
--- a/libc/inet/socketcalls.c
+++ b/libc/inet/socketcalls.c
@@ -31,6 +31,7 @@ extern int __socketcall(int call, unsigned long *args) attribute_hidden;
#define SYS_GETSOCKOPT 15
#define SYS_SENDMSG 16
#define SYS_RECVMSG 17
+#define SYS_ACCEPT4 18
#endif
#ifdef __UCLIBC_HAS_THREADS_NATIVE__
@@ -560,3 +561,20 @@ int socketpair(int family, int type, int protocol, int sockvec[2])
}
#endif
#endif
+
+#ifdef L_accept4
+#ifdef __NR_accept4
+_syscall4(int, accept4, int, sockfd, struct sockaddr *, addr, socklen_t *, addrlen, int, flags)
+#elif defined(__NR_socketcall)
+int accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags)
+{
+ unsigned long args[4];
+
+ args[0] = sockfd;
+ args[1] = (unsigned long) addr;
+ args[2] = (unsigned long) addrlen;
+ args[3] = flags;
+ return __socketcall(SYS_ACCEPT4, args);
+}
+#endif
+#endif