Marking select(2) as restrict

Eitan Adler lists at eitanadler.com
Thu Feb 22 10:56:01 UTC 2018


On 21 February 2018 at 11:15, Garrett Wollman <wollman at csail.mit.edu> wrote:
> <<On Wed, 21 Feb 2018 20:59:20 +0200, Konstantin Belousov <kostikbel at gmail.com> said:
>
>>> [I wrote:]
>>> Compliance with the 2001 POSIX standard (and subsequent versions).
>>>
>>> After C99, all POSIX interfaces that use pointers were updated to
>>> include the restrict qualifier where applicable.
>
>> Restrict barely puts any requirements on the implementation, but does on
>> the consumers.  Which is the cause of this discussion.
>
> I can't speak to this particular case, but my understanding is that
> "restrict" qualifier was only added to arguments if the behavior was
> already unspecified or undefined when the pointers in question were
> aliases (so the consumer was already broken if it did so).  Certainly
> such code has been broken for the better part of two decades.
>
>> Also, what incompliance consequences are ?  I am not even sure that the
>> prototype mismatch can be detected by means other than parsing the headers.
>
> It is permissible for an application to explicitly declare any
> function defined in the standard, so long as it uses the prototype set
> out in the standard.  Also, any vendor wanting POSIX or UNIX
> certification for a derivative system would have to fix it anyway.

Basically this: it is required by the standard. In addition glibc uses
this so its seems unlikely that any modern software will rely on
not-restrict.
https://github.com/bminor/glibc/blob/master/misc/sys/select.h#L101



-- 
Eitan Adler


More information about the freebsd-standards mailing list