From owner-freebsd-arch@FreeBSD.ORG Fri Jan 10 11:38:39 2014 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 7BB5DA8F; Fri, 10 Jan 2014 11:38:39 +0000 (UTC) Received: from mail108.syd.optusnet.com.au (mail108.syd.optusnet.com.au [211.29.132.59]) by mx1.freebsd.org (Postfix) with ESMTP id 391951380; Fri, 10 Jan 2014 11:38:38 +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 mail108.syd.optusnet.com.au (Postfix) with ESMTPS id D56E41A2D71; Fri, 10 Jan 2014 22:38:21 +1100 (EST) Date: Fri, 10 Jan 2014 22:38: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: <20140110222640.F2338@besplex.bde.org> References: <9C1291B5-215B-440E-B8B0-6308840F755C@bsdimp.com> <5821DA91-E9C7-4D1A-A108-63E74CFF1FC5@bsdimp.com> <20140108152632.L969@besplex.bde.org> <20140109092602.M957@besplex.bde.org> 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=NtvbPXilBxPnOutxlJYA: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: Fri, 10 Jan 2014 11:38:39 -0000 On Wed, 8 Jan 2014, Adrian Chadd wrote: > On 8 January 2014 14:29, Bruce Evans wrote: >> On Wed, 8 Jan 2014, Adrian Chadd wrote: >> >>> On 7 January 2014 20:48, Bruce Evans wrote: >>>> >>>> Style(9) specifies sorting by size first (it actually mean by alignment >>>> first). That is not very easy since the size^Walignment of typedefed >>>> types should be opaque. In practice, assuming what it is mostly gives >>>> correct results. It gives exactly the opposite of the above: >>>> >>>> N-bit u_int holding ptr >>>> M-bit pointer /* assume M <= N and alignment == size */ >>>> 32-bit u_int (can spell it u_int, not uint32_t, to pack better with >>>> int) >>>> 32-bit int /* assume plain int gives this */ >>> >>> >>> So: >>> >>> /* >>> * sendfile(2) kqueue information >>> */ >>> struct sf_hdtr_kq { >>> uintptr_t kq_ident; /* ident (from userland?) */ >>> void *kq_udata; /* user data pointer */ >>> uint32_t kq_flags; /* extra flags to pass in */ >>> int kq_fd; /* kq fd to post completion events on */ >>> }; >>> >>> ? >> >> >> Also fix the indentation (use 1 tab after 'void' and 'int' and not the >> allowed ugliness of 2 tabs after all type names). >> >> Bruce > > /* > * sendfile(2) kqueue information > */ > struct sf_hdtr_kq { > __uintptr_t kq_ident; /* ident (from userland?) */ > void *kq_udata; /* user data pointer */ > __uint32_t kq_flags; /* extra flags to pass in */ > int kq_fd; /* kq fd to post completion events on */ > }; > > Ok, so I've removed one tab from the comments and added a tab after void/int. > > How's that? Now the last comment is misindented. This also has the unrelated change of using __ufoo instead of ufoo. I think that is only correct if the types are supposed to be almost opaque, with the details not part of the API. Bruce