From owner-freebsd-current@freebsd.org Wed Aug 3 16:54:33 2016 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 492D8BAE789 for ; Wed, 3 Aug 2016 16:54:33 +0000 (UTC) (envelope-from johannes@brilliantservice.co.jp) Received: from mail-vk0-x230.google.com (mail-vk0-x230.google.com [IPv6:2607:f8b0:400c:c05::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 10F491C21 for ; Wed, 3 Aug 2016 16:54:33 +0000 (UTC) (envelope-from johannes@brilliantservice.co.jp) Received: by mail-vk0-x230.google.com with SMTP id w127so150758259vkh.2 for ; Wed, 03 Aug 2016 09:54:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brilliantservice-co-jp.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=rpIKf4xjK7NYK6ZkUwyNuwMFkgKBRC/1ctBSrTmkWmE=; b=jyeV57mm9vF8+02I4GzGghDfG5R9f3bYQ3KR+bAqN849jkBGP0vZvXRdRPr9C+/AEq x3z65LqkGVrE0g5pPuJhGrkkTpPmkcTNQF+ogQT6lh8mCVJZZGBacQoHxBnVQC9N0Tec rywWr2adnF3zc19qobBEdx8Rvjxo+kX6n7ByhqZTeKlG4c+WcseLsEFoKklMOR0WvH2f iRWVVoYCQ33rsO4awUFQcFWOuF0OzdcQ8cGpSA1JCrB2E2KTsUWFJKZK79uwSwB/ZVd5 JZnQM9IRYJ7xskKDmZuj4r7ujCqhb97dZaEVRNXUOqQU+oBy4a5TZ7jRM07lXjPay5Fd Y7Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=rpIKf4xjK7NYK6ZkUwyNuwMFkgKBRC/1ctBSrTmkWmE=; b=XWPOcotcKZ5Z+xuI8i/q3vJdp6BLVE4Dp1rKOHzJ9TsIGzsCE7+sZr0JdHTB8ESmKV 94YxzT+nM3FVtyrTBIWqUO8S6vDMTCHr8RrHjo8ji1FeeasP2FoeyyPySIU7qcwrp+GO oER/DQ11nyn7SdYTLmo5PDPLHkQ36W3YjUdTgx2WZ+qHB+m/X3mgoJ1FgkwO4tiTpbYe vfFSItg47RUWyksFYCxoaRcz6yiueIk1W99KhPAOz26cMK4iqt89cGUE95GuX/xbN0So STU6NVhxo7kkYdRiuP51UPA1ndiuTp+LNxYOg9V2NkZBKkFqCB4zBO8JR8qjtm2wULu+ ADRw== X-Gm-Message-State: AEkoousV+I9ofHhtIavD80uXsidPQXgP7sG9BXCVs4q6Rr9Ybz9ApM60KUOQcMzbULvPnIaijXKXaN7/o/Ad/YZmCnSX10BNdSfV4m6Nc2ErafAP3Tg9hFOhDOY4iO5Fi2aHuX1YoNNiukBucU01R954Fdk= X-Received: by 10.31.93.129 with SMTP id r123mr33910115vkb.149.1470243271019; Wed, 03 Aug 2016 09:54:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.159.38.132 with HTTP; Wed, 3 Aug 2016 09:54:15 -0700 (PDT) From: "Lundberg, Johannes" Date: Wed, 3 Aug 2016 09:54:15 -0700 Message-ID: Subject: Socket sendmsg() porting question To: FreeBSD Current Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 16:54:33 -0000 SGkNCg0KSSdtIHBvcnRpbmcgYSBwcm9qZWN0IHRvIGZic2Q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WSBOT1RFOiBUaGUgaW5mb3JtYXRpb24gaW4gdGhpcyBlbWFpbCBpcyBjb25maWRlbnRpYWwKYW5k IGludGVuZGVkIHNvbGVseSBmb3IgdGhlIGFkZHJlc3NlZS4KRGlzY2xvc3VyZSwgY29weWluZywg ZGlzdHJpYnV0aW9uIG9yIGFueSBvdGhlciBhY3Rpb24gb2YgdXNlIG9mIHRoaXMKZW1haWwgYnkg cGVyc29uIG90aGVyIHRoYW4gaW50ZW5kZWQgcmVjaXBpZW50LCBpcyBwcm9oaWJpdGVkLgpJZiB5 b3UgYXJlIG5vdCB0aGUgaW50ZW5kZWQgcmVjaXBpZW50IGFuZCBoYXZlIHJlY2VpdmVkIHRoaXMg ZW1haWwgaW4KZXJyb3IsIHBsZWFzZSBkZXN0cm95IHRoZSBvcmlnaW5hbCBtZXNzYWdlLgo= From owner-freebsd-current@freebsd.org Wed Aug 3 17:12:23 2016 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C221BAEE97 for ; Wed, 3 Aug 2016 17:12:23 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-oi0-x229.google.com (mail-oi0-x229.google.com [IPv6:2607:f8b0:4003:c06::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1E0161C5C for ; Wed, 3 Aug 2016 17:12:23 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-oi0-x229.google.com with SMTP id l65so289231870oib.1 for ; Wed, 03 Aug 2016 10:12:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=KT13Eor/+WJc7SZP+nZXfczOdnGbXRbbCisR5kPbtH4=; b=gK8Lqt7s+BH0HY0/R2oGf5ynsqCCPWTcKUNP7Fg9tCGqN++InT51UBHFV2GuUOmdj6 W1aF+tkK/51EbC5zMSfxNVKl0ajEO1gnB8oExBdCvF58rI5oSXtwcOPqe+Ri92K0RpGG Z7X8EZK2nflW/tY45lVaMf2a9n84hSjLyh5PUJd+fQGUMr6U2LhD0Dt75AS2vW4RXML9 lqcNc1pRpL4ZL7ry+J5EQ9sWJypw4wXG1fULIhoDsaAWF8WQTA5p36uqE9swyWils4MH 7kR2l7/j+F2W7A+83y+5K2VcQri021JYkcxvSJ+gXwQpeeSV368CpfQoJFumaivcU6vK v5+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=KT13Eor/+WJc7SZP+nZXfczOdnGbXRbbCisR5kPbtH4=; b=LM+Sdw3MY3AH9emAGszRDPsfM9A1LUMeWJpUNd/+0HagykBoYu5fnI0zFPusfofyvX p6qNB7GDux2kU68bPaWVSVemzsg63nMptBov2Y95aM9EXTQ5VXY0+veH7Wr+qHvYiTrO aUU59q1fmRKGFKb+21l0PBq06g1CEcrKiAvgxc63gcF+o/SdkdqhkRO6m3dPcdM80mFG poofLdUZ1RPOzFNZoiQb3loAaDOB/AXBnqToPc6FMLevqSm7bMQsZsDtmwTDYv5VVvQr bfVZF9hfv5+tc9yD8xMxKBCQpS8FiAEIPNB+ax97WQC7Q+8jyI1MMHIvzAkEHdRI+dax RNKg== X-Gm-Message-State: AEkoouvYOyFNlRdAh+jgRyDAujMYc/Rg+0iK4WW2tHI6I2e/G9PpjkPq1CIJDgUHFtBnHjz50jcIi/08BnPvdA== X-Received: by 10.202.0.80 with SMTP id 77mr1631744oia.173.1470244342432; Wed, 03 Aug 2016 10:12:22 -0700 (PDT) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.202.196.149 with HTTP; Wed, 3 Aug 2016 10:12:21 -0700 (PDT) In-Reply-To: References: From: Alan Somers Date: Wed, 3 Aug 2016 11:12:21 -0600 X-Google-Sender-Auth: QrNcQN2Y4cVF8IfQ1s-yHWEkv4I Message-ID: Subject: Re: Socket sendmsg() porting question To: "Lundberg, Johannes" Cc: FreeBSD Current Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2016 17:12:23 -0000 On Wed, Aug 3, 2016 at 10:54 AM, Lundberg, Johannes 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