From owner-freebsd-arch@FreeBSD.ORG Tue Jan 7 21:20:37 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 5F99DBC; Tue, 7 Jan 2014 21:20:37 +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 0D1CC1F63; Tue, 7 Jan 2014 21:20:36 +0000 (UTC) Received: by mail-qe0-f49.google.com with SMTP id w7so963241qeb.8 for ; Tue, 07 Jan 2014 13:20:36 -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=YcMWKdKPWFGwUT7+Vxa6Pyc+rnALcBfG30VKupROfzM=; b=opyG36ynXSBd0LIe7TONUDo5u3qoFRENrg+xPm/T7XvqDGgxh6wGrYjWfYpofwobqr b0e0+Rhn69k+qd0Rv/XU1XWAfsX1r5zf4OB5y5e4IQtUKciclIAOMQpLOxsFAbAvLr3I ixTBJb3OvJ1jJ8Oh2YlVkAYRxkVhF/FSrAdZLX9Yu0xQi2Odn5g/gAumWLgvlzjZ5T4y N2YDNfMqzdPzm7FaV/3MDZ31OeXYlQk4DyqhVS+Z7xBPKhOO3K5qfWZnvBa2E5ByyJ8y 1CGSkonJWKPi1VLZNbrb0xOtPpXvb5/NJXTPBBvGMqKeW9fnbGipKurZ09NbLbL/VrQ4 8IWQ== MIME-Version: 1.0 X-Received: by 10.224.13.203 with SMTP id d11mr18615187qaa.26.1389129636301; Tue, 07 Jan 2014 13:20:36 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.224.52.8 with HTTP; Tue, 7 Jan 2014 13:20:36 -0800 (PST) In-Reply-To: <9C1291B5-215B-440E-B8B0-6308840F755C@bsdimp.com> References: <9C1291B5-215B-440E-B8B0-6308840F755C@bsdimp.com> Date: Tue, 7 Jan 2014 13:20:36 -0800 X-Google-Sender-Auth: yWFaM3NDC04owzzcXcX-ngCuWyM 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, 07 Jan 2014 21:20:37 -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... Yup, I've done that bit. > Warner > > 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? I'm open to an alternate interface that doesn't require new syscalls or syscall modification. Yeah, the definition of an fd here is an 'int'. I could always turn it into an int32_t to fix the size but would that be "ok" ? Thanks! -a