1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-12-24 17:51:17 +03:00

Linux: Assume and consolidate getpeername wire-up syscall

And disable if kernel does not support it.

Checked on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
Adhemerval Zanella
2022-10-18 16:29:48 -03:00
parent a7bf5f4e69
commit 48d256dee7
10 changed files with 6 additions and 28 deletions

View File

@@ -15,19 +15,14 @@
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <errno.h>
#include <signal.h>
#include <sys/socket.h>
#include <socketcall.h>
#include <kernel-features.h>
#include <sys/syscall.h>
int
__getpeername (int fd, __SOCKADDR_ARG addr, socklen_t *len)
{
#ifdef __ASSUME_GETPEERNAME_SYSCALL
return INLINE_SYSCALL (getpeername, 3, fd, addr.__sockaddr__, len);
return INLINE_SYSCALL_CALL (getpeername, fd, addr.__sockaddr__, len);
#else
return SOCKETCALL (getpeername, fd, addr.__sockaddr__, len);
#endif