Hi Alan Thanks for the reply. Can I still use the same receiving function for sendmsg/send and tell what kind of message is coming? How would I tell if there is an fd attached or not? Even if I set cmsg_level and cmsg_type it won't let me send it. The problem is having a zero length attachment on freebsd.... I can't send -1 as fd because that errors to invalid file descriptor. On Wed, Aug 3, 2016 at 10:12 AM, Alan Somers <asomers_at_freebsd.org> wrote: > On Wed, Aug 3, 2016 at 10:54 AM, Lundberg, Johannes > <johannes_at_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. > > -Alan > -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 秘密保持について:この電子メールは、名宛人に送信したものであり、秘匿特権の対象となる情報を含んでいます。 もし、名宛人以外の方が受信された場合、このメールの破棄、およびこのメールに関する一切の開示、 複写、配布、その他の利用、または記載内容に基づくいかなる行動もされないようお願い申し上げます。 --- CONFIDENTIALITY NOTE: The information in this email is confidential and intended solely for the addressee. Disclosure, copying, distribution or any other action of use of this email by person other than intended recipient, is prohibited. If you are not the intended recipient and have received this email in error, please destroy the original message.Received on Wed Aug 03 2016 - 15:18:39 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:07 UTC