On Wed, Aug 3, 2016 at 10:54 AM, Lundberg, Johannes
<johan...@brilliantservice.co.jp> wrote:
> Hi
> I'm porting a project to fbsd and I have problem with this part that works
> in linux but not fbsd when fd = -1.
> https://github.com/Cloudef/wlc/blob/master/src/session/fd.c#L80-L108
> I get "invalid argument" from sendmsg() when setting CMSG_LEN(0).
> Anyone have a clue how to correctly do this on fbsd?
> Thanks!
> Johannes

It sounds like you're trying to send an empty cmsg.  The error may
happen because your msg_controllen field is inconsistent with your
cmsg_len field.  You're setting msg_controllen as if there were a full
cmsg, but  then cmsg_len says that there is no cmsg.  Or maybe the
error is because (just guessing) FreeBSD doesn't allow sending empty
or undefined cmsgs.  Notice that cmsg_level and cmsg_type are
undefined in the case where fd == -1.  POSIX doesn't say whether
sendmsg supports empty cmsgs, but why bother?  You could just use send
instead of sendmsg if you're not sending a file descriptor.

freebsd-current@freebsd.org mailing list
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to