fcntl: port portions of fcntl to mingw
authorEric Blake <ebb9@byu.net>
Wed, 16 Dec 2009 16:11:32 +0000 (09:11 -0700)
committerEric Blake <ebb9@byu.net>
Thu, 17 Dec 2009 02:25:34 +0000 (19:25 -0700)
commit021c8619190757f535c72ad5cdb1d624e19620d6
treed98db31ff71feefea79d98d8f2838893c5bc3b43
parentda91bb7df9bc25e3349b9f3172bfa9d9962f293e
fcntl: port portions of fcntl to mingw

Borrow ideas from dup_cloexec and dup3 to implement F_DUPFD and
F_DUPFD_CLOEXEC.  Support querying the inheritance status via
F_GETFD, but for now, no support for changing with F_SETFD.
The remaining portions of fcntl fail with EINVAL.

* m4/fcntl.m4 (gl_FUNC_FCNTL): Also build fcntl.c on mingw.
* lib/fcntl.c (fcntl) <F_DUPFD, F_DUPFD_CLOEXEC, F_GETFD>: Provide
replacement for mingw.
* modules/fcntl (Description): Update.
(Depends-on): Add dup2.
* m4/fcntl_h.m4 (gl_FCNTL_H_DEFAULTS): Add witness.
* modules/fcntl-h (Makefile.am): Substitute it.
* lib/fcntl.in.h (fcntl): Update declaration.
(F_DUPFD, F_GETFD): New macros, when needed.
* doc/posix-headers/fcntl.texi (fcntl.h): Update documentation.
* doc/posix-functions/fcntl.texi (fcntl): Likewise.
* tests/test-fcntl.c (check_flags, main): Enhance test for items
we now guarantee.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
doc/posix-functions/fcntl.texi
doc/posix-headers/fcntl.texi
lib/fcntl.c
lib/fcntl.in.h
m4/fcntl.m4
m4/fcntl_h.m4
modules/fcntl
modules/fcntl-h
tests/test-fcntl.c