Date: Sun, 25 Feb 2018 06:52:55 +0100 From: Stefan Blachmann <sblachmann@gmail.com> To: Eitan Adler <lists@eitanadler.com> Cc: cem@freebsd.org, FreeBSD Hackers <freebsd-hackers@freebsd.org>, FreeBSD Standards <freebsd-standards@freebsd.org> Subject: Re: Marking select(2) as restrict Message-ID: <CACc-My3hXAoA6YyJeGV-tQ7%2BFW_ct3k_6gyA1db5=jz7ST5c=g@mail.gmail.com> In-Reply-To: <CAF6rxgnOEegTYc0_Yi-wA7KR4wEjQAAuWAppdsKF6eQXEC4bew@mail.gmail.com> References: <20180221032247.GA81670@ns.kevlo.org> <CAF6rxg=WwqeBnmJzfOZgtwrYesXPfvJFeaVmQwtTa_89_sxaJg@mail.gmail.com> <CANCZdfo46bhfaRpbqOmJjk4%2B=1R2c5kvmrJPENaxNgK==5M4kg@mail.gmail.com> <CAF6rxg=wNVgDUF9o744ngmzPNeHB3hqdrLufy=yS3D4osczxFQ@mail.gmail.com> <20180221104400.GU94212@kib.kiev.ua> <23181.46427.671514.319710@khavrinen.csail.mit.edu> <20180221185920.GA94212@kib.kiev.ua> <23181.50488.186767.579361@khavrinen.csail.mit.edu> <20180221201002.GC94212@kib.kiev.ua> <23181.54825.511195.393054@khavrinen.csail.mit.edu> <20180222212746.GB58772@stack.nl> <CAF6rxgkW=Fgh4%2B1-aJG=VUCYso9gcKnER17UOiBy8GtTMsJNYQ@mail.gmail.com> <CAF6rxg=-nBz8caa1Wn1Labn3DydpEO6B8W9PaLhNKYFwGvuZxw@mail.gmail.com> <CAG6CVpV-YBfGsh5zDRuB7N43N4FW5X69BDyi_XF21fs7tOr5JQ@mail.gmail.com> <CAF6rxgnOEegTYc0_Yi-wA7KR4wEjQAAuWAppdsKF6eQXEC4bew@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
The Linux manual pages do not mention restrict for select(). glibc select() itself returns just ENOSYS(), if there is no alias for select(). So I guess what actually gets called is this: https://github.com/udp/freebsd-libc/blob/master/sys/select.c#L48 Which in turn appears to call __sys_select: https://github.com/udp/freebsd-libc/blob/master/include/libc_private.h#L346 See also: https://lists.freebsd.org/pipermail/freebsd-questions/2007-August/154906.html If I understand correctly, the *only* place that defines the optimizations actually being done is the static functions itself: https://github.com/freebsd/freebsd/blob/master/lib/libthr/thread/thr_syscalls.c#L487 So maybe the actual prototypes being used for the functions for which the interpose array is used are irrelevant: https://github.com/freebsd/freebsd/blob/master/lib/libthr/thread/thr_syscalls.c#L642 I not yet found out which functions are actually weakly aliased in, but I could imagine that adding the restrict keyword to the prototypes of the functions listed there, is possibly only of cosmetical importance, without any actual effect. If this is correct, one could be "Posix compliant" without causing any disruptive "optimization" :) Have a nice Sunday! Stefan P.S.: Maybe it would be better to avoid adding the restrict keyword in the __thr_select() function itself mentioned above, as Linux' select function seems to have no restrict: https://github.com/torvalds/linux/blob/master/fs/select.c#L1262 https://github.com/torvalds/linux/blob/master/fs/select.c#L599 On 2/25/18, Eitan Adler <lists@eitanadler.com> wrote: > On 24 February 2018 at 10:55, Conrad Meyer <cem@freebsd.org> wrote: >> On Sat, Feb 24, 2018 at 10:35 AM, Eitan Adler <lists@eitanadler.com> >> wrote: >>> After this entire thread here is the summary. If I've misrepresented >>> you here please let me know. >>> ... >>> >>> kib@ - no benefit; concerned fallout could be hard to observe >>> cem@ - concerned about warnings >> >> Consider me a +1 to kib@. I did not voice those concerns explicitly >> in earlier email because kib did already and I didn't anticipate you >> would ignore him. > > I am not ignoring him. As I stated above I do not believe fallout is > likely since most other major libc implementations have already done > this: > > glibc: already done - > https://github.com/bminor/glibc/blob/master/misc/sys/select.h#L101 > openbsd: already done > https://github.com/openbsd/src/blob/master/sys/sys/select.h#L128 > dragonflyBSD: alredy done: > https://github.com/dragonflybsd/dragonflybsd/blob/master/sys/sys/select.h#L50 > netbsd: already done: > https://github.com/NetBSD/src/blob/trunk/sys/sys/select.h#L69 > > As a further check I went through the search results on github for > select() and did not see any failures in the top few pages. > > -- > 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" >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACc-My3hXAoA6YyJeGV-tQ7%2BFW_ct3k_6gyA1db5=jz7ST5c=g>