From 37671b5114b5b3614580a5cf1308d3c2e38bd8d3 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 14 Jan 2010 18:49:13 +0000 Subject: [PATCH] * libc/include/sys/_default_fcntl.h (O_CLOEXEC): Define as _FNOINHERIT. (F_DUPFD_CLOEXEC): Define for Cygwin. * libc/include/sys/unistd.h (dup3): Define for Cygwin. (pipe2): Ditto. --- newlib/ChangeLog | 7 +++++++ newlib/libc/include/sys/_default_fcntl.h | 5 +++++ newlib/libc/include/sys/unistd.h | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 9dc75865f..cd9b52457 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,10 @@ +2010-01-14 Corinna Vinschen + + * libc/include/sys/_default_fcntl.h (O_CLOEXEC): Define as _FNOINHERIT. + (F_DUPFD_CLOEXEC): Define for Cygwin. + * libc/include/sys/unistd.h (dup3): Define for Cygwin. + (pipe2): Ditto. + 2010-01-14 Corinna Vinschen * libc/stdio/vfprintf.c (_VFPRINTF_R): Just wave bytes invalid in diff --git a/newlib/libc/include/sys/_default_fcntl.h b/newlib/libc/include/sys/_default_fcntl.h index eb30e5cda..1884136cd 100644 --- a/newlib/libc/include/sys/_default_fcntl.h +++ b/newlib/libc/include/sys/_default_fcntl.h @@ -51,6 +51,8 @@ extern "C" { #define O_BINARY _FBINARY #define O_TEXT _FTEXT #define O_NOINHERIT _FNOINHERIT +/* O_CLOEXEC is the Linux equivalent to O_NOINHERIT */ +#define O_CLOEXEC _FNOINHERIT /* The windows header files define versions with a leading underscore. */ #define _O_RDONLY O_RDONLY @@ -122,6 +124,9 @@ extern "C" { #define F_CNVT 12 /* Convert a fhandle to an open fd */ #define F_RSETLKW 13 /* Set or Clear remote record-lock(Blocking) */ #endif /* !_POSIX_SOURCE */ +#ifdef __CYGWIN__ +#define F_DUPFD_CLOEXEC 14 /* As F_DUPFD, but set close-on-exec flag */ +#endif /* fcntl(2) flags (l_type field of flock structure) */ #define F_RDLCK 1 /* read lock */ diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h index 419300253..d6d9b41ea 100644 --- a/newlib/libc/include/sys/unistd.h +++ b/newlib/libc/include/sys/unistd.h @@ -38,6 +38,7 @@ int _EXFUN(daemon, (int nochdir, int noclose)); int _EXFUN(dup, (int __fildes )); int _EXFUN(dup2, (int __fildes, int __fildes2 )); #if defined(__CYGWIN__) +int _EXFUN(dup3, (int __fildes, int __fildes2, int flags)); int _EXFUN(eaccess, (const char *__path, int __mode)); void _EXFUN(endusershell, (void)); int _EXFUN(euidaccess, (const char *__path, int __mode)); @@ -129,6 +130,9 @@ int _EXFUN(pause, (void )); int _EXFUN(pthread_atfork, (void (*)(void), void (*)(void), void (*)(void))); #endif int _EXFUN(pipe, (int __fildes[2] )); +#ifdef __CYGWIN__ +int _EXFUN(pipe2, (int __fildes[2], int flags)); +#endif ssize_t _EXFUN(pread, (int __fd, void *__buf, size_t __nbytes, off_t __offset)); ssize_t _EXFUN(pwrite, (int __fd, const void *__buf, size_t __nbytes, off_t __offset)); _READ_WRITE_RETURN_TYPE _EXFUN(read, (int __fd, void *__buf, size_t __nbyte ));