From 123be9deda8eb24ef15fb889248984e6d23bb8b4 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Sat, 3 Nov 2012 18:29:46 +0100 Subject: Add recvmmsg and sendmmsg to the generic glibc API. --- socket/sys/socket.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'socket/sys') diff --git a/socket/sys/socket.h b/socket/sys/socket.h index 787c2b907e..3810a37543 100644 --- a/socket/sys/socket.h +++ b/socket/sys/socket.h @@ -97,6 +97,16 @@ typedef union { __SOCKADDR_ALLTYPES # undef __SOCKADDR_ONETYPE #endif +#ifdef __USE_GNU +/* For `recvmmsg' and `sendmmsg'. */ +struct mmsghdr + { + struct msghdr msg_hdr; /* Actual message header. */ + unsigned int msg_len; /* Number of received or sent bytes for the + entry. */ + }; +#endif + /* Create a new socket of type TYPE in domain DOMAIN, using protocol PROTOCOL. If PROTOCOL is zero, one is chosen automatically. @@ -175,6 +185,16 @@ extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n, extern ssize_t sendmsg (int __fd, const struct msghdr *__message, int __flags); +#ifdef __USE_GNU +/* Send a VLEN messages as described by VMESSAGES to socket FD. + Returns the number of datagrams successfully written or -1 for errors. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int sendmmsg (int __fd, struct mmsghdr *__vmessages, + unsigned int __vlen, int __flags); +#endif + /* Receive a message as described by MESSAGE from socket FD. Returns the number of bytes read or -1 for errors. @@ -182,6 +202,17 @@ extern ssize_t sendmsg (int __fd, const struct msghdr *__message, __THROW. */ extern ssize_t recvmsg (int __fd, struct msghdr *__message, int __flags); +#ifdef __USE_GNU +/* Receive up to VLEN messages as described by VMESSAGES from socket FD. + Returns the number of bytes read or -1 for errors. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int recvmmsg (int __fd, struct mmsghdr *__vmessages, + unsigned int __vlen, int __flags, + const struct timespec *__tmo); +#endif + /* Put the current value for socket FD's option OPTNAME at protocol level LEVEL into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's -- cgit v1.2.3