Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Feb 2018 22:19:00 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        Eitan Adler <lists@eitanadler.com>
Cc:        Kevin Lo <kevlo@freebsd.org>, freebsd-standards@freebsd.org,  FreeBSD Hackers <freebsd-hackers@freebsd.org>
Subject:   Re: Marking select(2) as restrict
Message-ID:  <CANCZdfo46bhfaRpbqOmJjk4%2B=1R2c5kvmrJPENaxNgK==5M4kg@mail.gmail.com>
In-Reply-To: <CAF6rxg=WwqeBnmJzfOZgtwrYesXPfvJFeaVmQwtTa_89_sxaJg@mail.gmail.com>
References:  <CAF6rxg=h_oMiUu7P=GAOQf_OySQM2w31hg6Kas%2B3jeEM3qq_Cg@mail.gmail.com> <CAF6rxgnt9c0n8i-nHQwoKGbZKF2hM5AZqEJnz0CLo26XOO4_sg@mail.gmail.com> <20180221032247.GA81670@ns.kevlo.org> <CAF6rxg=WwqeBnmJzfOZgtwrYesXPfvJFeaVmQwtTa_89_sxaJg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Feb 20, 2018 9:52 PM, "Eitan Adler" <lists@eitanadler.com> wrote:

Adding standards mailing list


On Tuesday, 20 February 2018, Kevin Lo <kevlo@freebsd.org> 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 <lists@eitanadler.com> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfo46bhfaRpbqOmJjk4%2B=1R2c5kvmrJPENaxNgK==5M4kg>