The man page of sendmsg(2) does not include EINVAL as possible error value. EINVAL is a possible error value as it appears in then sendit() function in /usr/src/sys/kern/uipc_syscalls.c How-To-Repeat: man sendmsg
Responsible Changed From-To: freebsd-doc->rwatson Robert, can you please look into this? POSIX says that EINVAL may be returned if "the sum of the iov_len values overflows an ssize_t". I see a similar code in FreeBSD: for (i = 0; i < mp->msg_iovlen; i++, iov++) { if ((auio.uio_resid += iov->iov_len) < 0) { error = EINVAL; goto bad; } } except the type of uio_resid in FreeBSD is "int". (On NetBSD, it's size_t.)
On Thu, 12 Oct 2006, Ruslan Ermilov wrote: > Synopsis: man page of sendmsg(2) does not include EINVAL > > Responsible-Changed-From-To: freebsd-doc->rwatson > Responsible-Changed-By: ru > Responsible-Changed-When: Thu Oct 12 18:40:19 UTC 2006 > Responsible-Changed-Why: > Robert, can you please look into this? POSIX says that EINVAL > may be returned if "the sum of the iov_len values overflows an > ssize_t". I see a similar code in FreeBSD: > > for (i = 0; i < mp->msg_iovlen; i++, iov++) { > if ((auio.uio_resid += iov->iov_len) < 0) { > error = EINVAL; > goto bad; > } > } > > except the type of uio_resid in FreeBSD is "int". (On NetBSD, > it's size_t.) We can also return EINVAL if msg_controllen is less than the minimum size of a valid cmesg (which must include a struct cmsghdr). Robert N M Watson Computer Laboratory University of Cambridge
State Changed From-To: open->analyzed Follow-up e-mail with analysis forthcoming. The man page does need to be updated to take into account this and other EINVAL cases. There are also some cases in specific protocols where EINVAL can be returned.
Responsible Changed From-To: rwatson->ru Assign back to Ruslan now he's had my incredibly tardy response.
> We can also return EINVAL if msg_controllen is less than the minimum > size of a valid cmesg (which must include a struct cmsghdr). As a corollary, EINVAL will be returned if (msg_control != NULL) when (msg_controllen == 0). For this reason, I think the man page should stress that if youâre constructing a message with no ancillary data, itâs not enough to just set msg_controllen to 0 â you must also set msg_control to NULL. (Stumbled over this because some software Iâm porting has a single function which handles all sendmsg() invocations for the software. This function unconditionally sets the iovec fields, and conditionally sets the control fields â except it was actually unconditionally setting msg_control to some buffer, and conditionally setting msg_controllen based on whether the buffer was meaningful. That works on Linux, but not FreeBSD.) Philip
For the following conditions Product: Base System, Documentation Status: New, Open, In Progress, UNCONFIRMED Assignee: Former FreeBSD committer Reset to default assignee. Reset status to "Open".