Cygwin: split out fhandler_socket into inet and local classes

First cut, still incomplete

* fhandler_socket is now base class for other socket classes
* fhandler_socket_inet handles AF_INET and AF_INET6 sockets
* fhandler_socket_local handles AF_LOCAL/AF_UNIX sockets
* finally get rid of fdsock by using set_socket_handle in accept4
* align file-related calls (fstat,  fstatvfs, fchown, fchmod, facl)
  to Linux.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen
2018-02-21 21:40:01 +01:00
parent dff3bc9a86
commit 859d215b7e
10 changed files with 3293 additions and 2218 deletions

View File

@ -304,8 +304,8 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle)
dev.parse (name);
else if (strcmp (name, ":sock:") == 0
/* NtQueryObject returns an error when called on an LSP socket
handle. fdsock tries to fetch the underlying base socket,
but this might fail. */
handle. fhandler_socket::set_socket_handle tries to fetch
the underlying base socket, but this might fail. */
|| (strcmp (name, unknown_file) == 0
&& !::getsockopt ((SOCKET) handle, SOL_SOCKET, SO_RCVBUF,
(char *) &rcv, &len)))
@ -517,10 +517,12 @@ fh_alloc (path_conv& pc)
case FH_TCP:
case FH_UDP:
case FH_ICMP:
fh = cnew (fhandler_socket_inet);
break;
case FH_UNIX:
case FH_STREAM:
case FH_DGRAM:
fh = cnew (fhandler_socket);
fh = cnew (fhandler_socket_local);
break;
case FH_FS:
fh = cnew (fhandler_disk_file);