Re: [PATCH 1/6] O_CLOEXEC O_NOFOLLOW O_DIRECTORY O_EXEC O_DIRECT

Corinna Vinschen <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
On Oct  8 15:38, Sebastian Huber wrote:
> Make O_CLOEXEC, O_NOFOLLOW, O_DIRECTORY, O_EXEC, and O_DIRECT available
> to non-Cygwin systems.
> 
> Signed-off-by: Sebastian Huber <[email protected]>
> ---
>  newlib/libc/include/sys/_default_fcntl.h | 46 ++++++++++++++++++--------------
>  1 file changed, 26 insertions(+), 20 deletions(-)
> 
> diff --git a/newlib/libc/include/sys/_default_fcntl.h b/newlib/libc/include/sys/_default_fcntl.h
> index 33b462285..19fe65cfd 100644
> --- a/newlib/libc/include/sys/_default_fcntl.h
> +++ b/newlib/libc/include/sys/_default_fcntl.h
> @@ -23,6 +23,19 @@ extern "C" {
>  #define	_FNONBLOCK	0x4000	/* non blocking I/O (POSIX style) */
>  #define	_FNDELAY	_FNONBLOCK	/* non blocking I/O (4.2 style) */
>  #define	_FNOCTTY	0x8000	/* don't assign a ctty on this open */
> +#if defined (__CYGWIN__)
> +#define _FBINARY        0x10000
> +#define _FTEXT          0x20000
> +#endif
> +#define _FNOINHERIT	0x40000
> +#define _FDIRECT        0x80000
> +#define _FNOFOLLOW      0x100000
> +#define _FDIRECTORY     0x200000
> +#define _FEXECSRCH      0x400000
> +#if defined (__CYGWIN__)
> +#define _FTMPFILE       0x800000
> +#define _FNOATIME       0x1000000
> +#endif
>  
>  #define	O_ACCMODE	(O_RDONLY|O_WRONLY|O_RDWR)
>  
> @@ -43,35 +56,28 @@ extern "C" {
>  /*	O_NDELAY	_FNBIO 		set in include/fcntl.h */
>  #define	O_NONBLOCK	_FNONBLOCK
>  #define	O_NOCTTY	_FNOCTTY
> -/* For machines which care - */
> -#if defined (__CYGWIN__)
> -#define _FBINARY        0x10000
> -#define _FTEXT          0x20000
> -#define _FNOINHERIT	0x40000
> -#define _FDIRECT        0x80000
> -#define _FNOFOLLOW      0x100000
> -#define _FDIRECTORY     0x200000
> -#define _FEXECSRCH      0x400000
> -#define _FTMPFILE       0x800000
> -#define _FNOATIME       0x1000000
>  
> +/* POSIX-1.2008 specific flags */
> +#if __POSIX_VISIBLE >= 200809
> +#define O_CLOEXEC	_FNOINHERIT
> +#define O_NOFOLLOW	_FNOFOLLOW
> +#define O_DIRECTORY	_FDIRECTORY
> +#define	O_EXEC		_FEXECSRCH
> +#endif
> +
> +#if __GNU_VISIBLE || __BSD_VISIBLE
> +#define O_DIRECT	_FDIRECT
> +#endif

This is actually a BSD flag?  If so, `#if __BSD_VISIBLE' should
suffice since that's implied by setting _GNU_SOURCE.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAlu9yqEACgkQ9TYGna5E
T6CLSw/+K3IuXPeTpVoekLCI8jX+7E30L4nCRZhgfj0c/2VmFET8Btou0W5mbLxV
k7rg+yGbhis0tihuHTmKR6MIJO133SLCFB1xuqoCgRLyj/b3MjmiQxzHZWmiAXRa
XVctvGWeRv+aaXLsSN6/Y7jA07c0Knrn9uX1BEdfrLtsuI1Xe9UpeA+5oeVJoAm7
WQWE04Of7c0A9FU0FoteSnYfya8W3jWymhHqxaTEaT6EOGuo7oNm60+GMK99U/51
9FPmdRX8UbdpNJCTpZCXM2fPoPoyzhRLYUiBJ63nEQKR0UWQW4cF5BT7azsbqsjZ
4Zta+Nu6llp/APUnlxRizve8sMnF2GSuzf/e74v/+d676mT5t74qYWw2gqFh4a7v
r0bKamLW9qPEalFOZXFTagZn0Zl6OV4UlwYydpteT9eKtb8gd1V1qw2nAv1BXU2X
6EU1gnUEUPjGY25JkX/mnGGXJ/pXy6SHhovB8rtgjKkbTIgDGIhjKiq2AhDcG8h7
CdBNAWuV95lmSdJ7QnnNWRpbdNHwEI4hLDkw8k3xDZ3vfBrvaE96w1xmAngXCWNj
KXZqZ1cL+mLBMN6sCLleg/ohJzswU5RUZx+ZXCfHE5s3pAa3oi0v6Etg8Nma4leC
z029z7zcV1OtPKk4H+CzIGLIJKULmz8IbSfw90l4RCI5+4uRMKo=
=S94b
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.