aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-12-28 16:56:21 +0000
committerChristopher Faylor <me@cgf.cx>2002-12-28 16:56:21 +0000
commit81bca5b8f04df9138379a4296bfdfc2a64e0a01c (patch)
tree23c8730314e6ab1d9e8efabe638a1c6ca7c5398c
parentc7a84641fa880b348c972e7013be0e9ac8fe16ef (diff)
downloadnewlib-81bca5b8f04df9138379a4296bfdfc2a64e0a01c.zip
newlib-81bca5b8f04df9138379a4296bfdfc2a64e0a01c.tar.gz
newlib-81bca5b8f04df9138379a4296bfdfc2a64e0a01c.tar.bz2
Eliminate unit argument and special unit fields from fhandler classes and
constructors throughout. * fhandler_mem.cc (fhandler_dev_mem::fhandler_dev_mem): Make decisions based on specific device type rather than unit number. * fhandler_random.cc (fhandler_dev_random::write): Ditto. (fhandler_dev_random::read): Ditto. * fhandler_socket.cc (fhandler_socket::set_connect_secret): Set device type to "urandom" after construction of entropy_source. * path.cc (windows_devices_names): Remove.
-rw-r--r--winsup/cygwin/fhandler_floppy.cc2
-rw-r--r--winsup/cygwin/fhandler_random.cc9
2 files changed, 5 insertions, 6 deletions
diff --git a/winsup/cygwin/fhandler_floppy.cc b/winsup/cygwin/fhandler_floppy.cc
index fe33831..86b6c80 100644
--- a/winsup/cygwin/fhandler_floppy.cc
+++ b/winsup/cygwin/fhandler_floppy.cc
@@ -42,7 +42,7 @@ fhandler_dev_floppy::is_eof (int)
return ret;
}
-fhandler_dev_floppy::fhandler_dev_floppy (int unit) : fhandler_dev_raw (FH_FLOPPY, unit)
+fhandler_dev_floppy::fhandler_dev_floppy () : fhandler_dev_raw (FH_FLOPPY)
{
}
diff --git a/winsup/cygwin/fhandler_random.cc b/winsup/cygwin/fhandler_random.cc
index 6d02db5..a9a6175 100644
--- a/winsup/cygwin/fhandler_random.cc
+++ b/winsup/cygwin/fhandler_random.cc
@@ -23,8 +23,8 @@ details. */
#define PSEUDO_MULTIPLIER (6364136223846793005LL)
#define PSEUDO_SHIFTVAL (21)
-fhandler_dev_random::fhandler_dev_random (int nunit)
- : fhandler_base (FH_RANDOM), unit (nunit), crypt_prov ((HCRYPTPROV) NULL)
+fhandler_dev_random::fhandler_dev_random ()
+ : fhandler_base (FH_RANDOM), crypt_prov ((HCRYPTPROV) NULL)
{
}
@@ -85,7 +85,7 @@ fhandler_dev_random::write (const void *ptr, size_t len)
memcpy (buf, ptr, limited_len);
/* Mess up system entropy source. Return error if device is /dev/random. */
- if (!crypt_gen_random (buf, limited_len) && unit == RANDOM)
+ if (!crypt_gen_random (buf, limited_len) && dev == FH_RANDOM)
{
__seterrno ();
return -1;
@@ -129,7 +129,7 @@ fhandler_dev_random::read (void *ptr, size_t& len)
/* If device is /dev/urandom, use pseudo number generator as fallback.
Don't do this for /dev/random since it's intended for uses that need
very high quality randomness. */
- if (unit == URANDOM)
+ if (dev == FH_URANDOM)
{
len = pseudo_read (ptr, len);
return;
@@ -159,7 +159,6 @@ int
fhandler_dev_random::dup (fhandler_base *child)
{
fhandler_dev_random *fhr = (fhandler_dev_random *) child;
- fhr->unit = unit;
fhr->crypt_prov = (HCRYPTPROV)NULL;
return 0;
}