From owner-freebsd-hackers@freebsd.org Sun Feb 25 05:52:57 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 47C54F0B25F; Sun, 25 Feb 2018 05:52:57 +0000 (UTC) (envelope-from sblachmann@gmail.com) Received: from mail-qt0-x22d.google.com (mail-qt0-x22d.google.com [IPv6:2607:f8b0:400d:c0d::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D37316D54B; Sun, 25 Feb 2018 05:52:56 +0000 (UTC) (envelope-from sblachmann@gmail.com) Received: by mail-qt0-x22d.google.com with SMTP id g14so15298089qti.2; Sat, 24 Feb 2018 21:52:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Acp96vYJWPn0oJeci604nQ1lm91Y0lj15KMyk5+miPQ=; b=jmdo/N0LQe84sEQGdbCPsup6c9uWx6NJ9Ed8GyS3tBG9wLt+zLizodqhrcWQ3aNPfr l6s0+qaEacccwbmBc5tQP02BUQe9jOj7xH45DDDT/v+KddBl4DLBH4FRvlkU2UUXIUGc CSezeUKr+J1ghmzqU2WuPukRJN25tq5BDQqgX1P5tl4Zqh2pyLgrlxP4kdRrt/rM6d5R u9TvRDM5ErkskIIFyooQjCo+/oz3aew/UdErFAiY8zeeXk4lXI7ZvSty1xAIaakPk0O2 jiXtM2ayskWaoT45D9c4KeAZ9ws5GMaO77uspkh2Dh9fU7kXMk0a8w1pS2T9arQTLId2 uvJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Acp96vYJWPn0oJeci604nQ1lm91Y0lj15KMyk5+miPQ=; b=fbGKkpWM9wcrfNBJ4BunA7EhqQxFlJSTPAhgpkoaUfJvn3KwvyNYrY8jYh0E8xISO5 eSt4/3OSZXFklx5MZ+2N49lR5OSX7zRXEqDWdE6KXLQXZ6L3ejKu2KnwxTumntfZYS5O +5mqz77dvIpLKQAxQNAS1fV7kp3bE8EHH6b0mR8NShM7xsImjPrBZWXSAC2R6B6bZOcy YhhwdGQ2iBA9YvIxm9KqFdOh3xwDYZ3iAW3wUW1UFcW/gw42sDRoWLw1h018u3lT8jS1 gJIo7sYonZ00hsKy3E2vITrs8Wf8nKpWR6qtI7UlYq4KkCmEpT9l4EYUPUADyDaiCPAU DNoA== X-Gm-Message-State: APf1xPDrxL9TOHXXRKmcczkL6MbZGJsgLO2aIwecJ62U8eDwT6oNfbJ5 FFIEUp6krUTZjF3PymCo33Fhtknifl43P/s2kOs= X-Google-Smtp-Source: AG47ELunZqxlnmSxLtspqbrKy4Dna02GHHOUnjdE0K8sstxylYhph7JmG/7KO4wL92dxgRitsyRN4USIS2qJgO+eP4I= X-Received: by 10.200.35.141 with SMTP id q13mr10690571qtq.73.1519537976439; Sat, 24 Feb 2018 21:52:56 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.32.74 with HTTP; Sat, 24 Feb 2018 21:52:55 -0800 (PST) In-Reply-To: References: <20180221032247.GA81670@ns.kevlo.org> <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> From: Stefan Blachmann Date: Sun, 25 Feb 2018 06:52:55 +0100 Message-ID: Subject: Re: Marking select(2) as restrict To: Eitan Adler Cc: cem@freebsd.org, FreeBSD Hackers , FreeBSD Standards Content-Type: text/plain; charset="UTF-8" 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: Sun, 25 Feb 2018 05:52:57 -0000 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 wrote: > On 24 February 2018 at 10:55, Conrad Meyer wrote: >> On Sat, Feb 24, 2018 at 10:35 AM, Eitan Adler >> 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" >