summaryrefslogtreecommitdiff
path: root/include/sys/socket.h
diff options
context:
space:
mode:
authorGuo Ren <ren_guo@c-sky.com>2017-09-27 13:31:35 +0800
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2017-10-01 08:54:33 +0200
commit6e15fafa20066634a58d412b259b117a47ca46d1 (patch)
tree78e2bfabc8a9b13926c93bf12d1e35aba14abe78 /include/sys/socket.h
parent7cfd2112acbc7a9dfcd9f8a23e550672934a2545 (diff)
recvmmsg/sendmmsg: add recvmmsg sendmmsg support.
The recvmmsg and sendmmsg is very important for UDP stream application. If we only use recvmsg for UDP stream, it will only copy one mtu size of data in a syscall. And recvmmsg copy as many as you want in a syscall. So recvmmsg is more efficient,and some applications will depends on the recvmmsg and sendmmsg, eg: UDP media stream player. Signed-off-by: Guo Ren <ren_guo@c-sky.com>
Diffstat (limited to 'include/sys/socket.h')
-rw-r--r--include/sys/socket.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/sys/socket.h b/include/sys/socket.h
index 8642312aa..63dc4b953 100644
--- a/include/sys/socket.h
+++ b/include/sys/socket.h
@@ -97,6 +97,15 @@ 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.
@@ -190,6 +199,17 @@ extern ssize_t sendmsg (int __fd, const struct msghdr *__message,
int __flags);
libc_hidden_proto(sendmsg)
+#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 ssize_t sendmmsg (int __fd, struct mmsghdr *__vmessages,
+ size_t __vlen, int __flags);
+libc_hidden_proto(sendmmsg)
+#endif
+
/* Receive a message as described by MESSAGE from socket FD.
Returns the number of bytes read or -1 for errors.
@@ -198,6 +218,16 @@ libc_hidden_proto(sendmsg)
extern ssize_t recvmsg (int __fd, struct msghdr *__message, int __flags);
libc_hidden_proto(recvmsg)
+#ifdef __USE_GNU
+/* Receive up to VLEN messages as described by VMESSAGES from socket FD.
+ Returns the number of messages received or -1 for errors.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern ssize_t recvmmsg (int __fd, struct mmsghdr *__vmessages,
+ size_t vlen, int __flags, struct timespec *__tmo);
+libc_hidden_proto(recvmmsg)
+#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