int accept4 (int fd, __SOCKADDR_ARG addr, socklen_t *addr_len, int flags) { if (__glibc_likely (have_accept4 >= 0)) { int ret = SOCKETCALL_CANCEL (accept4, fd, addr.__sockaddr__, addr_len, flags); /* The kernel returns -EINVAL for unknown socket operations. We need to convert that error to an ENOSYS error. */ if (__builtin_expect (ret < 0, 0) && have_accept4 == 0 && errno == EINVAL) { /* Try another call, this time with the FLAGS parameter cleared and an invalid file descriptor. This call will not cause any harm and it will return immediately. */ ret = SOCKETCALL_CANCEL (invalid, -1); if (errno == EINVAL) { have_accept4 = -1; __set_errno (ENOSYS); } else { have_accept4 = 1; __set_errno (EINVAL); } return -1; } return ret; } __set_errno (ENOSYS); return -1; }
ssize_t __libc_sendto (int fd, const void *buf, size_t len, int flags, __CONST_SOCKADDR_ARG addr, socklen_t addrlen) { return SOCKETCALL_CANCEL (sendto, fd, buf, len, flags, addr.__sockaddr__, addrlen); }
int accept4 (int fd, __SOCKADDR_ARG addr, socklen_t *addr_len, int flags) { #ifdef __ASSUME_ACCEPT4_SYSCALL return SYSCALL_CANCEL (accept4, fd, addr.__sockaddr__, addr_len, flags); #else return SOCKETCALL_CANCEL (accept4, fd, addr.__sockaddr__, addr_len, flags); #endif }
ssize_t __libc_send (int fd, const void *buf, size_t len, int flags) { #ifdef __ASSUME_SEND_SYSCALL return SYSCALL_CANCEL (send, fd, buf, len, flags); #else return SOCKETCALL_CANCEL (send, fd, buf, len, flags); #endif }
ssize_t __libc_sendmsg (int fd, const struct msghdr *msg, int flags) { # ifdef __ASSUME_SENDMSG_SYSCALL return SYSCALL_CANCEL (sendmsg, fd, msg, flags); # else return SOCKETCALL_CANCEL (sendmsg, fd, msg, flags); # endif }
int __libc_connect (int fd, __CONST_SOCKADDR_ARG addr, socklen_t len) { #ifdef __ASSUME_CONNECT_SYSCALL return SYSCALL_CANCEL (connect, fd, addr.__sockaddr__, len); #else return SOCKETCALL_CANCEL (connect, fd, addr.__sockaddr__, len); #endif }
ssize_t __libc_recvmsg (int fd, struct msghdr *msg, int flags) { #ifdef __ASSUME_RECVMSG_SYSCALL return SYSCALL_CANCEL (recvmsg, fd, msg, flags); #else return SOCKETCALL_CANCEL (recvmsg, fd, msg, flags); #endif }
ssize_t __libc_recv (int fd, void *buf, size_t len, int flags) { #ifdef __ASSUME_RECV_SYSCALL return SYSCALL_CANCEL (recv, fd, buf, len, flags); #elif defined __ASSUME_RECVFROM_FOR_RECV_SYSCALL return SYSCALL_CANCEL (recvfrom, fd, buf, len, flags, NULL, NULL); #else return SOCKETCALL_CANCEL (recv, fd, buf, len, flags); #endif }
int __libc_accept (int fd, __SOCKADDR_ARG addr, socklen_t *len) { #ifdef __ASSUME_ACCEPT_SYSCALL return SYSCALL_CANCEL (accept, fd, addr.__sockaddr__, len); #elif defined __ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL return SYSCALL_CANCEL (accept4, fd, addr.__sockaddr__, len, 0); #else return SOCKETCALL_CANCEL (accept, fd, addr.__sockaddr__, len); #endif }
ssize_t __libc_sendto (int fd, const void *buf, size_t len, int flags, __CONST_SOCKADDR_ARG addr, socklen_t addrlen) { #ifdef __ASSUME_SENDTO_SYSCALL return SYSCALL_CANCEL (sendto, fd, buf, len, flags, addr.__sockaddr__, addrlen); #else return SOCKETCALL_CANCEL (sendto, fd, buf, len, flags, addr.__sockaddr__, addrlen); #endif }
ssize_t __libc_sendmsg (int fd, const struct msghdr *msg, int flags) { return SOCKETCALL_CANCEL (sendmsg, fd, msg, flags); }
int accept4 (int fd, __SOCKADDR_ARG addr, socklen_t *addr_len, int flags) { return SOCKETCALL_CANCEL (accept4, fd, addr.__sockaddr__, addr_len, flags); }
ssize_t __libc_recvmsg (int fd, struct msghdr *msg, int flags) { return SOCKETCALL_CANCEL (recvmsg, fd, msg, flags); }
ssize_t __libc_recv (int fd, void *buf, size_t len, int flags) { return SOCKETCALL_CANCEL (recv, fd, buf, len, flags); }