diff options
Diffstat (limited to 'man2/sendmmsg.2')
-rw-r--r-- | man2/sendmmsg.2 | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/man2/sendmmsg.2 b/man2/sendmmsg.2 index da2c19cf0..283c4a52b 100644 --- a/man2/sendmmsg.2 +++ b/man2/sendmmsg.2 @@ -5,7 +5,7 @@ .\" .\" SPDX-License-Identifier: Linux-man-pages-copyleft .\" -.TH sendmmsg 2 2022-12-04 "Linux man-pages 6.03" +.TH sendmmsg 2 2023-05-03 "Linux man-pages 6.05.01" .SH NAME sendmmsg \- send multiple messages on a socket .SH LIBRARY @@ -126,14 +126,11 @@ See also BUGS. .\" .\" This matches the behavior of other syscalls like read/write - it .\" is not an error if less than the requested number of elements are sent. -.SH VERSIONS -The -.BR sendmmsg () -system call was added in Linux 3.0. -Support in glibc was added in Linux 2.14. .SH STANDARDS -.BR sendmmsg () -is Linux-specific. +Linux. +.SH HISTORY +Linux 3.0, +glibc 2.14. .SH NOTES The value specified in .I vlen @@ -177,7 +174,7 @@ The contents of the first datagram originates from a pair of buffers. #include <string.h> #include <sys/socket.h> #include <sys/types.h> - +\& int main(void) { @@ -186,13 +183,13 @@ main(void) struct iovec msg1[2], msg2; struct mmsghdr msg[2]; struct sockaddr_in addr; - +\& sockfd = socket(AF_INET, SOCK_DGRAM, 0); if (sockfd == \-1) { perror("socket()"); exit(EXIT_FAILURE); } - +\& addr.sin_family = AF_INET; addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); addr.sin_port = htons(1234); @@ -200,30 +197,30 @@ main(void) perror("connect()"); exit(EXIT_FAILURE); } - +\& memset(msg1, 0, sizeof(msg1)); msg1[0].iov_base = "one"; msg1[0].iov_len = 3; msg1[1].iov_base = "two"; msg1[1].iov_len = 3; - +\& memset(&msg2, 0, sizeof(msg2)); msg2.iov_base = "three"; msg2.iov_len = 5; - +\& memset(msg, 0, sizeof(msg)); msg[0].msg_hdr.msg_iov = msg1; msg[0].msg_hdr.msg_iovlen = 2; - +\& msg[1].msg_hdr.msg_iov = &msg2; msg[1].msg_hdr.msg_iovlen = 1; - +\& retval = sendmmsg(sockfd, msg, 2, 0); if (retval == \-1) perror("sendmmsg()"); else printf("%d messages sent\en", retval); - +\& exit(0); } .EE |