This is the mail archive of the
cygwin-cvs@cygwin.com
mailing list for the Cygwin project.
[newlib-cygwin] Cygwin: drop unused device nodes and clean up socket devices
- From: Corinna Vinschen <corinna at sourceware dot org>
- To: cygwin-cvs at sourceware dot org
- Date: 23 Feb 2018 12:34:46 -0000
- Subject: [newlib-cygwin] Cygwin: drop unused device nodes and clean up socket devices
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=03f380c2bc12bae32e8e0718c195e5d744011108
commit 03f380c2bc12bae32e8e0718c195e5d744011108
Author: Corinna Vinschen <corinna@vinschen.de>
Date: Fri Feb 23 13:32:51 2018 +0100
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>
Diff:
---
winsup/cygwin/devices.cc | 14 ++++----------
winsup/cygwin/devices.h | 22 +++++++---------------
winsup/cygwin/devices.in | 14 ++++----------
winsup/cygwin/dtable.cc | 10 +++-------
winsup/cygwin/fhandler_socket.cc | 2 +-
winsup/cygwin/net.cc | 6 +++---
winsup/cygwin/path.cc | 4 ++--
winsup/cygwin/path.h | 2 +-
8 files changed, 25 insertions(+), 49 deletions(-)
diff --git a/winsup/cygwin/devices.cc b/winsup/cygwin/devices.cc
index c2df919..2b65108 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 5fb3396..9924bad 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 3ec3249..47d127c 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 eb3081e..ae0315c 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 09c3678..0cdf6fa 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 7c58b91..6b88f91 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 cf64223..2bf84ab 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 469d607..8a73540 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;}