summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2018-02-23 13:32:51 +0100
committerCorinna Vinschen <corinna@vinschen.de>2018-02-23 13:32:51 +0100
commit03f380c2bc12bae32e8e0718c195e5d744011108 (patch)
tree3f91dba9645d4173914d4c5632f8aa4d75f22a46
parentb8a57a2d2a13887ef7e7b60bbc3b9666bab64c71 (diff)
downloadcygnal-03f380c2bc12bae32e8e0718c195e5d744011108.tar.gz
cygnal-03f380c2bc12bae32e8e0718c195e5d744011108.tar.bz2
cygnal-03f380c2bc12bae32e8e0718c195e5d744011108.zip
Cygwin: drop unused device nodes and clean up socket devices
* Rename DEV_TCP_MAJOR to DEV_SOCK_MAJOR * Drop FH_TCP, FH_UDP, FH_ICMP in favor of single FH_INET * Drop FH_UNIX, FH_STREAM, FH_DGRAM in favor of single FH_LOCAL Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
-rw-r--r--winsup/cygwin/devices.cc14
-rw-r--r--winsup/cygwin/devices.h22
-rw-r--r--winsup/cygwin/devices.in14
-rw-r--r--winsup/cygwin/dtable.cc10
-rw-r--r--winsup/cygwin/fhandler_socket.cc2
-rw-r--r--winsup/cygwin/net.cc6
-rw-r--r--winsup/cygwin/path.cc4
-rw-r--r--winsup/cygwin/path.h2
8 files changed, 25 insertions, 49 deletions
diff --git a/winsup/cygwin/devices.cc b/winsup/cygwin/devices.cc
index c2df919d4..2b65108a3 100644
--- a/winsup/cygwin/devices.cc
+++ b/winsup/cygwin/devices.cc
@@ -120,17 +120,11 @@ const _device dev_piper_storage =
const _device dev_pipew_storage =
{"", {FH_PIPEW}, "", exists_internal};
-const _device dev_tcp_storage =
- {"", {FH_TCP}, "", exists_internal};
+const _device dev_af_inet_storage =
+ {"", {FH_INET}, "", exists_internal};
-const _device dev_udp_storage =
- {"", {FH_UDP}, "", exists_internal};
-
-const _device dev_stream_storage =
- {"", {FH_STREAM}, "", exists_internal};
-
-const _device dev_dgram_storage =
- {"", {FH_DGRAM}, "", exists_internal};
+const _device dev_af_local_storage =
+ {"", {FH_LOCAL}, "", exists_internal};
const _device dev_bad_storage =
{"", {FH_NADA}, "", exists_internal};
diff --git a/winsup/cygwin/devices.h b/winsup/cygwin/devices.h
index 5fb3396c0..9924bad01 100644
--- a/winsup/cygwin/devices.h
+++ b/winsup/cygwin/devices.h
@@ -241,13 +241,9 @@ enum fh_devices
DEV_SOUND_MAJOR = 14,
FH_OSS_DSP = FHDEV (DEV_SOUND_MAJOR, 3),
- DEV_TCP_MAJOR = 30,
- FH_TCP = FHDEV (DEV_TCP_MAJOR, 36),
- FH_UDP = FHDEV (DEV_TCP_MAJOR, 39),
- FH_ICMP = FHDEV (DEV_TCP_MAJOR, 33),
- FH_UNIX = FHDEV (DEV_TCP_MAJOR, 120),
- FH_STREAM = FHDEV (DEV_TCP_MAJOR, 121),
- FH_DGRAM = FHDEV (DEV_TCP_MAJOR, 122),
+ DEV_SOCK_MAJOR = 30,
+ FH_INET = FHDEV (DEV_SOCK_MAJOR, 36),
+ FH_LOCAL = FHDEV (DEV_SOCK_MAJOR, 120),
FH_NADA = FHDEV (0, 0),
FH_ERROR = FHDEV (255, 255) /* Set by fh constructor when error detected */
@@ -394,14 +390,10 @@ extern const _device *ptmx_dev;
extern const _device *ptys_dev;
extern const _device *urandom_dev;
-extern const _device dev_dgram_storage;
-#define dgram_dev ((device *) &dev_dgram_storage)
-extern const _device dev_stream_storage;
-#define stream_dev ((device *) &dev_stream_storage)
-extern const _device dev_tcp_storage;
-#define tcp_dev ((device *) &dev_tcp_storage)
-extern const _device dev_udp_storage;
-#define udp_dev ((device *) &dev_udp_storage)
+extern const _device dev_af_local_storage;
+#define af_local_dev ((device *) &dev_af_local_storage)
+extern const _device dev_af_inet_storage;
+#define af_inet_dev ((device *) &dev_af_inet_storage)
extern const _device dev_piper_storage;
#define piper_dev ((device *) &dev_piper_storage)
diff --git a/winsup/cygwin/devices.in b/winsup/cygwin/devices.in
index 3ec32493b..47d127cb3 100644
--- a/winsup/cygwin/devices.in
+++ b/winsup/cygwin/devices.in
@@ -116,17 +116,11 @@ const _device dev_piper_storage =
const _device dev_pipew_storage =
{"", {FH_PIPEW}, "", exists_internal};
-const _device dev_tcp_storage =
- {"", {FH_TCP}, "", exists_internal};
+const _device dev_af_inet_storage =
+ {"", {FH_INET}, "", exists_internal};
-const _device dev_udp_storage =
- {"", {FH_UDP}, "", exists_internal};
-
-const _device dev_stream_storage =
- {"", {FH_STREAM}, "", exists_internal};
-
-const _device dev_dgram_storage =
- {"", {FH_DGRAM}, "", exists_internal};
+const _device dev_af_local_storage =
+ {"", {FH_LOCAL}, "", exists_internal};
const _device dev_bad_storage =
{"", {FH_NADA}, "", exists_internal};
diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
index eb3081e49..ae0315cd3 100644
--- a/winsup/cygwin/dtable.cc
+++ b/winsup/cygwin/dtable.cc
@@ -311,7 +311,7 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle)
(char *) &rcv, &len)))
{
/* socket */
- dev = *tcp_dev;
+ dev = *af_inet_dev;
name[0] = '\0';
}
else if (fd == 0)
@@ -514,14 +514,10 @@ fh_alloc (path_conv& pc)
case FH_PIPEW:
fh = cnew (fhandler_pipe);
break;
- case FH_TCP:
- case FH_UDP:
- case FH_ICMP:
+ case FH_INET:
fh = cnew (fhandler_socket_inet);
break;
- case FH_UNIX:
- case FH_STREAM:
- case FH_DGRAM:
+ case FH_LOCAL:
fh = cnew (fhandler_socket_local);
break;
case FH_FS:
diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc
index 09c367846..0cdf6fa69 100644
--- a/winsup/cygwin/fhandler_socket.cc
+++ b/winsup/cygwin/fhandler_socket.cc
@@ -871,7 +871,7 @@ fhandler_socket::fstat (struct stat *buf)
res = fhandler_socket::fstat (buf);
if (!res)
{
- buf->st_dev = FHDEV (DEV_TCP_MAJOR, 0);
+ buf->st_dev = FHDEV (DEV_SOCK_MAJOR, 0);
if (!(buf->st_ino = get_plain_ino ()))
sscanf (get_name (), "/proc/%*d/fd/socket:[%lld]",
(long long *) &buf->st_ino);
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index 7c58b91fb..6b88f9105 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -526,7 +526,7 @@ cygwin_socket (int af, int type, int protocol)
set_errno (EPROTONOSUPPORT);
goto done;
}
- dev = type == SOCK_STREAM ? stream_dev : dgram_dev;
+ dev = af_local_dev;
break;
case AF_INET:
case AF_INET6:
@@ -535,7 +535,7 @@ cygwin_socket (int af, int type, int protocol)
set_errno (EINVAL);
goto done;
}
- dev = type == SOCK_STREAM ? tcp_dev : udp_dev;
+ dev = af_inet_dev;
break;
default:
set_errno (EAFNOSUPPORT);
@@ -2323,7 +2323,7 @@ socketpair (int af, int type, int protocol, int *sb)
set_errno (EPROTONOSUPPORT);
goto done;
}
- dev = type == SOCK_STREAM ? stream_dev : dgram_dev;
+ dev = af_local_dev;
break;
default:
set_errno (EAFNOSUPPORT);
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index cf6422341..2bf84abbe 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -864,7 +864,7 @@ path_conv::check (const char *src, unsigned opt,
if (component == 0)
{
fileattr = 0;
- dev.parse (FH_TCP);
+ dev.parse (FH_INET);
}
break;
case virt_fsdir:
@@ -959,7 +959,7 @@ path_conv::check (const char *src, unsigned opt,
return;
}
fileattr = sym.fileattr;
- dev.parse (FH_UNIX);
+ dev.parse (FH_LOCAL);
dev.setfs (1);
goto out;
}
diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h
index 469d6076d..8a7354017 100644
--- a/winsup/cygwin/path.h
+++ b/winsup/cygwin/path.h
@@ -192,7 +192,7 @@ 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 ();}
- int issocket () const {return dev.is_device (FH_UNIX);}
+ int issocket () const {return dev.is_device (FH_LOCAL);}
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;}