Page 1 of 1

Why sendmmsg is not available on iOS?

PostPosted: Tue Feb 19, 2019 10:55 am
by wmm3416
I found that sendmmsg/recvmmsg is available in Linux. But when I tried to use sendmmsg to send multiple messages on a socket, I found it is not available on iOS.
Is is actually not implement on XNU or I used it in a wrong way?

Re: Why sendmmsg is not available on iOS?

PostPosted: Tue Feb 19, 2019 12:43 pm
by acura
It’s a Linux I think. Ported to some other kernelns.
Checkout recvmsg_x and sendmsg_x.

Re: Why sendmmsg is not available on iOS?

PostPosted: Thu Feb 21, 2019 2:49 am
by wmm3416
Thanks a lot. That helps. As you suggested, I found this as below. It seems recvmsg_x is a private system call that we cannot call it directly. Am I right?
/*
* recvmsg_x() is a system call similar to recvmsg(2) to receive
* several datagrams at once in the array of message headers "msgp".
*
* recvmsg_x() can be used only with protocols handlers that have been specially
* modified to support sending and receiving several datagrams at once.
*
* The size of the array "msgp" is given by the argument "cnt".
*
* The "flags" arguments supports only the value MSG_DONTWAIT.
*
* Each member of "msgp" array is of type "struct msghdr_x".
*
* The "msg_iov" and "msg_iovlen" are input parameters that describe where to
* store a datagram in a scatter gather locations of buffers -- see recvmsg(2).
* On output the field "msg_datalen" gives the length of the received datagram.
*
* The field "msg_flags" must be set to zero on input. On output, "msg_flags"
* may have MSG_TRUNC set to indicate the trailing portion of the datagram was
* discarded because the datagram was larger than the buffer supplied.
* recvmsg_x() returns as soon as a datagram is truncated.
*
* recvmsg_x() may return with less than "cnt" datagrams received based on
* the low water mark and the amount of data pending in the socket buffer.
*
* recvmsg_x() returns the number of datagrams that have been received,
* or -1 if an error occurred.
*
* NOTE: This a private system call, the API is subject to change.
*/

Re: Why sendmmsg is not available on iOS?

PostPosted: Thu Feb 21, 2019 8:39 pm
by acura
Sorry, I missed that. It is still privat for unknown reasons as J states in the free networking chapter. viewtopic.php?f=8&t=19630

Re: Why sendmmsg is not available on iOS?

PostPosted: Fri Feb 22, 2019 7:07 am
by wmm3416
Thanks! ^_^