From owner-freebsd-arch@FreeBSD.ORG Sun Dec 15 19:19:24 2013 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D23D9BDE; Sun, 15 Dec 2013 19:19:24 +0000 (UTC) Received: from mail-wg0-x231.google.com (mail-wg0-x231.google.com [IPv6:2a00:1450:400c:c00::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4798A1A8B; Sun, 15 Dec 2013 19:19:24 +0000 (UTC) Received: by mail-wg0-f49.google.com with SMTP id x12so3716926wgg.28 for ; Sun, 15 Dec 2013 11:19:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=Uj7DemfK27oS4vaacY9w9vjsKDQfhefCWJOK60Bice8=; b=V1icZbFQbc5lgfVaA3fyhjpUw5uCq2g54GaI4mU7uMCsNcpzTq4oiABMC6dXUlzVOr lXrjUT4oVh7Eci1Uk+8oTWgPKAQ/CDHeF5ejCLHGPzrNMwcAjd5BdMLm9mwZKwJpMzcZ QSuI2n+EcJmqSkJEcpF6/p45vmrNFvG5v6pozK3P/1ePVwp23FhxO4QQQ1WOEsyN25dA 6/spVnlGZFnvExAQemc34/wC+DtQAmF7G8k9gAz5GQDTgbhaRIekXJWUVlM7oSb3fH7H SgLuabSNUuxXLn45x+bb5wXsEeuW0Y45LQUOTm6VC2JRPTlUac6P77nIXKMyUlpI4aDT XXog== MIME-Version: 1.0 X-Received: by 10.180.108.132 with SMTP id hk4mr10554844wib.12.1387135162765; Sun, 15 Dec 2013 11:19:22 -0800 (PST) Sender: antoine.brodin.freebsd@gmail.com Received: by 10.194.64.199 with HTTP; Sun, 15 Dec 2013 11:19:22 -0800 (PST) In-Reply-To: <52AA3A95.9010904@delphij.net> References: <52AA3A95.9010904@delphij.net> Date: Sun, 15 Dec 2013 20:19:22 +0100 X-Google-Sender-Auth: eX7zOtjwV-JYV6Yxnd4axkadVEQ Message-ID: Subject: Re: Removal of a pre-existing library interface From: Antoine Brodin To: Xin LI Content-Type: text/plain; charset=ISO-8859-1 Cc: re , "freebsd-arch@FreeBSD.org Arch" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Dec 2013 19:19:24 -0000 On Thu, Dec 12, 2013 at 11:37 PM, Xin Li wrote: > Hi, > > Recently, OpenBSD have moved from RC4 to ChaCha20 for their > arc4random(3) family of functions and they have later removed a few > interfaces for good reasons. > > On FreeBSD, we aim to maintain ABI stability so we can not simply > remove the interface; we can not remove it from -HEAD because they are > established by previous -STABLE branches, or we would have to bump > major number of shared libraries. After thinking about some other > alternatives, I have created two dummy (well, they also log the event) > compatibility shims for these two interfaces that gets removed from > OpenBSD. Hello, If you remove the interface from headers, please don't forget to request an exp-run from portmgr. Some ports assume that arc4random_stir and arc4random_addrandom are available when arc4random is. Cheers, Antoine From owner-freebsd-arch@FreeBSD.ORG Mon Dec 16 16:21:02 2013 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 127A3342 for ; Mon, 16 Dec 2013 16:21:02 +0000 (UTC) Received: from mail-in-02.arcor-online.net (mail-in-02.arcor-online.net [151.189.21.42]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B7CE61F0F for ; Mon, 16 Dec 2013 16:21:01 +0000 (UTC) Received: from mail-in-11-z2.arcor-online.net (mail-in-11-z2.arcor-online.net [151.189.8.28]) by mx.arcor.de (Postfix) with ESMTP id 18412152667 for ; Mon, 16 Dec 2013 17:20:43 +0100 (CET) Received: from mail-in-08.arcor-online.net (mail-in-08.arcor-online.net [151.189.21.48]) by mail-in-11-z2.arcor-online.net (Postfix) with ESMTP id 0C6347FEC49 for ; Mon, 16 Dec 2013 17:20:43 +0100 (CET) X-Greylist: Passed host: 188.105.87.196 X-DKIM: Sendmail DKIM Filter v2.8.2 mail-in-08.arcor-online.net D09FA3AF5AA Received: from lorvorc.mips.inka.de (dslb-188-105-087-196.pools.arcor-ip.net [188.105.87.196]) by mail-in-08.arcor-online.net (Postfix) with ESMTPS id D09FA3AF5AA for ; Mon, 16 Dec 2013 17:20:42 +0100 (CET) Received: from lorvorc.mips.inka.de (localhost [127.0.0.1]) by lorvorc.mips.inka.de (8.14.7/8.14.7) with ESMTP id rBGGKgND045655 for ; Mon, 16 Dec 2013 17:20:42 +0100 (CET) (envelope-from mailnull@lorvorc.mips.inka.de) Received: (from mailnull@localhost) by lorvorc.mips.inka.de (8.14.7/8.14.7/Submit) id rBGGKgwa045654 for freebsd-arch@freebsd.org; Mon, 16 Dec 2013 17:20:42 +0100 (CET) (envelope-from mailnull) From: naddy@mips.inka.de (Christian Weisgerber) Subject: Re: Removal of a pre-existing library interface Date: Mon, 16 Dec 2013 16:20:42 +0000 (UTC) Message-ID: References: <52AA3A95.9010904@delphij.net> Originator: naddy@mips.inka.de (Christian Weisgerber) To: freebsd-arch@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Dec 2013 16:21:02 -0000 Antoine Brodin wrote: > If you remove the interface from headers, please don't forget to > request an exp-run from portmgr. > Some ports assume that arc4random_stir and arc4random_addrandom are > available when arc4random is. More importantly, unless some of this is merged back, FreeBSD 8 and 9 still require an explicit call to arc4random_stir() after a fork(). -- Christian "naddy" Weisgerber naddy@mips.inka.de From owner-freebsd-arch@FreeBSD.ORG Tue Dec 17 08:23:34 2013 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B656C962; Tue, 17 Dec 2013 08:23:34 +0000 (UTC) Received: from mail-qe0-x229.google.com (mail-qe0-x229.google.com [IPv6:2607:f8b0:400d:c02::229]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 66F4B18FA; Tue, 17 Dec 2013 08:23:34 +0000 (UTC) Received: by mail-qe0-f41.google.com with SMTP id gh4so4859463qeb.14 for ; Tue, 17 Dec 2013 00:23:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=CpdHcgt3/vfcq5vPH59CcIp4GrAxWj/zMxKrTEgrgSs=; b=l8KwS8n3ZsKA0qr0ZxwRw8j40kV8fpkk8w5BGeo8UkhKI+brvM97Xe8rAkDCFCGGWV EH+ZUz29AHHCI79sqJ28yq4+p2ooH8hABeYuzwid/WTA5dBBjegKphj8ZnnYvuQP/lk9 gCeWXkD/trMnPeRtcg2yUNHvV06u0peXYLhLtkQrmhvk6IieuoFysPE2U03zJvmdw9q6 6UdZSDghuEqilKZjFNJPXyQEaVurhsQ/3Hl/9UgcfeYujFleBv3iVH0+s0iCMZlcB/Ci W8EMERVLpTl+BkgPKPGou3Mlg5Wqu5GQYbrEP0pNxuiOzrIN9nzqYL/Kyze/LKmJCQiS JJzg== MIME-Version: 1.0 X-Received: by 10.49.129.38 with SMTP id nt6mr40693631qeb.78.1387268613552; Tue, 17 Dec 2013 00:23:33 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.224.53.200 with HTTP; Tue, 17 Dec 2013 00:23:33 -0800 (PST) Date: Tue, 17 Dec 2013 00:23:33 -0800 X-Google-Sender-Auth: gDh6qC9w8pGz5BEh0d5wjQfvi1o Message-ID: Subject: Using sys/types.h types in sys/socket.h From: Adrian Chadd To: "freebsd-arch@freebsd.org" , Bruce Evans Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Dec 2013 08:23:34 -0000 Hi, I have a patch to implement some new sendfile functionality, but this involves adding stuff to sys/socket.h: Index: sys/sys/socket.h =================================================================== --- sys/sys/socket.h (revision 258883) +++ sys/sys/socket.h (working copy) @@ -577,11 +577,27 @@ }; /* + * sendfile(2) kqueue information + */ +struct sf_hdtr_kq { + int kq_fd; /* kq fd to post completion events on */ + uint32_t kq_flags; /* extra flags to pass in */ + void *kq_udata; /* user data pointer */ + uintptr_t kq_ident; /* ident (from userland?) */ +}; + +struct sf_hdtr_all { + struct sf_hdtr hdtr; + struct sf_hdtr_kq kq; +}; + +/* * Sendfile-specific flag(s) */ #define SF_NODISKIO 0x00000001 #define SF_MNOWAIT 0x00000002 #define SF_SYNC 0x00000004 +#define SF_KQUEUE 0x00000008 #ifdef _KERNEL #define SFK_COMPAT 0x00000001 ... now, uintptr_t upsets things, because we don't include sys/types.h before sys/socket.h. The POSIX spec for sys/socket.h doesn't mention a dependency on sys/types.h and in fact says it should define a couple of types itself. http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html .. so, what suggestions do people have? I'd like to do this right and not cause header pollution. Thanks! -a From owner-freebsd-arch@FreeBSD.ORG Tue Dec 17 10:08:36 2013 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3CD4E87F; Tue, 17 Dec 2013 10:08:36 +0000 (UTC) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id F0997115B; Tue, 17 Dec 2013 10:08:35 +0000 (UTC) Received: from c122-106-144-87.carlnfd1.nsw.optusnet.com.au (c122-106-144-87.carlnfd1.nsw.optusnet.com.au [122.106.144.87]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 04BAB7815C2; Tue, 17 Dec 2013 21:08:26 +1100 (EST) Date: Tue, 17 Dec 2013 21:07:55 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Adrian Chadd Subject: Re: Using sys/types.h types in sys/socket.h In-Reply-To: Message-ID: <20131217204732.D2024@besplex.bde.org> References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=YYGEuWhf c=1 sm=1 tr=0 a=p/w0leo876FR0WNmYI1KeA==:117 a=PO7r1zJSAAAA:8 a=n4PiHyf99_4A:10 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=zprIhm_aaxwA:10 a=uZvujYp8AAAA:8 a=qJQZ6vFn4QtbnErC1EUA:9 a=CjuIK1q_8ugA:10 a=jdbVF-fcCCEA:10 Cc: "freebsd-arch@freebsd.org" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Dec 2013 10:08:36 -0000 On Tue, 17 Dec 2013, Adrian Chadd wrote: > I have a patch to implement some new sendfile functionality, but this > involves adding stuff to sys/socket.h: This would undo FreeBSD's de-pollution of sys/socket.h. > Index: sys/sys/socket.h > =================================================================== > --- sys/sys/socket.h (revision 258883) > +++ sys/sys/socket.h (working copy) > @@ -577,11 +577,27 @@ > }; > > /* > + * sendfile(2) kqueue information > + */ > +struct sf_hdtr_kq { > + int kq_fd; /* kq fd to post completion events on */ > + uint32_t kq_flags; /* extra flags to pass in */ > + void *kq_udata; /* user data pointer */ > + uintptr_t kq_ident; /* ident (from userland?) */ > +}; POSIX is bad enough to allow all the symbols in sys/type.h to be declared here, but it doesn't allow sf_* or kq_*. So this would have to be under __BSD_VISIBLE, and POSIX is irrelevant for the uintptr_t and uint32_t pollution. In fact, this section is already under __BSD_VISIBLE. It doesn't have so many style bugs as this. All tabs seem to have been corrupted by mail programs, except in struct sf_hdtr where they are missing in the committed version. > ... now, uintptr_t upsets things, because we don't include sys/types.h > before sys/socket.h. > > The POSIX spec for sys/socket.h doesn't mention a dependency on > sys/types.h and in fact says it should define a couple of types > itself. > > http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html > > .. so, what suggestions do people have? I'd like to do this right and > not cause header pollution. Either use __uintptr_t, or declare only uintptr_t as is done for 7 other types near the beginning of the file, depending on whether the uintptr_t field needs to be accessed from userland. Bruce From owner-freebsd-arch@FreeBSD.ORG Tue Dec 17 15:42:11 2013 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EF5D18F5 for ; Tue, 17 Dec 2013 15:42:10 +0000 (UTC) Received: from mail-ie0-f176.google.com (mail-ie0-f176.google.com [209.85.223.176]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B4C3D1029 for ; Tue, 17 Dec 2013 15:42:10 +0000 (UTC) Received: by mail-ie0-f176.google.com with SMTP id at1so8490705iec.21 for ; Tue, 17 Dec 2013 07:42:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to; bh=I03bQ3+UH67d+ODQdxZcrxce9g82B0gRgomsUqeVEN4=; b=bmN8El7R/6TngT/jsc4hA6VOvFa5P0soijeKLgs6DpjM/LxAX+xlTXMBrMzhY+lhVN hVIkUXl3VJIUUeQYcyCfx0PEdwdR7UKhxuE4v7JTVaLcvIjjZd0n4k3M4QnNm6sjk9Mb /U//JFii3QorVil5kyluMkgQQ8pDDisVEUi7ra1/aZb1e/v4j2IoDyuUWVltxr6GGZY0 iYCeb75/AH8OqCGXjAHEEoGh4GlMx7RjWBCni0i6OTpMPe2ZJ/dQb5lWv5vwWpi+uIxk K+Bsm1GdLYb4oIKwoN5oGqgFqvN3dWuL2D8Cqr5mO6/BpNtb4rFfGr9iKUWKQscdqpVS TD6g== X-Gm-Message-State: ALoCoQk12h/NzCIQ4s7Ec99iBloRjnnR/zA1ZAMNrhZisZRa4kwVKQK8ujWp8eCguIFGYHwpN+PU X-Received: by 10.50.141.133 with SMTP id ro5mr3620267igb.35.1387294929793; Tue, 17 Dec 2013 07:42:09 -0800 (PST) Received: from monkey-bot.int.fusionio.com ([209.117.142.2]) by mx.google.com with ESMTPSA id f5sm22278848igc.4.2013.12.17.07.42.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Dec 2013 07:42:09 -0800 (PST) Sender: Warner Losh Subject: Re: Using sys/types.h types in sys/socket.h Mime-Version: 1.0 (Apple Message framework v1085) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: Date: Tue, 17 Dec 2013 08:42:06 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <9C1291B5-215B-440E-B8B0-6308840F755C@bsdimp.com> References: To: Adrian Chadd X-Mailer: Apple Mail (2.1085) Cc: Bruce Evans , "freebsd-arch@freebsd.org" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Dec 2013 15:42:11 -0000 The tl;dr version: use sys/_types.h and use the usual conventions to = avoid namespace pollution. I read Bruce's reply, and I think I'm saying = the same things he is... Warner On Dec 17, 2013, at 1:23 AM, Adrian Chadd wrote: > Hi, >=20 > I have a patch to implement some new sendfile functionality, but this > involves adding stuff to sys/socket.h: >=20 > Index: sys/sys/socket.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- sys/sys/socket.h (revision 258883) > +++ sys/sys/socket.h (working copy) > @@ -577,11 +577,27 @@ > }; >=20 > /* > + * sendfile(2) kqueue information > + */ > +struct sf_hdtr_kq { > + int kq_fd; /* kq fd to post completion events on */ > + uint32_t kq_flags; /* extra flags to pass in */ > + void *kq_udata; /* user data pointer */ > + uintptr_t kq_ident; /* ident (from userland?) */ > +}; This is a terrible interface. Or I'd say that the ordering of the = elements in this structure is suboptimal. Having the uint32_t in the = middle like that causes badness. Guess not much can be done about that = given that fd must be an int, eh? To avoid namespace pollution, you'll need to include sys/_types.h use = __uint32_t and __uintptr_t respectively. You'd also need #if __BSD_VISIBLE #ifndef _UINT32_T_DECLARED typedef __uint32_t uint32_t; #define _UINT32_T_DECLARED #endif and similar for __uintptr_t. thankfully, sys/_stdint.h already does this = dance to avoid namespace pollution, so you just need a few lines at the = top of socket.h to do this righ. > +struct sf_hdtr_all { > + struct sf_hdtr hdtr; > + struct sf_hdtr_kq kq; > +}; > + > +/* > * Sendfile-specific flag(s) > */ > #define SF_NODISKIO 0x00000001 > #define SF_MNOWAIT 0x00000002 > #define SF_SYNC 0x00000004 > +#define SF_KQUEUE 0x00000008 >=20 > #ifdef _KERNEL > #define SFK_COMPAT 0x00000001 >=20 >=20 > ... now, uintptr_t upsets things, because we don't include sys/types.h > before sys/socket.h. >=20 > The POSIX spec for sys/socket.h doesn't mention a dependency on > sys/types.h and in fact says it should define a couple of types > itself. >=20 > = http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html= >=20 > .. so, what suggestions do people have? I'd like to do this right and > not cause header pollution. >=20 > Thanks! >=20 >=20 > -a > _______________________________________________ > freebsd-arch@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-arch > To unsubscribe, send any mail to = "freebsd-arch-unsubscribe@freebsd.org" From owner-freebsd-arch@FreeBSD.ORG Tue Dec 17 16:49:34 2013 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 700A8F8D; Tue, 17 Dec 2013 16:49:34 +0000 (UTC) Received: from mail-qe0-x22b.google.com (mail-qe0-x22b.google.com [IPv6:2607:f8b0:400d:c02::22b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1C2FF163E; Tue, 17 Dec 2013 16:49:34 +0000 (UTC) Received: by mail-qe0-f43.google.com with SMTP id 2so5387462qeb.2 for ; Tue, 17 Dec 2013 08:49:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=kJmXE/dsufofGeBQKbi0pAq1JVAWiGxV3zzir2eqaTk=; b=RW6t/DJLxynRKipVqMNOvr5VW2s5xrgW869XnJ1+/xoY8mPMi6ZEdV+M40wOE+G7K4 0NWjQIzlLIu8GLgoGOw7v36yHCVDX/tztZgY1JXAGjJD3L7+1ZVbnM6rD+y9bB5TYvB0 g0Dv12rBpq31r/CA1Q1gr8HvcAJ5YazLgnn9tL3XjwfV04eKrfgI3P6BSWjZCEDp+rHC oQOYUrqhU7LTNNZYjnaGhswwG/qS2XUj7bPCiRo6h7pIkonqgsCF6/eKWlnjJ7XSxepP VTTRdXf9BzUfEbf+3WXIfrRQB+JPzHR4exXhUjrcP1O30RcMOESFvgCCfB0sxWShOOj0 Uz3Q== MIME-Version: 1.0 X-Received: by 10.49.131.5 with SMTP id oi5mr44956882qeb.38.1387298973336; Tue, 17 Dec 2013 08:49:33 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.224.53.200 with HTTP; Tue, 17 Dec 2013 08:49:33 -0800 (PST) In-Reply-To: <9C1291B5-215B-440E-B8B0-6308840F755C@bsdimp.com> References: <9C1291B5-215B-440E-B8B0-6308840F755C@bsdimp.com> Date: Tue, 17 Dec 2013 08:49:33 -0800 X-Google-Sender-Auth: pNqZBSUyn5i-bR7fzL_SaF8dhw8 Message-ID: Subject: Re: Using sys/types.h types in sys/socket.h From: Adrian Chadd To: Warner Losh Content-Type: text/plain; charset=ISO-8859-1 Cc: Bruce Evans , "freebsd-arch@freebsd.org" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Dec 2013 16:49:34 -0000 On 17 December 2013 07:42, Warner Losh wrote: > The tl;dr version: use sys/_types.h and use the usual conventions to avoid namespace pollution. I read Bruce's reply, and I think I'm saying the same things he is... > > Warner Right. I was hoping for something dirty but not namespace pollution-y. > On Dec 17, 2013, at 1:23 AM, Adrian Chadd wrote: > >> Hi, >> >> I have a patch to implement some new sendfile functionality, but this >> involves adding stuff to sys/socket.h: >> >> Index: sys/sys/socket.h >> =================================================================== >> --- sys/sys/socket.h (revision 258883) >> +++ sys/sys/socket.h (working copy) >> @@ -577,11 +577,27 @@ >> }; >> >> /* >> + * sendfile(2) kqueue information >> + */ >> +struct sf_hdtr_kq { >> + int kq_fd; /* kq fd to post completion events on */ >> + uint32_t kq_flags; /* extra flags to pass in */ >> + void *kq_udata; /* user data pointer */ >> + uintptr_t kq_ident; /* ident (from userland?) */ >> +}; > > This is a terrible interface. Or I'd say that the ordering of the elements in this structure is suboptimal. Having the uint32_t in the middle like that causes badness. Guess not much can be done about that given that fd must be an int, eh? Yeah, the FD is an int. I can easily put that at the end and order it more appropriately. > To avoid namespace pollution, you'll need to include sys/_types.h use __uint32_t and __uintptr_t respectively. You'd also need > #if __BSD_VISIBLE > #ifndef _UINT32_T_DECLARED > typedef __uint32_t uint32_t; > #define _UINT32_T_DECLARED > #endif > and similar for __uintptr_t. thankfully, sys/_stdint.h already does this dance to avoid namespace pollution, so you just need a few lines at the top of socket.h to do this righ. Ok. I really dislike how the sendfile stuff is in sys/socket.h. It really should be in its own header file so it doesn't pollute sys/socket.h. I wish I had found this sendfile dirtiness all out before 10.0-RELEASE so we could've just make a clean break. I'll evaluate possibly doing it in -HEAD at some point soon. -a From owner-freebsd-arch@FreeBSD.ORG Wed Dec 18 23:58:53 2013 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DC699407; Wed, 18 Dec 2013 23:58:53 +0000 (UTC) Received: from mail-qe0-x231.google.com (mail-qe0-x231.google.com [IPv6:2607:f8b0:400d:c02::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 899BD13D3; Wed, 18 Dec 2013 23:58:53 +0000 (UTC) Received: by mail-qe0-f49.google.com with SMTP id w7so372986qeb.8 for ; Wed, 18 Dec 2013 15:58:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=Umm5I5P/0FAtIP3tF7U765mlqSQEz0r9oQhbwzzRLsc=; b=jdCP2TQC2RFvcAYDokJC8/jA/22EnfGNrhd2qQY2ATg+HodtRFGzH943Nh6zkRIWnv AlRWHhzTV+YQWKOAPCCfdzBnxorzFgoC7deeRmYBvM8qu/hmsrfByZUx8B5REovJViMZ JHGJS4BywrP4OKQzbeu4aIi+Xj+0V03wjJDcqBp4bgW4nOlE7G19OBhhL9RYRf136cW0 vRV3LCCZUSBnhlUhLs+Ds9ZR6URhlpnAwJ5wzQ2wDQ7zI0z+6Q+d7KZ79e/qzy11rXML HuTdGg2KFZmTAP1Pma33lhJoKZlUtFXPEK0+k5/Xn7048AYUv1he1xm21/Tm+FoZB1P+ iQTw== MIME-Version: 1.0 X-Received: by 10.49.17.232 with SMTP id r8mr59024896qed.74.1387411132719; Wed, 18 Dec 2013 15:58:52 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.224.53.200 with HTTP; Wed, 18 Dec 2013 15:58:52 -0800 (PST) In-Reply-To: References: <9C1291B5-215B-440E-B8B0-6308840F755C@bsdimp.com> Date: Wed, 18 Dec 2013 15:58:52 -0800 X-Google-Sender-Auth: MJF648XMA1mLJqpH_t58KzQsqFk Message-ID: Subject: Re: Using sys/types.h types in sys/socket.h From: Adrian Chadd To: Warner Losh Content-Type: text/plain; charset=ISO-8859-1 Cc: Bruce Evans , "freebsd-arch@freebsd.org" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Dec 2013 23:58:53 -0000 Ok, how about this: Index: sys/sys/socket.h =================================================================== --- sys/sys/socket.h (revision 259475) +++ sys/sys/socket.h (working copy) @@ -84,6 +84,16 @@ #endif #endif +#ifndef _UINT32_T_DECLARED +#define _UINT32_T_DECLARED +typedef __uint32_t uint32_t; +#endif + +#ifndef _UINTPTR_T_DECLARED +#define _UINTPTR_T_DECLARED +typedef __uintptr_t uintptr_t; +#endif + /* * Types */ @@ -577,11 +587,27 @@ }; /* + * sendfile(2) kqueue information + */ +struct sf_hdtr_kq { + int kq_fd; /* kq fd to post completion events on */ + uint32_t kq_flags; /* extra flags to pass in */ + void *kq_udata; /* user data pointer */ + uintptr_t kq_ident; /* ident (from userland?) */ +}; + +struct sf_hdtr_all { + struct sf_hdtr hdtr; + struct sf_hdtr_kq kq; +}; + +/* * Sendfile-specific flag(s) */ #define SF_NODISKIO 0x00000001 #define SF_MNOWAIT 0x00000002 #define SF_SYNC 0x00000004 +#define SF_KQUEUE 0x00000008 #ifdef _KERNEL #define SFK_COMPAT 0x00000001 From owner-freebsd-arch@FreeBSD.ORG Thu Dec 19 03:07:18 2013 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 33D2CF1A for ; Thu, 19 Dec 2013 03:07:18 +0000 (UTC) Received: from mail-ie0-f173.google.com (mail-ie0-f173.google.com [209.85.223.173]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EE24B11B9 for ; Thu, 19 Dec 2013 03:07:17 +0000 (UTC) Received: by mail-ie0-f173.google.com with SMTP id to1so696496ieb.32 for ; Wed, 18 Dec 2013 19:07:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to; bh=RiHwS9Uy8GVqg/ovSkY+YgDWYyFhI0OsJHFGelxRiV8=; b=Z7p7OhAxAi8wAfoIY5f3q6eizf9czlxmEKgPRJQlovetLLV4uoqIWGrqPjwZbOPtY1 5zIUpLWr2LO7lhgMWFuuoxk3BmLaRWQ56VnyfOes7u3n/yQpPSbNPjE9qYF54ZDJKpmW /XXkbU8WBXZf/KBaof+nJXIWSYsk2/XVjGxbAs5dRmoYySRAOFjKh8W9i7tFOKgd5EIs N2SgDP1Rm81BH2WlTV3R4Z6L8PhTS2q8MmhET+eQEatxhwszt5kKITgV7xCee/du3jms Nv9YSoPuHQQXg2j0CyWAQQp+k4IhbmHWbmNUxWApseX5MtZBJ5erJDI6hnrRBuI3+0+X zuWg== X-Gm-Message-State: ALoCoQmJJ2mJQefdpSw5P9F791WEH1K9JxbL2vRYHLqMfl2l2a7E89WRmXn7XfznkMl96nXSYJWZ X-Received: by 10.50.143.10 with SMTP id sa10mr306925igb.8.1387422072031; Wed, 18 Dec 2013 19:01:12 -0800 (PST) Received: from [10.0.0.23] (50-78-194-198-static.hfc.comcastbusiness.net. [50.78.194.198]) by mx.google.com with ESMTPSA id f5sm3649920igc.4.2013.12.18.19.01.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 18 Dec 2013 19:01:11 -0800 (PST) Sender: Warner Losh Subject: Re: Using sys/types.h types in sys/socket.h Mime-Version: 1.0 (Apple Message framework v1085) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: Date: Wed, 18 Dec 2013 20:01:10 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <9C1291B5-215B-440E-B8B0-6308840F755C@bsdimp.com> To: Adrian Chadd X-Mailer: Apple Mail (2.1085) Cc: Bruce Evans , "freebsd-arch@freebsd.org" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Dec 2013 03:07:18 -0000 Hmmm, not quite. These need to be inside a __BSD_VISIBLE block, which = you can leverage from the immediately previous block. Warner On Dec 18, 2013, at 4:58 PM, Adrian Chadd wrote: > Ok, how about this: >=20 > Index: sys/sys/socket.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- sys/sys/socket.h (revision 259475) > +++ sys/sys/socket.h (working copy) > @@ -84,6 +84,16 @@ > #endif > #endif >=20 > +#ifndef _UINT32_T_DECLARED > +#define _UINT32_T_DECLARED > +typedef __uint32_t uint32_t; > +#endif > + > +#ifndef _UINTPTR_T_DECLARED > +#define _UINTPTR_T_DECLARED > +typedef __uintptr_t uintptr_t; > +#endif > + > /* > * Types > */ > @@ -577,11 +587,27 @@ > }; >=20 > /* > + * sendfile(2) kqueue information > + */ > +struct sf_hdtr_kq { > + int kq_fd; /* kq fd to post completion events on = */ > + uint32_t kq_flags; /* extra flags to pass in */ > + void *kq_udata; /* user data pointer */ > + uintptr_t kq_ident; /* ident (from userland?) */ > +}; > + > +struct sf_hdtr_all { > + struct sf_hdtr hdtr; > + struct sf_hdtr_kq kq; > +}; > + > +/* > * Sendfile-specific flag(s) > */ > #define SF_NODISKIO 0x00000001 > #define SF_MNOWAIT 0x00000002 > #define SF_SYNC 0x00000004 > +#define SF_KQUEUE 0x00000008 >=20 > #ifdef _KERNEL > #define SFK_COMPAT 0x00000001 From owner-freebsd-arch@FreeBSD.ORG Thu Dec 19 05:51:23 2013 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 997D3EE9; Thu, 19 Dec 2013 05:51:23 +0000 (UTC) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id 1D0A41D01; Thu, 19 Dec 2013 05:51:22 +0000 (UTC) Received: from c122-106-144-87.carlnfd1.nsw.optusnet.com.au (c122-106-144-87.carlnfd1.nsw.optusnet.com.au [122.106.144.87]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id B7649D60C80; Thu, 19 Dec 2013 16:20:21 +1100 (EST) Date: Thu, 19 Dec 2013 16:20:20 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Adrian Chadd Subject: Re: Using sys/types.h types in sys/socket.h In-Reply-To: Message-ID: <20131219154839.T23018@besplex.bde.org> References: <9C1291B5-215B-440E-B8B0-6308840F755C@bsdimp.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=HZAtEE08 c=1 sm=1 tr=0 a=p/w0leo876FR0WNmYI1KeA==:117 a=PO7r1zJSAAAA:8 a=n4PiHyf99_4A:10 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=zprIhm_aaxwA:10 a=rF_X41fraC8vsB5qnxEA:9 a=CjuIK1q_8ugA:10 Cc: "freebsd-arch@freebsd.org" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Dec 2013 05:51:23 -0000 On Wed, 18 Dec 2013, Adrian Chadd wrote: > Ok, how about this: > > Index: sys/sys/socket.h > =================================================================== > --- sys/sys/socket.h (revision 259475) > +++ sys/sys/socket.h (working copy) > @@ -84,6 +84,16 @@ > #endif > #endif > > +#ifndef _UINT32_T_DECLARED > +#define _UINT32_T_DECLARED > +typedef __uint32_t uint32_t; > +#endif > + > +#ifndef _UINTPTR_T_DECLARED > +#define _UINTPTR_T_DECLARED > +typedef __uintptr_t uintptr_t; > +#endif > + > /* > * Types > */ This seems to be correct, except the tab after the second #define is corrupt. Actually, all the tabs are corrupt, but the first #define apparently started with a tab whose corruption made a larger mess. imp@ said, in a message that should have been killfiled due to top posting, that this should be under __BSD_VISIBLE. That isn't strictly necessary, since POSIX allows names ending with _t, and it isn't very important for avoiding pollution since there aren't very many of them. > @@ -577,11 +587,27 @@ > }; > > /* > + * sendfile(2) kqueue information > + */ > +struct sf_hdtr_kq { > + int kq_fd; /* kq fd to post completion events on */ > + int kq_fd; /* kq fd to post completion events on */ > + uint32_t kq_flags; /* extra flags to pass in */ > + void *kq_udata; /* user data pointer */ > + uintptr_t kq_ident; /* ident (from userland?) */ > +}; kq_fd is duplicated. All of the indentation is wrong and has corrupt tabs, except the first level only has corrupt tabs. This should be: struct sf_hdtr_kq { int kq_fd; /* kq fd to post completion events on */ uint32_t kq_flags; /* extra flags to pass in */ void *kq_udata; /* user data pointer */ uintptr_t kq_ident; /* ident (from userland?) */ }; I strongly disagree with indenting everything N extra levels (where N > 1; N = 2 here for the name fields) to line up the fields. I disagree with indenting the name fields by 1 space extra to line them up after adding a '*' before a few fields. It's hard enough to keep the style consistent without following this fancy style. > + > +struct sf_hdtr_all { > + struct sf_hdtr hdtr; > + struct sf_hdtr_kq kq; > +}; Here an extra level would be reasonable since all fields need it, except it would leave less space for comments. Comments are needed for these fields more than for most, since there are none for the struct itself. > + > +/* > * Sendfile-specific flag(s) > */ Older style bugs: - sendfile(2) is not spelled consistently - the parentheses around 's' are more bogus than before because it is even more obvious that there is more than 1 flag here. This was non-bogus in FreeBSD-5 where the only flag here was SF_NODISKIO. - this and some other comments are too verbose (block comments are not needed) - the style rules for block comments are stricter, but are not followed. The sentence fragment in this comment is not a full sentence, and the paragraph in this comment is not filled to make it look like a real paragraph (filling would also make the sentence fragment look like a sentence). I like to write comments about flags uniformly as "/* Flags for foo: */". > #define SF_NODISKIO 0x00000001 > #define SF_MNOWAIT 0x00000002 > #define SF_SYNC 0x00000004 > +#define SF_KQUEUE 0x00000008 The names are unsorted. This seems to be unfortunately necessary for binary compatibility. > This blank line breaks the scope of the comment. > #ifdef _KERNEL > #define SFK_COMPAT 0x00000001 > Bruce From owner-freebsd-arch@FreeBSD.ORG Thu Dec 19 20:13:23 2013 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 72AF78F3 for ; Thu, 19 Dec 2013 20:13:23 +0000 (UTC) Received: from mail-qc0-x233.google.com (mail-qc0-x233.google.com [IPv6:2607:f8b0:400d:c01::233]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2E55114FD for ; Thu, 19 Dec 2013 20:13:23 +0000 (UTC) Received: by mail-qc0-f179.google.com with SMTP id i8so1430689qcq.10 for ; Thu, 19 Dec 2013 12:13:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=hvpG9POKCXRXXNsoLgs3fvgRtC1xEcNRJapF+0gVDXs=; b=D+5+cB3rqSDHT5wDNuOw0Nk+ga9UOrzZh8mvU8FwKfgWMOO5MvKU7QOefwp4VG4yVG unmsqFJHJwDR/rlHocnqFIqLb/L6CK/mgQZ4mCQm631nBWzb+B/6qS/ld3oeXLJGbRBu RpLpJyoGX7JbWo+yxGtMNhvoPE6tpUVdCcBvV+EPI6r0KJLqifAD9H5pUDbZbGEvRnq+ 0tdc4H3E6l7hK9ZFDpaRPZc4b/DSaFTlZET5VysLlzoNvN2JEIFn2dZxf2rWIc9DbZgs i19A6e/7/ZiY5Ebc2KjUvKWEcdvS4ugemKqbYjiRhgGVonk0D8o3qonmliPYZvuJYuzE Fo/w== MIME-Version: 1.0 X-Received: by 10.49.34.207 with SMTP id b15mr6605384qej.49.1387484002341; Thu, 19 Dec 2013 12:13:22 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.224.53.200 with HTTP; Thu, 19 Dec 2013 12:13:22 -0800 (PST) In-Reply-To: <20131219154839.T23018@besplex.bde.org> References: <9C1291B5-215B-440E-B8B0-6308840F755C@bsdimp.com> <20131219154839.T23018@besplex.bde.org> Date: Thu, 19 Dec 2013 12:13:22 -0800 X-Google-Sender-Auth: K2Byp-VTHFx_0PuVgrTUVwCxw5g Message-ID: Subject: Re: Using sys/types.h types in sys/socket.h From: Adrian Chadd To: Bruce Evans Content-Type: text/plain; charset=ISO-8859-1 Cc: "freebsd-arch@freebsd.org" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Dec 2013 20:13:23 -0000 On 18 December 2013 21:20, Bruce Evans wrote: > On Wed, 18 Dec 2013, Adrian Chadd wrote: > >> Ok, how about this: >> >> Index: sys/sys/socket.h >> =================================================================== >> --- sys/sys/socket.h (revision 259475) >> +++ sys/sys/socket.h (working copy) >> @@ -84,6 +84,16 @@ >> #endif >> #endif >> >> +#ifndef _UINT32_T_DECLARED >> +#define _UINT32_T_DECLARED >> +typedef __uint32_t uint32_t; >> +#endif >> + >> +#ifndef _UINTPTR_T_DECLARED >> +#define _UINTPTR_T_DECLARED >> +typedef __uintptr_t uintptr_t; >> +#endif >> + >> /* >> * Types >> */ > > > This seems to be correct, except the tab after the second #define is > corrupt. Actually, all the tabs are corrupt, but the first #define > apparently started with a tab whose corruption made a larger mess. I can tidy them up in a follow-up commit. > imp@ said, in a message that should have been killfiled due to top posting, > that this should be under __BSD_VISIBLE. That isn't strictly necessary, > since POSIX allows names ending with _t, and it isn't very important for > avoiding pollution since there aren't very many of them. Ok, so just to be clear - uintptr_t and uint32_t should both be within __BSD_VISIBLE blocks? Just for my own personal information - why are these and not others within blocks? > >> @@ -577,11 +587,27 @@ >> }; >> >> /* >> + * sendfile(2) kqueue information >> + */ >> +struct sf_hdtr_kq { >> + int kq_fd; /* kq fd to post completion events on */ >> + int kq_fd; /* kq fd to post completion events on */ >> + uint32_t kq_flags; /* extra flags to pass in */ >> + void *kq_udata; /* user data pointer */ >> + uintptr_t kq_ident; /* ident (from userland?) */ >> +}; > > > kq_fd is duplicated. Mis-merge; I'll fix this later. > All of the indentation is wrong and has corrupt tabs, except the first > level only has corrupt tabs. > > This should be: > > struct sf_hdtr_kq { > > int kq_fd; /* kq fd to post completion events on */ > uint32_t kq_flags; /* extra flags to pass in */ > void *kq_udata; /* user data pointer */ > uintptr_t kq_ident; /* ident (from userland?) */ > }; > > I strongly disagree with indenting everything N extra levels (where N > 1; > N = 2 here for the name fields) to line up the fields. I disagree with > indenting the name fields by 1 space extra to line them up after adding > a '*' before a few fields. It's hard enough to keep the style consistent > without following this fancy style. Ok, I'll attempt to correct all this stuff in a follow-up email. Thanks! -a