* fhandler.h (fhandler_serial::fhandler_serial): Change to only accept unit

argument.
* fhandler_serial.cc (fhandler_serial::fhandler_serial): Ditto.
(fhandler_serial::open): Avoid else when previous clause is a return().
* path.cc (get_devn): Alias /dev/ttyS0 -> /dev/com1, etc.
(get_device_number): Reallow standalone "com1" as a valid name for /dev/com1.
This commit is contained in:
Christopher Faylor 2001-10-29 05:28:24 +00:00
parent aa9d50a1c1
commit 711ded6d28
7 changed files with 34 additions and 15 deletions

View File

@ -1,3 +1,13 @@
2001-10-29 Christopher Faylor <cgf@redhat.com>
* fhandler.h (fhandler_serial::fhandler_serial): Change to only accept
unit argument.
* fhandler_serial.cc (fhandler_serial::fhandler_serial): Ditto.
(fhandler_serial::open): Avoid else when previous clause is a return().
* path.cc (get_devn): Alias /dev/ttyS0 -> /dev/com1, etc.
(get_device_number): Reallow standalone "com1" as a valid name for
/dev/com1.
2001-10-26 Christopher Faylor <cgf@redhat.com> 2001-10-26 Christopher Faylor <cgf@redhat.com>
* select.cc (MAKEready): Check for read_ready in loop since select_read * select.cc (MAKEready): Check for read_ready in loop since select_read

View File

@ -159,7 +159,6 @@ class fhandler_base
{ {
protected: protected:
DWORD status; DWORD status;
public:
private: private:
int access; int access;
HANDLE io_handle; HANDLE io_handle;
@ -579,7 +578,7 @@ public:
OVERLAPPED io_status; OVERLAPPED io_status;
/* Constructor */ /* Constructor */
fhandler_serial (DWORD devtype = FH_SERIAL, int unit = 0); fhandler_serial (int unit);
int open (path_conv *, int flags, mode_t mode); int open (path_conv *, int flags, mode_t mode);
int close (); int close ();

View File

@ -24,8 +24,8 @@ details. */
/**********************************************************************/ /**********************************************************************/
/* fhandler_serial */ /* fhandler_serial */
fhandler_serial::fhandler_serial (DWORD devtype, int unit) fhandler_serial::fhandler_serial (int unit)
: fhandler_base (devtype, unit), vmin_ (0), vtime_ (0), pgrp_ (myself->pgid) : fhandler_base (FH_SERIAL, unit), vmin_ (0), vtime_ (0), pgrp_ (myself->pgid)
{ {
set_need_fork_fixup (); set_need_fork_fixup ();
} }
@ -219,8 +219,8 @@ fhandler_serial::open (path_conv *, int flags, mode_t mode)
if (!(res = this->fhandler_base::open (NULL, flags, mode))) if (!(res = this->fhandler_base::open (NULL, flags, mode)))
return 0; return 0;
else
res = 1; res = 1;
(void) SetCommMask (get_handle (), EV_RXCHAR); (void) SetCommMask (get_handle (), EV_RXCHAR);

View File

@ -41,8 +41,8 @@ fhandler_dev_random* entropy_source;
/**********************************************************************/ /**********************************************************************/
/* fhandler_socket */ /* fhandler_socket */
fhandler_socket::fhandler_socket () : fhandler_socket::fhandler_socket ()
fhandler_base (FH_SOCKET) : fhandler_base (FH_SOCKET)
{ {
set_need_fork_fixup (); set_need_fork_fixup ();
prot_info_ptr = (LPWSAPROTOCOL_INFOA) cmalloc (HEAP_BUF, prot_info_ptr = (LPWSAPROTOCOL_INFOA) cmalloc (HEAP_BUF,

View File

@ -35,8 +35,8 @@ static DWORD WINAPI process_input (void *); // Input queue thread
static DWORD WINAPI process_output (void *); // Output queue thread static DWORD WINAPI process_output (void *); // Output queue thread
static DWORD WINAPI process_ioctl (void *); // Ioctl requests thread static DWORD WINAPI process_ioctl (void *); // Ioctl requests thread
fhandler_tty_master::fhandler_tty_master (int unit) : fhandler_tty_master::fhandler_tty_master (int unit)
fhandler_pty_master (FH_TTYM, unit), console (NULL), hThread (NULL) : fhandler_pty_master (FH_TTYM, unit), console (NULL), hThread (NULL)
{ {
} }

View File

@ -846,7 +846,10 @@ get_devn (const char *name, int &unit)
else if (deveqn ("com", 3) && (unit = digits (name + 3)) >= 0) else if (deveqn ("com", 3) && (unit = digits (name + 3)) >= 0)
devn = FH_SERIAL; devn = FH_SERIAL;
else if (deveqn ("ttyS", 4) && (unit = digits (name + 4)) >= 0) else if (deveqn ("ttyS", 4) && (unit = digits (name + 4)) >= 0)
devn = FH_SERIAL; {
devn = FH_SERIAL;
unit++;
}
else if (deveq ("pipe") || deveq ("piper") || deveq ("pipew")) else if (deveq ("pipe") || deveq ("piper") || deveq ("pipew"))
devn = FH_PIPE; devn = FH_PIPE;
else if (deveq ("tcp") || deveq ("udp") || deveq ("streamsocket") else if (deveq ("tcp") || deveq ("udp") || deveq ("streamsocket")
@ -979,14 +982,21 @@ get_device_number (const char *unix_path, const char *w32_path, int &unit)
devn = get_devn (unix_path, unit); devn = get_devn (unix_path, unit);
if (devn == FH_BAD && *w32_path == '\\' && wdeveqn ("\\dev\\", 5)) if (devn == FH_BAD && *w32_path == '\\' && wdeveqn ("\\dev\\", 5))
devn = get_devn (w32_path, unit); devn = get_devn (w32_path, unit);
if (devn == FH_BAD && udeveqn ("com", 3)
&& (unit = digits (unix_path + 3)) >= 0)
devn = FH_SERIAL;
if (devn == FH_BAD && wdeveqn ("\\\\.\\", 4)) if (devn == FH_BAD && wdeveqn ("\\\\.\\", 4))
devn = get_raw_device_number (unix_path + 5, w32_path + 4, unit); devn = get_raw_device_number (unix_path + 5, w32_path + 4, unit);
if (devn == FH_BAD) if (devn == FH_BAD)
devn = get_raw_device_number (unix_path + 5, NULL, unit); devn = get_raw_device_number (unix_path + 5, NULL, unit);
} }
else
{
char *p = strrchr (unix_path, '/');
if (p)
unix_path = p + 1;
if (udeveqn ("com", 3)
&& (unit = digits (unix_path + 3)) >= 0)
devn = FH_SERIAL;
}
return devn; return devn;
} }

View File

@ -352,7 +352,7 @@ out:
static int static int
set_bits (select_record *me, fd_set *readfds, fd_set *writefds, set_bits (select_record *me, fd_set *readfds, fd_set *writefds,
fd_set *exceptfds) fd_set *exceptfds)
{ {
int ready = 0; int ready = 0;
select_printf ("me %p, testing fd %d (%s)", me, me->fd, me->fh->get_name ()); select_printf ("me %p, testing fd %d (%s)", me, me->fd, me->fh->get_name ());