Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2018-06-26 17:31:17 +0300
committerCorinna Vinschen <corinna@vinschen.de>2018-06-26 17:31:17 +0300
commit6c55be9dbbd724edc5fd5b6c022e212f42754887 (patch)
treec004ebcd6e05340d609e7ba330a22a506db6e769 /winsup
parent17918cc6a6e6471162177a1125c6208ecce8a72e (diff)
Cygwin: Allow to build without experimental AF_UNIX code by default
Introduce __WITH_AF_UNIX preprocessor flag to enable the new code Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/dtable.cc2
-rw-r--r--winsup/cygwin/fhandler.h7
-rw-r--r--winsup/cygwin/fhandler_socket_unix.cc4
-rw-r--r--winsup/cygwin/include/cygwin/socket.h2
-rw-r--r--winsup/cygwin/net.cc8
-rw-r--r--winsup/cygwin/path.cc6
-rw-r--r--winsup/cygwin/path.h4
-rw-r--r--winsup/cygwin/select.cc4
8 files changed, 36 insertions, 1 deletions
diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
index 9ebd45c06..0ebeef058 100644
--- a/winsup/cygwin/dtable.cc
+++ b/winsup/cygwin/dtable.cc
@@ -520,9 +520,11 @@ fh_alloc (path_conv& pc)
case FH_LOCAL:
fh = cnew (fhandler_socket_local);
break;
+#ifdef __WITH_AF_UNIX
case FH_UNIX:
fh = cnew (fhandler_socket_unix);
break;
+#endif /* __WITH_AF_UNIX */
case FH_FS:
fh = cnew (fhandler_disk_file);
break;
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index 39a674c76..88653b6e9 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -951,6 +951,8 @@ class af_unix_shmem_t
struct ucred *peer_cred () { return &_peer_cred; }
};
+#ifdef __WITH_AF_UNIX
+
class fhandler_socket_unix : public fhandler_socket
{
protected:
@@ -1110,6 +1112,8 @@ class fhandler_socket_unix : public fhandler_socket
}
};
+#endif /* __WITH_AF_UNIX */
+
class fhandler_base_overlapped: public fhandler_base
{
static HANDLE asio_done;
@@ -2631,6 +2635,9 @@ typedef union
char __serial[sizeof (fhandler_serial)];
char __socket_inet[sizeof (fhandler_socket_inet)];
char __socket_local[sizeof (fhandler_socket_local)];
+#ifdef __WITH_AF_UNIX
+ char __socket_unix[sizeof (fhandler_socket_unix)];
+#endif /* __WITH_AF_UNIX */
char __termios[sizeof (fhandler_termios)];
char __pty_common[sizeof (fhandler_pty_common)];
char __pty_slave[sizeof (fhandler_pty_slave)];
diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc
index 295e07bb4..f2aa778a8 100644
--- a/winsup/cygwin/fhandler_socket_unix.cc
+++ b/winsup/cygwin/fhandler_socket_unix.cc
@@ -8,6 +8,8 @@
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
+#ifdef __WITH_AF_UNIX
+
#include "winsup.h"
#include <w32api/winioctl.h>
#include <asm/byteorder.h>
@@ -2376,3 +2378,5 @@ fhandler_socket_unix::link (const char *newpath)
fhandler_disk_file fh (pc);
return fh.link (newpath);
}
+
+#endif /* __WITH_AF_UNIX */
diff --git a/winsup/cygwin/include/cygwin/socket.h b/winsup/cygwin/include/cygwin/socket.h
index 0360e71e8..77d87ff09 100644
--- a/winsup/cygwin/include/cygwin/socket.h
+++ b/winsup/cygwin/include/cygwin/socket.h
@@ -136,7 +136,7 @@ struct OLD_msghdr
#define AF_UNSPEC 0 /* unspecified */
/* FIXME: This is for testing only, while developing the new
fhandler_socket_unix class. */
-#ifdef __INSIDE_CYGWIN__
+#if defined (__INSIDE_CYGWIN__) && defined (__WITH_AF_UNIX)
#define AF_UNIX 31
#else
#define AF_UNIX 1 /* local to host (pipes, portals) */
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index 67cd96755..d152894ee 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -500,8 +500,12 @@ cygwin_socket (int af, int type, int protocol)
switch (af)
{
case AF_LOCAL:
+#ifndef __WITH_AF_UNIX
+ dev = af_local_dev;
+#else
case AF_UNIX:
dev = (af == AF_LOCAL) ? af_local_dev : af_unix_dev;
+#endif /* __WITH_AF_UNIX */
break;
case AF_INET:
case AF_INET6:
@@ -2285,8 +2289,12 @@ socketpair (int af, int type, int protocol, int sv[2])
switch (af)
{
case AF_LOCAL:
+#ifndef __WITH_AF_UNIX
+ dev = af_local_dev;
+#else
case AF_UNIX:
dev = (af == AF_LOCAL) ? af_local_dev : af_unix_dev;
+#endif /* __WITH_AF_UNIX */
break;
default:
set_errno (EAFNOSUPPORT);
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 3c4dd3077..d54ea1af9 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -951,7 +951,11 @@ path_conv::check (const char *src, unsigned opt,
return;
}
fileattr = sym.fileattr;
+#ifdef __WITH_AF_UNIX
dev.parse ((sym.pflags & PATH_REP) ? FH_UNIX : FH_LOCAL);
+#else
+ dev.parse (FH_LOCAL);
+#endif /* __WITH_AF_UNIX */
dev.setfs (1);
path_flags = sym.pflags;
goto out;
@@ -2370,6 +2374,7 @@ check_reparse_point_target (HANDLE h, bool remote, PREPARSE_DATA_BUFFER rp,
if (check_reparse_point_string (psymbuf))
return PATH_SYMLINK | PATH_REP;
}
+#ifdef __WITH_AF_UNIX
else if (rp->ReparseTag == IO_REPARSE_TAG_CYGUNIX)
{
PREPARSE_GUID_DATA_BUFFER rgp = (PREPARSE_GUID_DATA_BUFFER) rp;
@@ -2377,6 +2382,7 @@ check_reparse_point_target (HANDLE h, bool remote, PREPARSE_DATA_BUFFER rp,
if (memcmp (CYGWIN_SOCKET_GUID, &rgp->ReparseGuid, sizeof (GUID)) == 0)
return PATH_SOCKET | PATH_REP;
}
+#endif /* __WITH_AF_UNIX */
return 0;
}
diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h
index dca1e0498..69954d8a5 100644
--- a/winsup/cygwin/path.h
+++ b/winsup/cygwin/path.h
@@ -192,8 +192,12 @@ class path_conv
int is_fs_device () const {return isdevice () && is_fs_special ();}
int is_fs_special () const {return dev.is_fs_special ();}
int is_lnk_special () const {return is_fs_device () || isfifo () || is_lnk_symlink ();}
+#ifdef __WITH_AF_UNIX
int issocket () const {return dev.is_device (FH_LOCAL)
|| dev.is_device (FH_UNIX);}
+#else
+ int issocket () const {return dev.is_device (FH_LOCAL);}
+#endif /* __WITH_AF_UNIX */
int iscygexec () const {return path_flags & PATH_CYGWIN_EXEC;}
int isopen () const {return path_flags & PATH_OPEN;}
int isctty_capable () const {return path_flags & PATH_CTTY;}
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
index 076ca71f9..a580ac658 100644
--- a/winsup/cygwin/select.cc
+++ b/winsup/cygwin/select.cc
@@ -1602,6 +1602,8 @@ fhandler_socket_wsock::select_except (select_stuff *ss)
return s;
}
+#ifdef __WITH_AF_UNIX
+
select_record *
fhandler_socket_unix::select_read (select_stuff *ss)
{
@@ -1647,6 +1649,8 @@ fhandler_socket_unix::select_except (select_stuff *ss)
return s;
}
+#endif /* __WITH_AF_UNIX */
+
static int
peek_windows (select_record *me, bool)
{