Remove trailing underscore from fhandler_base and friends, throughout.
* fhandler.h (fhandler_base::set_open_status): New method. Stores original open status. (fhandler_base::get_open_status): New method. Retrieves original open status. (fhandler_base::reset_to_open_binmode): New method. * fhandler.cc (fhandler_base::open): Save open status. (fhandler_base::init): Ditto. * fhandler_clipboard.cc (fhandler_clipboard::open): Ditto. * fhandler_console.cc (fhandler_console::open): Ditto. * fhandler_dsp.cc (fhandler_dsp::open): Ditto. * fhandler_dev_mem.cc (fhandler_dev_mem::open): Ditto. * fhandler_dev_random.cc (fhandler_dev_random::open): Ditto. * fhandler_serial.cc (fhandler_serial::open): Ditto. * fhandler_tty_slave.cc (fhandler_tty_slave::open): Ditto. * fhandler_tty_master.cc (fhandler_tty_master::open): Ditto. * fhandler_dev_zero.cc (fhandler_dev_zero::open): Ditto. * syscalls.cc (setmode): Rework so that 0 mode value causes reversion to open state. * fhandler_tty_slave.cc (fhandler_tty_slave::read): Use correct multiplier when converting from deciseconds to milliseconds.
This commit is contained in:
parent
9cf9c14668
commit
f3ea62a847
|
@ -1,3 +1,28 @@
|
||||||
|
Mon Apr 23 22:00:29 2001 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
|
Remove trailing underscore from fhandler_base and friends, throughout.
|
||||||
|
* fhandler.h (fhandler_base::set_open_status): New method. Stores
|
||||||
|
original open status.
|
||||||
|
(fhandler_base::get_open_status): New method. Retrieves original open
|
||||||
|
status.
|
||||||
|
(fhandler_base::reset_to_open_binmode): New method.
|
||||||
|
* fhandler.cc (fhandler_base::open): Save open status.
|
||||||
|
(fhandler_base::init): Ditto.
|
||||||
|
* fhandler_clipboard.cc (fhandler_clipboard::open): Ditto.
|
||||||
|
* fhandler_console.cc (fhandler_console::open): Ditto.
|
||||||
|
* fhandler_dsp.cc (fhandler_dsp::open): Ditto.
|
||||||
|
* fhandler_dev_mem.cc (fhandler_dev_mem::open): Ditto.
|
||||||
|
* fhandler_dev_random.cc (fhandler_dev_random::open): Ditto.
|
||||||
|
* fhandler_serial.cc (fhandler_serial::open): Ditto.
|
||||||
|
* fhandler_tty_slave.cc (fhandler_tty_slave::open): Ditto.
|
||||||
|
* fhandler_tty_master.cc (fhandler_tty_master::open): Ditto.
|
||||||
|
* fhandler_dev_zero.cc (fhandler_dev_zero::open): Ditto.
|
||||||
|
* syscalls.cc (setmode): Rework so that 0 mode value causes reversion
|
||||||
|
to open state.
|
||||||
|
|
||||||
|
* fhandler_tty_slave.cc (fhandler_tty_slave::read): Use correct
|
||||||
|
multiplier when converting from deciseconds to milliseconds.
|
||||||
|
|
||||||
Mon Apr 23 13:28:35 2001 Christopher Faylor <cgf@cygnus.com>
|
Mon Apr 23 13:28:35 2001 Christopher Faylor <cgf@cygnus.com>
|
||||||
|
|
||||||
* fhandler.h (fhandler_base::clear_r_binary): New method.
|
* fhandler.h (fhandler_base::clear_r_binary): New method.
|
||||||
|
|
|
@ -37,8 +37,8 @@ inline fhandler_base&
|
||||||
fhandler_base::operator =(fhandler_base &x)
|
fhandler_base::operator =(fhandler_base &x)
|
||||||
{
|
{
|
||||||
memcpy (this, &x, sizeof *this);
|
memcpy (this, &x, sizeof *this);
|
||||||
unix_path_name_ = x.unix_path_name_ ? cstrdup (x.unix_path_name_) : NULL;
|
unix_path_name = x.unix_path_name ? cstrdup (x.unix_path_name) : NULL;
|
||||||
win32_path_name_ = x.win32_path_name_ ? cstrdup (x.win32_path_name_) : NULL;
|
win32_path_name = x.win32_path_name ? cstrdup (x.win32_path_name) : NULL;
|
||||||
rabuf = NULL;
|
rabuf = NULL;
|
||||||
ralen = 0;
|
ralen = 0;
|
||||||
raixget = 0;
|
raixget = 0;
|
||||||
|
@ -154,33 +154,33 @@ fhandler_base::set_name (const char *unix_path, const char *win32_path, int unit
|
||||||
{
|
{
|
||||||
if (!no_free_names ())
|
if (!no_free_names ())
|
||||||
{
|
{
|
||||||
if (unix_path_name_ != NULL && unix_path_name_ != fhandler_disk_dummy_name)
|
if (unix_path_name != NULL && unix_path_name != fhandler_disk_dummy_name)
|
||||||
cfree (unix_path_name_);
|
cfree (unix_path_name);
|
||||||
if (win32_path_name_ != NULL && unix_path_name_ != fhandler_disk_dummy_name)
|
if (win32_path_name != NULL && unix_path_name != fhandler_disk_dummy_name)
|
||||||
cfree (win32_path_name_);
|
cfree (win32_path_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
unix_path_name_ = win32_path_name_ = NULL;
|
unix_path_name = win32_path_name = NULL;
|
||||||
if (unix_path == NULL || !*unix_path)
|
if (unix_path == NULL || !*unix_path)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
unix_path_name_ = cstrdup (unix_path);
|
unix_path_name = cstrdup (unix_path);
|
||||||
if (unix_path_name_ == NULL)
|
if (unix_path_name == NULL)
|
||||||
{
|
{
|
||||||
system_printf ("fatal error. strdup failed");
|
system_printf ("fatal error. strdup failed");
|
||||||
exit (ENOMEM);
|
exit (ENOMEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (win32_path)
|
if (win32_path)
|
||||||
win32_path_name_ = cstrdup (win32_path);
|
win32_path_name = cstrdup (win32_path);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const char *fmt = get_native_name ();
|
const char *fmt = get_native_name ();
|
||||||
win32_path_name_ = (char *) cmalloc (HEAP_STR, strlen(fmt) + 16);
|
win32_path_name = (char *) cmalloc (HEAP_STR, strlen(fmt) + 16);
|
||||||
__small_sprintf (win32_path_name_, fmt, unit);
|
__small_sprintf (win32_path_name, fmt, unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (win32_path_name_ == NULL)
|
if (win32_path_name == NULL)
|
||||||
{
|
{
|
||||||
system_printf ("fatal error. strdup failed");
|
system_printf ("fatal error. strdup failed");
|
||||||
exit (ENOMEM);
|
exit (ENOMEM);
|
||||||
|
@ -236,7 +236,7 @@ fhandler_base::raw_read (void *ptr, size_t ulen)
|
||||||
if (is_at_eof (get_handle (), errcode))
|
if (is_at_eof (get_handle (), errcode))
|
||||||
return 0;
|
return 0;
|
||||||
default:
|
default:
|
||||||
syscall_printf ("ReadFile %s failed, %E", unix_path_name_);
|
syscall_printf ("ReadFile %s failed, %E", unix_path_name);
|
||||||
__seterrno_from_win_error (errcode);
|
__seterrno_from_win_error (errcode);
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
|
@ -310,25 +310,25 @@ fhandler_base::open (int flags, mode_t mode)
|
||||||
|
|
||||||
if (get_device () == FH_TAPE)
|
if (get_device () == FH_TAPE)
|
||||||
{
|
{
|
||||||
access_ = GENERIC_READ | GENERIC_WRITE;
|
access = GENERIC_READ | GENERIC_WRITE;
|
||||||
}
|
}
|
||||||
else if ((flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_RDONLY)
|
else if ((flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_RDONLY)
|
||||||
{
|
{
|
||||||
access_ = GENERIC_READ;
|
access = GENERIC_READ;
|
||||||
}
|
}
|
||||||
else if ((flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_WRONLY)
|
else if ((flags & (O_RDONLY | O_WRONLY | O_RDWR)) == O_WRONLY)
|
||||||
{
|
{
|
||||||
access_ = GENERIC_WRITE;
|
access = GENERIC_WRITE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
access_ = GENERIC_READ | GENERIC_WRITE;
|
access = GENERIC_READ | GENERIC_WRITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allow reliable lseek on disk devices. */
|
/* Allow reliable lseek on disk devices. */
|
||||||
if (get_device () == FH_FLOPPY)
|
if (get_device () == FH_FLOPPY)
|
||||||
{
|
{
|
||||||
access_ |= GENERIC_READ;
|
access |= GENERIC_READ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: O_EXCL handling? */
|
/* FIXME: O_EXCL handling? */
|
||||||
|
@ -366,13 +366,13 @@ fhandler_base::open (int flags, mode_t mode)
|
||||||
if (get_device () == FH_SERIAL)
|
if (get_device () == FH_SERIAL)
|
||||||
file_attributes |= FILE_FLAG_OVERLAPPED;
|
file_attributes |= FILE_FLAG_OVERLAPPED;
|
||||||
|
|
||||||
x = CreateFileA (get_win32_name (), access_, shared,
|
x = CreateFileA (get_win32_name (), access, shared,
|
||||||
&sec_none, creation_distribution,
|
&sec_none, creation_distribution,
|
||||||
file_attributes,
|
file_attributes,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
syscall_printf ("%p = CreateFileA (%s, %p, %p, %p, %p, %p, 0)",
|
syscall_printf ("%p = CreateFileA (%s, %p, %p, %p, %p, %p, 0)",
|
||||||
x, get_win32_name (), access_, shared,
|
x, get_win32_name (), access, shared,
|
||||||
&sec_none, creation_distribution,
|
&sec_none, creation_distribution,
|
||||||
file_attributes);
|
file_attributes);
|
||||||
|
|
||||||
|
@ -390,7 +390,7 @@ fhandler_base::open (int flags, mode_t mode)
|
||||||
&& GetLastError () != ERROR_ALREADY_EXISTS)
|
&& GetLastError () != ERROR_ALREADY_EXISTS)
|
||||||
set_file_attribute (has_acls (), get_win32_name (), mode);
|
set_file_attribute (has_acls (), get_win32_name (), mode);
|
||||||
|
|
||||||
namehash_ = hash_path_name (0, get_win32_name ());
|
namehash = hash_path_name (0, get_win32_name ());
|
||||||
set_io_handle (x);
|
set_io_handle (x);
|
||||||
int bin;
|
int bin;
|
||||||
int fmode;
|
int fmode;
|
||||||
|
@ -425,6 +425,7 @@ fhandler_base::open (int flags, mode_t mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
res = 1;
|
res = 1;
|
||||||
|
set_open_status ();
|
||||||
done:
|
done:
|
||||||
syscall_printf ("%d = fhandler_base::open (%s, %p)", res, get_win32_name (),
|
syscall_printf ("%d = fhandler_base::open (%s, %p)", res, get_win32_name (),
|
||||||
flags);
|
flags);
|
||||||
|
@ -674,7 +675,7 @@ fhandler_base::lseek (off_t offset, int whence)
|
||||||
set_readahead_valid (0);
|
set_readahead_valid (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
debug_printf ("lseek (%s, %d, %d)", unix_path_name_, offset, whence);
|
debug_printf ("lseek (%s, %d, %d)", unix_path_name, offset, whence);
|
||||||
|
|
||||||
#if 0 /* lseek has no business messing about with text-mode stuff */
|
#if 0 /* lseek has no business messing about with text-mode stuff */
|
||||||
|
|
||||||
|
@ -995,7 +996,7 @@ fhandler_base::init (HANDLE f, DWORD a, mode_t bin)
|
||||||
set_io_handle (f);
|
set_io_handle (f);
|
||||||
set_r_binary (bin);
|
set_r_binary (bin);
|
||||||
set_w_binary (bin);
|
set_w_binary (bin);
|
||||||
access_ = a;
|
access = a;
|
||||||
a &= GENERIC_READ | GENERIC_WRITE;
|
a &= GENERIC_READ | GENERIC_WRITE;
|
||||||
if (a == GENERIC_READ)
|
if (a == GENERIC_READ)
|
||||||
set_flags (O_RDONLY);
|
set_flags (O_RDONLY);
|
||||||
|
@ -1003,6 +1004,7 @@ fhandler_base::init (HANDLE f, DWORD a, mode_t bin)
|
||||||
set_flags (O_WRONLY);
|
set_flags (O_WRONLY);
|
||||||
if (a == (GENERIC_READ | GENERIC_WRITE))
|
if (a == (GENERIC_READ | GENERIC_WRITE))
|
||||||
set_flags (O_RDWR);
|
set_flags (O_RDWR);
|
||||||
|
set_open_status ();
|
||||||
debug_printf ("created new fhandler_base for handle %p", f);
|
debug_printf ("created new fhandler_base for handle %p", f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1149,15 +1151,16 @@ fhandler_base::operator delete (void *p)
|
||||||
|
|
||||||
/* Normal I/O constructor */
|
/* Normal I/O constructor */
|
||||||
fhandler_base::fhandler_base (DWORD devtype, const char *name, int unit):
|
fhandler_base::fhandler_base (DWORD devtype, const char *name, int unit):
|
||||||
access_ (0),
|
access (0),
|
||||||
io_handle (NULL),
|
io_handle (NULL),
|
||||||
namehash_ (0),
|
namehash (0),
|
||||||
openflags_ (0),
|
openflags (0),
|
||||||
rabuf (NULL),
|
rabuf (NULL),
|
||||||
ralen (0),
|
ralen (0),
|
||||||
raixget (0),
|
raixget (0),
|
||||||
raixput (0),
|
raixput (0),
|
||||||
rabuflen (0)
|
rabuflen (0),
|
||||||
|
open_status (0)
|
||||||
{
|
{
|
||||||
status = devtype;
|
status = devtype;
|
||||||
int bin = __fmode & O_TEXT ? 0 : 1;
|
int bin = __fmode & O_TEXT ? 0 : 1;
|
||||||
|
@ -1168,7 +1171,7 @@ fhandler_base::fhandler_base (DWORD devtype, const char *name, int unit):
|
||||||
if (!get_w_binset ())
|
if (!get_w_binset ())
|
||||||
set_w_binary (bin);
|
set_w_binary (bin);
|
||||||
}
|
}
|
||||||
unix_path_name_ = win32_path_name_ = NULL;
|
unix_path_name = win32_path_name = NULL;
|
||||||
set_name (name, NULL, unit);
|
set_name (name, NULL, unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1177,14 +1180,14 @@ fhandler_base::~fhandler_base (void)
|
||||||
{
|
{
|
||||||
if (!no_free_names ())
|
if (!no_free_names ())
|
||||||
{
|
{
|
||||||
if (unix_path_name_ != NULL && unix_path_name_ != fhandler_disk_dummy_name)
|
if (unix_path_name != NULL && unix_path_name != fhandler_disk_dummy_name)
|
||||||
cfree (unix_path_name_);
|
cfree (unix_path_name);
|
||||||
if (win32_path_name_ != NULL && win32_path_name_ != fhandler_disk_dummy_name)
|
if (win32_path_name != NULL && win32_path_name != fhandler_disk_dummy_name)
|
||||||
cfree (win32_path_name_);
|
cfree (win32_path_name);
|
||||||
}
|
}
|
||||||
if (rabuf)
|
if (rabuf)
|
||||||
free (rabuf);
|
free (rabuf);
|
||||||
unix_path_name_ = win32_path_name_ = NULL;
|
unix_path_name = win32_path_name = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
|
@ -1195,7 +1198,7 @@ fhandler_disk_file::fhandler_disk_file (const char *name) :
|
||||||
{
|
{
|
||||||
set_cb (sizeof *this);
|
set_cb (sizeof *this);
|
||||||
set_no_free_names ();
|
set_no_free_names ();
|
||||||
unix_path_name_ = win32_path_name_ = fhandler_disk_dummy_name;
|
unix_path_name = win32_path_name = fhandler_disk_dummy_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -1227,7 +1230,7 @@ fhandler_disk_file::open (path_conv& real_path, int flags, mode_t mode)
|
||||||
{
|
{
|
||||||
if (get_win32_name () == fhandler_disk_dummy_name)
|
if (get_win32_name () == fhandler_disk_dummy_name)
|
||||||
{
|
{
|
||||||
win32_path_name_ = real_path.get_win32 ();
|
win32_path_name = real_path.get_win32 ();
|
||||||
set_no_free_names ();
|
set_no_free_names ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1255,7 +1258,7 @@ fhandler_disk_file::open (path_conv& real_path, int flags, mode_t mode)
|
||||||
which returns a valid handle when trying to open a file in a non
|
which returns a valid handle when trying to open a file in a non
|
||||||
existant directory. */
|
existant directory. */
|
||||||
if (real_path.has_buggy_open ()
|
if (real_path.has_buggy_open ()
|
||||||
&& GetFileAttributes (win32_path_name_) == (DWORD) -1)
|
&& GetFileAttributes (win32_path_name) == (DWORD) -1)
|
||||||
{
|
{
|
||||||
debug_printf ("Buggy open detected.");
|
debug_printf ("Buggy open detected.");
|
||||||
close ();
|
close ();
|
||||||
|
|
|
@ -65,7 +65,7 @@ enum
|
||||||
FH_W95LSBUG= 0x00400000, /* set when lseek is called as a flag that
|
FH_W95LSBUG= 0x00400000, /* set when lseek is called as a flag that
|
||||||
* _write should check if we've moved beyond
|
* _write should check if we've moved beyond
|
||||||
* EOF, zero filling if so. */
|
* EOF, zero filling if so. */
|
||||||
FH_NOFRNAME= 0x00800000, /* Set if shouldn't free unix_path_name_ and
|
FH_NOFRNAME= 0x00800000, /* Set if shouldn't free unix_path_name and
|
||||||
windows_path_name_ on destruction. */
|
windows_path_name_ on destruction. */
|
||||||
FH_NOEINTR = 0x01000000, /* Set if I/O should be uninterruptible. */
|
FH_NOEINTR = 0x01000000, /* Set if I/O should be uninterruptible. */
|
||||||
FH_FFIXUP = 0x02000000, /* Set if need to fixup after fork. */
|
FH_FFIXUP = 0x02000000, /* Set if need to fixup after fork. */
|
||||||
|
@ -145,14 +145,14 @@ private:
|
||||||
public:
|
public:
|
||||||
int cb;
|
int cb;
|
||||||
private:
|
private:
|
||||||
int access_;
|
int access;
|
||||||
HANDLE io_handle;
|
HANDLE io_handle;
|
||||||
|
|
||||||
unsigned long namehash_; /* hashed filename, used as inode num */
|
unsigned long namehash; /* hashed filename, used as inode num */
|
||||||
|
|
||||||
/* Full unix path name of this file */
|
/* Full unix path name of this file */
|
||||||
/* File open flags from open () and fcntl () calls */
|
/* File open flags from open () and fcntl () calls */
|
||||||
int openflags_;
|
int openflags;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
char *rabuf; /* used for crlf conversion in text files */
|
char *rabuf; /* used for crlf conversion in text files */
|
||||||
|
@ -161,8 +161,9 @@ protected:
|
||||||
size_t raixput;
|
size_t raixput;
|
||||||
size_t rabuflen;
|
size_t rabuflen;
|
||||||
|
|
||||||
char *unix_path_name_;
|
char *unix_path_name;
|
||||||
char *win32_path_name_;
|
char *win32_path_name;
|
||||||
|
DWORD open_status;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void set_name (const char * unix_path, const char * win32_path = NULL,
|
void set_name (const char * unix_path, const char * win32_path = NULL,
|
||||||
|
@ -180,14 +181,14 @@ public:
|
||||||
virtual int get_unit () { return 0; }
|
virtual int get_unit () { return 0; }
|
||||||
virtual BOOL is_slow () { return get_device () < FH_SLOW; }
|
virtual BOOL is_slow () { return get_device () < FH_SLOW; }
|
||||||
|
|
||||||
int get_access () { return access_; }
|
int get_access () { return access; }
|
||||||
void set_access (int x) { access_ = x; }
|
void set_access (int x) { access = x; }
|
||||||
|
|
||||||
int get_async () { return FHISSETF (ASYNC); }
|
int get_async () { return FHISSETF (ASYNC); }
|
||||||
void set_async (int x) { FHCONDSETF (x, ASYNC); }
|
void set_async (int x) { FHCONDSETF (x, ASYNC); }
|
||||||
|
|
||||||
int get_flags () { return openflags_; }
|
int get_flags () { return openflags; }
|
||||||
void set_flags (int x) { openflags_ = x; }
|
void set_flags (int x) { openflags = x; }
|
||||||
|
|
||||||
int get_w_binary () { return FHISSETF (WBINARY); }
|
int get_w_binary () { return FHISSETF (WBINARY); }
|
||||||
int get_r_binary () { return FHISSETF (RBINARY); }
|
int get_r_binary () { return FHISSETF (RBINARY); }
|
||||||
|
@ -199,6 +200,14 @@ public:
|
||||||
void set_r_binary (int b) { FHCONDSETF (b, RBINARY); FHSETF (RBINSET); }
|
void set_r_binary (int b) { FHCONDSETF (b, RBINARY); FHSETF (RBINSET); }
|
||||||
void clear_w_binary () {FHCLEARF (WBINARY); FHCLEARF (WBINSET); }
|
void clear_w_binary () {FHCLEARF (WBINARY); FHCLEARF (WBINSET); }
|
||||||
void clear_r_binary () {FHCLEARF (RBINARY); FHCLEARF (RBINSET); }
|
void clear_r_binary () {FHCLEARF (RBINARY); FHCLEARF (RBINSET); }
|
||||||
|
void set_open_status () {open_status = status;}
|
||||||
|
DWORD get_open_status () {return open_status;}
|
||||||
|
void reset_to_open_binmode ()
|
||||||
|
{
|
||||||
|
status = status & ~(FH_WBINARY | FH_WBINSET | FH_RBINARY | FH_RBINSET);
|
||||||
|
status = status | ((FH_WBINARY | FH_WBINSET | FH_RBINARY | FH_RBINSET)
|
||||||
|
& open_status);
|
||||||
|
}
|
||||||
|
|
||||||
int get_default_fmode (int flags);
|
int get_default_fmode (int flags);
|
||||||
|
|
||||||
|
@ -259,9 +268,9 @@ public:
|
||||||
void set_no_free_names (int val) { FHCONDSETF (val, NOFRNAME); }
|
void set_no_free_names (int val) { FHCONDSETF (val, NOFRNAME); }
|
||||||
void set_no_free_names () { FHSETF (NOFRNAME); }
|
void set_no_free_names () { FHSETF (NOFRNAME); }
|
||||||
|
|
||||||
const char *get_name () { return unix_path_name_; }
|
const char *get_name () { return unix_path_name; }
|
||||||
const char *get_win32_name () { return win32_path_name_; }
|
const char *get_win32_name () { return win32_path_name; }
|
||||||
unsigned long get_namehash () { return namehash_; }
|
unsigned long get_namehash () { return namehash; }
|
||||||
|
|
||||||
virtual void hclose (HANDLE h) {CloseHandle (h);}
|
virtual void hclose (HANDLE h) {CloseHandle (h);}
|
||||||
virtual void set_inheritance (HANDLE &h, int not_inheriting,
|
virtual void set_inheritance (HANDLE &h, int not_inheriting,
|
||||||
|
|
|
@ -76,6 +76,7 @@ fhandler_dev_clipboard::open (const char *, int flags, mode_t)
|
||||||
membuffer = NULL;
|
membuffer = NULL;
|
||||||
if (!cygnativeformat)
|
if (!cygnativeformat)
|
||||||
cygnativeformat = RegisterClipboardFormat (CYGWIN_NATIVE);
|
cygnativeformat = RegisterClipboardFormat (CYGWIN_NATIVE);
|
||||||
|
set_open_status ();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -562,6 +562,7 @@ fhandler_console::open (const char *, int flags, mode_t)
|
||||||
|
|
||||||
TTYCLEARF (RSTCONS);
|
TTYCLEARF (RSTCONS);
|
||||||
set_ctty (TTY_CONSOLE, flags);
|
set_ctty (TTY_CONSOLE, flags);
|
||||||
|
set_open_status ();
|
||||||
debug_printf ("opened conin$ %p, conout$ %p",
|
debug_printf ("opened conin$ %p, conout$ %p",
|
||||||
get_io_handle (), get_output_handle ());
|
get_io_handle (), get_output_handle ());
|
||||||
|
|
||||||
|
|
|
@ -432,10 +432,13 @@ fhandler_dev_dsp::open (const char *path, int flags, mode_t mode = 0)
|
||||||
audiochannels_ = 1;
|
audiochannels_ = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_audio.open(audiofreq_, audiobits_, audiochannels_))
|
if (!s_audio.open(audiofreq_, audiobits_, audiochannels_))
|
||||||
debug_printf("/dev/dsp: successfully opened\n");
|
|
||||||
else
|
|
||||||
debug_printf("/dev/dsp: failed to open\n");
|
debug_printf("/dev/dsp: failed to open\n");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
set_open_status ();
|
||||||
|
debug_printf("/dev/dsp: successfully opened\n");
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,6 +125,7 @@ fhandler_dev_mem::open (const char *, int flags, mode_t)
|
||||||
}
|
}
|
||||||
|
|
||||||
set_io_handle (mem);
|
set_io_handle (mem);
|
||||||
|
set_open_status ();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ int
|
||||||
fhandler_dev_random::open (const char *, int flags, mode_t)
|
fhandler_dev_random::open (const char *, int flags, mode_t)
|
||||||
{
|
{
|
||||||
set_flags (flags);
|
set_flags (flags);
|
||||||
|
set_open_status ();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -277,6 +277,7 @@ fhandler_serial::open (const char *name, int flags, mode_t mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
SetCommMask (get_handle (), EV_RXCHAR);
|
SetCommMask (get_handle (), EV_RXCHAR);
|
||||||
|
set_open_status ();
|
||||||
syscall_printf ("%p = fhandler_serial::open (%s, %p, %p)",
|
syscall_printf ("%p = fhandler_serial::open (%s, %p, %p)",
|
||||||
res, get_name (), flags, mode);
|
res, get_name (), flags, mode);
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -420,10 +420,10 @@ fhandler_tty_slave::fhandler_tty_slave (int num, const char *name) :
|
||||||
ttynum = num;
|
ttynum = num;
|
||||||
/* FIXME: This is wasteful. We should rewrite the set_name path to eliminate the
|
/* FIXME: This is wasteful. We should rewrite the set_name path to eliminate the
|
||||||
need for double allocates. */
|
need for double allocates. */
|
||||||
unix_path_name_ = (char *) crealloc (unix_path_name_, strlen (win32_path_name_) + 1);
|
unix_path_name = (char *) crealloc (unix_path_name, strlen (win32_path_name) + 1);
|
||||||
strcpy (unix_path_name_, win32_path_name_);
|
strcpy (unix_path_name, win32_path_name);
|
||||||
unix_path_name_[0] = unix_path_name_[4] = '/';
|
unix_path_name[0] = unix_path_name[4] = '/';
|
||||||
debug_printf ("unix '%s', win32 '%s'", unix_path_name_, win32_path_name_);
|
debug_printf ("unix '%s', win32 '%s'", unix_path_name, win32_path_name);
|
||||||
inuse = NULL;
|
inuse = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,6 +434,8 @@ fhandler_tty_slave::fhandler_tty_slave (const char *name) :
|
||||||
inuse = NULL;
|
inuse = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME: This function needs to close handles when it has
|
||||||
|
a failing condition. */
|
||||||
int
|
int
|
||||||
fhandler_tty_slave::open (const char *, int flags, mode_t)
|
fhandler_tty_slave::open (const char *, int flags, mode_t)
|
||||||
{
|
{
|
||||||
|
@ -531,6 +533,7 @@ fhandler_tty_slave::open (const char *, int flags, mode_t)
|
||||||
ProtectHandle1 (nh, to_pty);
|
ProtectHandle1 (nh, to_pty);
|
||||||
CloseHandle (tty_owner);
|
CloseHandle (tty_owner);
|
||||||
|
|
||||||
|
set_open_status ();
|
||||||
termios_printf ("tty%d opened", ttynum);
|
termios_printf ("tty%d opened", ttynum);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -632,7 +635,7 @@ fhandler_tty_slave::read (void *ptr, size_t len)
|
||||||
if (vmin == 0)
|
if (vmin == 0)
|
||||||
time_to_wait = INFINITE;
|
time_to_wait = INFINITE;
|
||||||
else
|
else
|
||||||
time_to_wait = (vtime == 0 ? INFINITE : 10 * vtime);
|
time_to_wait = (vtime == 0 ? INFINITE : 100 * vtime);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
time_to_wait = INFINITE;
|
time_to_wait = INFINITE;
|
||||||
|
@ -951,6 +954,7 @@ fhandler_pty_master::open (const char *, int flags, mode_t)
|
||||||
cygwin_shared->tty[ttynum]->common_init (this);
|
cygwin_shared->tty[ttynum]->common_init (this);
|
||||||
inuse = get_ttyp ()->create_inuse (TTY_MASTER_ALIVE, FALSE);
|
inuse = get_ttyp ()->create_inuse (TTY_MASTER_ALIVE, FALSE);
|
||||||
set_flags (flags);
|
set_flags (flags);
|
||||||
|
set_open_status ();
|
||||||
|
|
||||||
termios_printf ("opened pty master tty%d<%p>", ttynum, this);
|
termios_printf ("opened pty master tty%d<%p>", ttynum, this);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -58,6 +58,7 @@ fhandler_windows::open (const char *, int flags, mode_t)
|
||||||
{
|
{
|
||||||
set_flags (flags);
|
set_flags (flags);
|
||||||
set_close_on_exec_flag (1);
|
set_close_on_exec_flag (1);
|
||||||
|
set_open_status ();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ int
|
||||||
fhandler_dev_zero::open (const char *, int flags, mode_t)
|
fhandler_dev_zero::open (const char *, int flags, mode_t)
|
||||||
{
|
{
|
||||||
set_flags (flags);
|
set_flags (flags);
|
||||||
|
set_open_status ();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1651,21 +1651,18 @@ setmode (int fd, int mode)
|
||||||
else
|
else
|
||||||
res = 0;
|
res = 0;
|
||||||
|
|
||||||
if (mode & O_BINARY)
|
if (!mode)
|
||||||
|
p->reset_to_open_binmode ();
|
||||||
|
else if (mode & O_BINARY)
|
||||||
{
|
{
|
||||||
p->set_w_binary (1);
|
p->set_w_binary (1);
|
||||||
p->set_r_binary (1);
|
p->set_r_binary (1);
|
||||||
}
|
}
|
||||||
else if (mode & O_TEXT)
|
else
|
||||||
{
|
{
|
||||||
p->set_w_binary (0);
|
p->set_w_binary (0);
|
||||||
p->set_r_binary (0);
|
p->set_r_binary (0);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
p->clear_w_binary ();
|
|
||||||
p->clear_r_binary ();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_cygwin_istext_for_stdio (fd))
|
if (_cygwin_istext_for_stdio (fd))
|
||||||
setmode_mode = O_TEXT;
|
setmode_mode = O_TEXT;
|
||||||
|
@ -1677,7 +1674,6 @@ setmode (int fd, int mode)
|
||||||
syscall_printf ("setmode (%d<%s>, %s) returns %s\n", fd, p->get_name (),
|
syscall_printf ("setmode (%d<%s>, %s) returns %s\n", fd, p->get_name (),
|
||||||
mode & O_TEXT ? "text" : "binary",
|
mode & O_TEXT ? "text" : "binary",
|
||||||
res & O_TEXT ? "text" : "binary");
|
res & O_TEXT ? "text" : "binary");
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue