4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-31 03:20:28 +08:00

* fhandler.h (class fhandler_mailslot): Move down in file and change

parent class to fhandler_base_overlapped.  Remove declaration of
	method write.  Add declaraiotns for raw_read and raw_write.
	* fhandler_mailslot.cc (fhandler_mailslot::fhandler_mailslot): Call
	fhandler_base_overlapped constructor.
	(fhandler_mailslot::fstat): Call fhandler_base_overlapped::fstat.
	(fhandler_mailslot::open): Drop FILE_SYNCHRONOUS_IO_NONALERT flag from
	call to NtOpenFile.
	(fhandler_mailslot::raw_read): New method.
	(fhandler_mailslot::raw_write): Ditto.  Take over length algorithm from
	former write method.
	(fhandler_mailslot::write): Remove.
	(fhandler_mailslot::ioctl): Call fhandler_base_overlapped::ioctl.
This commit is contained in:
Corinna Vinschen 2011-05-04 12:56:12 +00:00
parent 412693ab65
commit 82fa6b929b
3 changed files with 42 additions and 20 deletions

View File

@ -1,3 +1,19 @@
2011-05-04 Corinna Vinschen <corinna@vinschen.de>
* fhandler.h (class fhandler_mailslot): Move down in file and change
parent class to fhandler_base_overlapped. Remove declaration of
method write. Add declaraiotns for raw_read and raw_write.
* fhandler_mailslot.cc (fhandler_mailslot::fhandler_mailslot): Call
fhandler_base_overlapped constructor.
(fhandler_mailslot::fstat): Call fhandler_base_overlapped::fstat.
(fhandler_mailslot::open): Drop FILE_SYNCHRONOUS_IO_NONALERT flag from
call to NtOpenFile.
(fhandler_mailslot::raw_read): New method.
(fhandler_mailslot::raw_write): Ditto. Take over length algorithm from
former write method.
(fhandler_mailslot::write): Remove.
(fhandler_mailslot::ioctl): Call fhandler_base_overlapped::ioctl.
2011-05-04 Corinna Vinschen <corinna@vinschen.de> 2011-05-04 Corinna Vinschen <corinna@vinschen.de>
* fhandler.h (fhandler_dev_tape::_lock): Add bool parameter. * fhandler.h (fhandler_dev_tape::_lock): Add bool parameter.

View File

@ -405,18 +405,6 @@ public:
virtual bool __stdcall has_ongoing_io () __attribute__ ((regparm (1))) {return false;} virtual bool __stdcall has_ongoing_io () __attribute__ ((regparm (1))) {return false;}
}; };
class fhandler_mailslot : public fhandler_base
{
POBJECT_ATTRIBUTES get_object_attr (OBJECT_ATTRIBUTES &, PUNICODE_STRING, int);
public:
fhandler_mailslot ();
int __stdcall fstat (struct __stat64 *buf) __attribute__ ((regparm (2)));
int open (int flags, mode_t mode = 0);
ssize_t __stdcall write (const void *ptr, size_t len);
int ioctl (unsigned int cmd, void *);
select_record *select_read (select_stuff *);
};
struct wsa_event struct wsa_event
{ {
LONG serial_number; LONG serial_number;
@ -667,6 +655,19 @@ public:
select_record *select_except (select_stuff *); select_record *select_except (select_stuff *);
}; };
class fhandler_mailslot : public fhandler_base_overlapped
{
POBJECT_ATTRIBUTES get_object_attr (OBJECT_ATTRIBUTES &, PUNICODE_STRING, int);
public:
fhandler_mailslot ();
int __stdcall fstat (struct __stat64 *buf) __attribute__ ((regparm (2)));
int open (int flags, mode_t mode = 0);
void __stdcall raw_read (void *ptr, size_t& len);
ssize_t __stdcall raw_write (const void *, size_t);
int ioctl (unsigned int cmd, void *);
select_record *select_read (select_stuff *);
};
class fhandler_dev_raw: public fhandler_base class fhandler_dev_raw: public fhandler_base
{ {
protected: protected:

View File

@ -1,6 +1,6 @@
/* fhandler_mailslot.cc. See fhandler.h for a description of the fhandler classes. /* fhandler_mailslot.cc. See fhandler.h for a description of the fhandler classes.
Copyright 2005, 2007, 2008, 2009, 2010 Red Hat, Inc. Copyright 2005, 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
This file is part of Cygwin. This file is part of Cygwin.
@ -21,7 +21,7 @@
/* fhandler_mailslot */ /* fhandler_mailslot */
fhandler_mailslot::fhandler_mailslot () fhandler_mailslot::fhandler_mailslot ()
: fhandler_base () : fhandler_base_overlapped ()
{ {
} }
@ -30,7 +30,7 @@ fhandler_mailslot::fstat (struct __stat64 *buf)
{ {
debug_printf ("here"); debug_printf ("here");
fhandler_base::fstat (buf); fhandler_base_overlapped::fstat (buf);
if (is_auto_device ()) if (is_auto_device ())
{ {
buf->st_mode = S_IFCHR | S_IRUSR | S_IWUSR; buf->st_mode = S_IFCHR | S_IRUSR | S_IWUSR;
@ -125,8 +125,7 @@ fhandler_mailslot::open (int flags, mode_t mode)
} }
status = NtOpenFile (&x, GENERIC_WRITE | SYNCHRONIZE, status = NtOpenFile (&x, GENERIC_WRITE | SYNCHRONIZE,
get_object_attr (attr, &path, flags), &io, get_object_attr (attr, &path, flags), &io,
FILE_SHARE_VALID_FLAGS, FILE_SHARE_VALID_FLAGS, 0);
FILE_SYNCHRONOUS_IO_NONALERT);
if (!NT_SUCCESS (status)) if (!NT_SUCCESS (status))
{ {
__seterrno_from_nt_status (status); __seterrno_from_nt_status (status);
@ -144,8 +143,14 @@ fhandler_mailslot::open (int flags, mode_t mode)
return res; return res;
} }
void __stdcall
fhandler_mailslot::raw_read (void *in_ptr, size_t& len)
{
read_overlapped (in_ptr, len);
}
ssize_t __stdcall ssize_t __stdcall
fhandler_mailslot::write (const void *ptr, size_t len) fhandler_mailslot::raw_write (const void *ptr, size_t len)
{ {
/* Check for 425/426 byte weirdness */ /* Check for 425/426 byte weirdness */
if (len == 425 || len == 426) if (len == 425 || len == 426)
@ -155,7 +160,7 @@ fhandler_mailslot::write (const void *ptr, size_t len)
memcpy (buf, ptr, len); memcpy (buf, ptr, len);
return raw_write (buf, 427); return raw_write (buf, 427);
} }
return raw_write (ptr, len); return write_overlapped (ptr, len);
} }
int int
@ -183,7 +188,7 @@ fhandler_mailslot::ioctl (unsigned int cmd, void *buf)
} }
/*FALLTHRU*/ /*FALLTHRU*/
default: default:
res = fhandler_base::ioctl (cmd, buf); res = fhandler_base_overlapped::ioctl (cmd, buf);
break; break;
} }
return res; return res;