From f93fc0b75a50d3ba8d4d69313e3c84ac0b62905b Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 3 Dec 2008 04:23:18 +0000 Subject: * socket/sys/socket.h: Declare accept4. * socket/accept4.c: New file. * sysdeps/unix/sysv/linux/accept4.c: New file. * sysdeps/unix/sysv/linux/i386/accept4.S: New file. * socket/Makefile (routines): Add accept4. * socket/Versions: Export accept4 with version GLIBC_2.10. * socket/paccept.c: Removed. * sysdeps/unix/sysv/linux/paccept.c: Removed. * sysdeps/unix/sysv/linux/i386/paccept.S: Removed. * Versions.def: Define GLIBC_2.10 for libc. * sysdeps/unix/sysv/linux/kernel-features.h: Define __ASSUME_ACCEPT4. * nscd/connections.c: Use accept4. * sysdeps/unix/sysv/linux/i386/socket.S: Fix comment. --- socket/Makefile | 2 +- socket/Versions | 3 +++ socket/accept4.c | 42 ++++++++++++++++++++++++++++++++++++++++++ socket/paccept.c | 43 ------------------------------------------- socket/sys/socket.h | 9 +++++++++ 5 files changed, 55 insertions(+), 44 deletions(-) create mode 100644 socket/accept4.c delete mode 100644 socket/paccept.c (limited to 'socket') diff --git a/socket/Makefile b/socket/Makefile index 92a8707..0e242b5 100644 --- a/socket/Makefile +++ b/socket/Makefile @@ -27,7 +27,7 @@ headers := sys/socket.h sys/un.h bits/sockaddr.h bits/socket.h \ routines := accept bind connect getpeername getsockname getsockopt \ listen recv recvfrom recvmsg send sendmsg sendto \ setsockopt shutdown socket socketpair isfdtype opensock \ - sockatmark + sockatmark accept4 aux := have_sock_cloexec diff --git a/socket/Versions b/socket/Versions index d282eff..7a96b1e 100644 --- a/socket/Versions +++ b/socket/Versions @@ -31,4 +31,7 @@ libc { # Addition from P1003.1-200x sockatmark; } + GLIBC_2.10 { + accept4; + } } diff --git a/socket/accept4.c b/socket/accept4.c new file mode 100644 index 0000000..40709d5 --- /dev/null +++ b/socket/accept4.c @@ -0,0 +1,42 @@ +/* Copyright (C) 2008 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + +/* Await a connection on socket FD. + When a connection arrives, open a new socket to communicate with it, + set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting + peer and *ADDR_LEN to the address's actual length, and return the + new socket's descriptor, or -1 for errors. The operation can be influenced + by the FLAGS parameter. */ +int +accept4 (fd, addr, addr_len, flags) + int fd; + __SOCKADDR_ARG addr; + socklen_t *addr_len; + int flags; +{ + __set_errno (ENOSYS); + return -1; +} +libc_hidden_def (accept4) + + +stub_warning (accept4) +#include diff --git a/socket/paccept.c b/socket/paccept.c deleted file mode 100644 index 777dd8c..0000000 --- a/socket/paccept.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright (C) 2008 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include -#include - -/* Await a connection on socket FD. - When a connection arrives, open a new socket to communicate with it, - set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting - peer and *ADDR_LEN to the address's actual length, and return the - new socket's descriptor, or -1 for errors. SS is installed as - the thread's signal mask and FLAGS are additional flags. */ -int -paccept (fd, addr, addr_len, ss, flags) - int fd; - __SOCKADDR_ARG addr; - socklen_t *addr_len; - const __sigset_t *ss; - int flags; -{ - __set_errno (ENOSYS); - return -1; -} -libc_hidden_def (paccept) - - -stub_warning (paccept) -#include diff --git a/socket/sys/socket.h b/socket/sys/socket.h index e0a6a52..9b1f56f 100644 --- a/socket/sys/socket.h +++ b/socket/sys/socket.h @@ -214,6 +214,15 @@ extern int listen (int __fd, int __n) __THROW; extern int accept (int __fd, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len); +#ifdef __USE_GNU +/* Similar to 'accept' but takes an additional parameter to specify flags. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int accept4 (int __fd, __SOCKADDR_ARG __addr, + socklen_t *__restrict __addr_len, int __flags); +#endif + /* Shut down all or part of the connection open on socket FD. HOW determines what to shut down: SHUT_RD = No more receptions; -- cgit v1.1