bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: openat wrapper assumes that O_RDONLY is disjoint from R_RDWR


From: Ben Pfaff
Subject: Re: openat wrapper assumes that O_RDONLY is disjoint from R_RDWR
Date: Sat, 7 Mar 2020 10:13:01 -0800

On Sat, Mar 7, 2020 at 9:36 AM Bruno Haible <address@hidden> wrote:
>
> Dan Gohman wrote:
> > That would fix the problem for systems that define O_RDONLY as Hurd does,
> > while not breaking any known systems.
> >
> > It wouldn't be correct on a hypothetical system which defines the constants
> > like this:
> >
> > #define O_WRONLY 0
> > #define O_RDONLY 1
> > #define O_RDWR 2
> >
> > though I don't know of any platforms which do this.
>
> Reviewing the include files of the various platforms shows that
> such a hypothetical system doesn't exist:
>
>                      O_RDONLY   O_WRONLY   O_RDWR
>
> AIX
> Android
> BeOS
> Cygwin
> FreeBSD
> glibc/Linux
> Haiku
> HP-UX
> Interix
> IRIX
> macOS
> mingw, MSVC
> Minix
> MirBSD
> musl
> NetBSD
> OpenBSD
> OSF/1
> pips
> Plan 9
> Solaris
>                          0          1         2
>
> glibc/Hurd               1          2         3

Is there some reason that O_ACCMODE isn't the best choice here?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]