From owner-freebsd-hackers@freebsd.org Wed Feb 21 05:19:02 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 7215DF0519C for ; Wed, 21 Feb 2018 05:19:02 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x22f.google.com (mail-io0-x22f.google.com [IPv6:2607:f8b0:4001:c06::22f]) (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 03F3D86663 for ; Wed, 21 Feb 2018 05:19:02 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x22f.google.com with SMTP id m22so797706iob.12 for ; Tue, 20 Feb 2018 21:19:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=m4sPwmQigNOQQJi/tKhRkjiKy4ZYnCrWG7adkLIiYJg=; b=bcXZWlxud9dOu3tE1g/KBx25GL+E3qLYsebAE5R9BcxHGnCT5+QMlznu5wzNBIHUFq bOBqpNQyIr9y3Om0oWC+1sCMuv6EvDLgGALFh34vNac8H4FnThM4XKRABfrrsIlGmJd6 2hn+melm1Ug2Q4pOKSHJ2zhIWfhfb7FbOcGoSu7YfKbQffuFLi46CKJxYseP/Mxc0de/ n8Pg8vm14tGiNts6Rozd3iRf7flLILggvz0fyLLKGKGy9YpZeyzvABhbXe5hoYoGbREE iZO/3cuJOIDK6NnK++Qq+9inn7OOLp0sPTQQ6IBUNTDAdEFcFEc2j5G/QKGrIN4u90+T OWeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=m4sPwmQigNOQQJi/tKhRkjiKy4ZYnCrWG7adkLIiYJg=; b=J0EwUvhdriHUoO+tJSYW72GBqWiq0Rjsgi5S4ZrUWiILI7iiJ0+VMwTmGfLH3htc6F S+tTRiKioph7jVK/2WDilQ0x4r/02u7SQuWFe8Vi9+q3eA5f4Nfuet1p+hB9HQgIsCxb za5jZcJOe9PzAHBVbPWIAK+kKm3r2nBY9EvHv3lAskYEIryxB/b1VDuUdToXjgaKuqN0 Me5/jr8nKhOzT4GHgNP3h7N5DW56yCW8glX9uERtws/2trQ/DqNHf7BzpfxgFtxrWfIO 8imVuuZ/pYBuk0e5tY+vrxPtq5H2j9yXz5QE0dUQyBC7B+W51gXsF1PdaMoaqiObacol 3zOg== X-Gm-Message-State: APf1xPAqcppDMYrrjqv/WgMB5iIH4KW2Gsa3ghdAu7HCy/xk8etVyeyS fRq+PY/9ZaicZHimvU3lPLFxQJLe1lzYXDEjRmXuNg== X-Google-Smtp-Source: AG47ELvp+6Rpq1CKNipFUtqxiGkg0Wmp5pfqysSY8m52ACok3fgVkhrh7JsAU6A0Jr2ks1JdzIE5kJWdjkgveXv/KAg= X-Received: by 10.107.175.77 with SMTP id y74mr2724896ioe.37.1519190341199; Tue, 20 Feb 2018 21:19:01 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.201.67 with HTTP; Tue, 20 Feb 2018 21:19:00 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:9198:c568:89aa:9c67] Received: by 10.79.201.67 with HTTP; Tue, 20 Feb 2018 21:19:00 -0800 (PST) In-Reply-To: References: <20180221032247.GA81670@ns.kevlo.org> From: Warner Losh Date: Tue, 20 Feb 2018 22:19:00 -0700 X-Google-Sender-Auth: 2aoxrDjCPShCvlqRVEjvQVupYYw Message-ID: Subject: Re: Marking select(2) as restrict To: Eitan Adler Cc: Kevin Lo , freebsd-standards@freebsd.org, FreeBSD Hackers Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 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 05:19:02 -0000 On Feb 20, 2018 9:52 PM, "Eitan Adler" wrote: Adding standards mailing list On Tuesday, 20 February 2018, Kevin Lo wrote: > On Tue, Feb 20, 2018 at 04:29:59PM -0800, 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 > > Please send your patch to standards@. The freebsd-standards mailing list > was created for precisely this purpose, thanks. > > > 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 */ > Once upon a time, this would break a lot of code. Perhaps times have changed. Does the state of the art give warnings,when restrict is violated? If not, how do you propose the ports broken subtlely be detected? Warner