From owner-freebsd-hackers@freebsd.org Wed Feb 21 03:28:55 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9960F25D8E for ; Wed, 21 Feb 2018 03:28:55 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 7789F81B18 for ; Wed, 21 Feb 2018 03:28:55 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from Julian-MBP3.local (203-59-173-201.dyn.iinet.net.au [203.59.173.201]) (authenticated bits=0) by vps1.elischer.org (8.15.2/8.15.2) with ESMTPSA id w1L3SomN038973 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 20 Feb 2018 19:28:52 -0800 (PST) (envelope-from julian@freebsd.org) Subject: Re: Marking select(2) as restrict To: Eitan Adler Cc: FreeBSD Hackers References: From: Julian Elischer Message-ID: <83920964-9ad6-4019-14c5-3e16eff21f2e@freebsd.org> Date: Wed, 21 Feb 2018 11:28:44 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Feb 2018 03:28:56 -0000 > On 2/21/18, Eitan Adler wrote: >> I filed a request for a slightly modified version of this patch to be >> exp-run. I'm planning on committing unless there is significant >> fallout or objections on this list. >> >> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225981 >> >> On 15 February 2018 at 00:10, Eitan Adler wrote: >>> Hi all, >>> >>> POSIX requires that the fd_set arguments in select(2) be marked as >>> restrict. This patch attempts to implement that. >>> >>> (a) Am I missing anything? >>> (b) Anything in particular to watch out for? >>> (c) Assuming an exp-run passes any reason not to commit? >>> >>> >>> Index: lib/libc/sys/select.2 >>> =================================================================== >>> --- lib/libc/sys/select.2 (revision 329296) >>> +++ lib/libc/sys/select.2 (working copy) >>> @@ -39,7 +39,7 @@ >>> .Sh SYNOPSIS >>> .In sys/select.h >>> .Ft int >>> -.Fn select "int nfds" "fd_set *readfds" "fd_set *writefds" "fd_set >>> *exceptfds" "struct timeval *timeout" >>> +.Fn select "int nfds" "fd_set * restrict readfds" "fd_set * restrict >>> writefds" "fd_set * restrict exceptfds" "struct timeval *timeout" >>> .Fn FD_SET fd &fdset >>> .Fn FD_CLR fd &fdset >>> .Fn FD_ISSET fd &fdset >>> Index: lib/libc/sys/select.c >>> =================================================================== >>> --- lib/libc/sys/select.c (revision 329296) >>> +++ lib/libc/sys/select.c (working copy) >>> @@ -41,7 +41,7 @@ __weak_reference(__sys_select, __select); >>> >>> #pragma weak select >>> int >>> -select(int n, fd_set *rs, fd_set *ws, fd_set *es, struct timeval *t) >>> +select(int n, fd_set * restrict rs, fd_set * restrict ws, fd_set * >>> restrict es, struct timeval *t) >>> { >>> >>> return (((int (*)(int, fd_set *, fd_set *, fd_set *, struct timeval *)) >>> Index: sys/sys/select.h >>> =================================================================== >>> --- sys/sys/select.h (revision 329296) >>> +++ sys/sys/select.h (working copy) >>> @@ -101,8 +101,7 @@ int pselect(int, fd_set *__restrict, fd_set *__res >>> const struct timespec *__restrict, const sigset_t *__restrict); >>> #ifndef _SELECT_DECLARED >>> #define _SELECT_DECLARED >>> -/* XXX missing restrict type-qualifier */ >>> -int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); >>> +int select(int, fd_set *__restrict, fd_set *__restrict, fd_set >>> *__restrict, struct timeval *); >>> #endif >>> __END_DECLS >>> #endif /* !_KERNEL */ >>> >>> >>> -- >>> Eitan Adler >> >> >> -- >> Eitan Adler >> _______________________________________________ >> freebsd-hackers@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/freebsd-hackers >> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >> So, you are saying that the bitmaps can not be shared.. I can not think of a reason they would be shared but...  I can also say that I can not think of a proof that there does not exist a case where it would make sense. What is the potential gain?  and is it set so in other OS or standards? Julian