This is the mail archive of the cygwin-cvs@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[newlib-cygwin] Cygwin: Allow to build without experimental AF_UNIX code by default


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=6c55be9dbbd724edc5fd5b6c022e212f42754887

commit 6c55be9dbbd724edc5fd5b6c022e212f42754887
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Tue Jun 26 16:31:17 2018 +0200

    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>

Diff:
---
 winsup/cygwin/dtable.cc               | 2 ++
 winsup/cygwin/fhandler.h              | 7 +++++++
 winsup/cygwin/fhandler_socket_unix.cc | 4 ++++
 winsup/cygwin/include/cygwin/socket.h | 2 +-
 winsup/cygwin/net.cc                  | 8 ++++++++
 winsup/cygwin/path.cc                 | 6 ++++++
 winsup/cygwin/path.h                  | 4 ++++
 winsup/cygwin/select.cc               | 4 ++++
 8 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
index 9ebd45c..0ebeef0 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 39a674c..88653b6 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 295e07b..f2aa778 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 0360e71..77d87ff 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 67cd967..d152894 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 3c4dd30..d54ea1a 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 dca1e04..69954d8 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 076ca71..a580ac6 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)
 {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]