* cygwin.din (accept4): Export.

* fhandler.h (fhandler_socket::accept4): Rename from accept.  Take
	additional flag parameter.
	* fhandler_socket.cc (fhandler_socket::accept4): Ditto.  Handle
	SOCK_NONBLOCK and SOCK_CLOEXEC flags.
	* net.cc (cygwin_socket): Handle SOCK_NONBLOCK and SOCK_CLOEXEC flags
	in type.  Check for invalid flag values.
	(socketpair): Ditto.
	(cygwin_accept): Accommodate renaming of fhandler_socket::accept
	function to accept4.
	(accept4): New function.
	* posix.sgml: Mention accept4 as GNU extensions.
	* include/cygwin/socket.h (SOCK_NONBLOCK): Define.
	(SOCK_CLOEXEC): Define.
	(_SOCK_FLAG_MASK): Define when building Cygwin.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
	* include/sys/socket.h (accept4): Declare.
This commit is contained in:
Corinna Vinschen
2010-01-15 15:40:05 +00:00
parent 14c800a5ba
commit 0d6531551b
9 changed files with 102 additions and 12 deletions

View File

@@ -1,6 +1,6 @@
/* cygwin/socket.h
Copyright 1999, 2000, 2001, 2005, 2006, 2007, 2009 Red Hat, Inc.
Copyright 1999, 2000, 2001, 2005, 2006, 2007, 2009, 2010 Red Hat, Inc.
This file is part of Cygwin.
@@ -129,6 +129,14 @@ struct OLD_msghdr
#define SOCK_RDM 4 /* reliably-delivered message */
#define SOCK_SEQPACKET 5 /* sequential packet socket */
/* GNU extension flags. Or them to the type parameter in calls to
socket(2) to mark socket as nonblocking and/or close-on-exec. */
#define SOCK_NONBLOCK 0x01000000
#define SOCK_CLOEXEC 0x02000000
#ifdef __INSIDE_CYGWIN__
#define _SOCK_FLAG_MASK 0xff000000 /* Bits left for more extensions */
#endif
/* Supported address families. */
/*
* Address families.

View File

@@ -1,7 +1,7 @@
/* version.h -- Cygwin version numbers and accompanying documentation.
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007, 2008, 2009 Red Hat, Inc.
2005, 2006, 2007, 2008, 2009, 2010 Red Hat, Inc.
This file is part of Cygwin.
@@ -373,12 +373,13 @@ details. */
217: CW_GET_INSTKEY added.
218: Export get_nprocs, get_nprocs_conf, get_phys_pages, get_avphys_pages.
219: Export dup3, pipe2, O_CLOEXEC, F_DUPFD_CLOEXEC.
220: Export accept4, SOCK_CLOEXEC, SOCK_NONBLOCK.
*/
/* Note that we forgot to bump the api for ualarm, strtoll, strtoull */
#define CYGWIN_VERSION_API_MAJOR 0
#define CYGWIN_VERSION_API_MINOR 219
#define CYGWIN_VERSION_API_MINOR 220
/* There is also a compatibity version number associated with the
shared memory regions. It is incremented when incompatible