* 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:
parent
412693ab65
commit
82fa6b929b
|
@ -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>
|
||||
|
||||
* fhandler.h (fhandler_dev_tape::_lock): Add bool parameter.
|
||||
|
|
|
@ -405,18 +405,6 @@ public:
|
|||
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
|
||||
{
|
||||
LONG serial_number;
|
||||
|
@ -667,6 +655,19 @@ public:
|
|||
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
|
||||
{
|
||||
protected:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* 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.
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
|||
/* fhandler_mailslot */
|
||||
|
||||
fhandler_mailslot::fhandler_mailslot ()
|
||||
: fhandler_base ()
|
||||
: fhandler_base_overlapped ()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ fhandler_mailslot::fstat (struct __stat64 *buf)
|
|||
{
|
||||
debug_printf ("here");
|
||||
|
||||
fhandler_base::fstat (buf);
|
||||
fhandler_base_overlapped::fstat (buf);
|
||||
if (is_auto_device ())
|
||||
{
|
||||
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,
|
||||
get_object_attr (attr, &path, flags), &io,
|
||||
FILE_SHARE_VALID_FLAGS,
|
||||
FILE_SYNCHRONOUS_IO_NONALERT);
|
||||
FILE_SHARE_VALID_FLAGS, 0);
|
||||
if (!NT_SUCCESS (status))
|
||||
{
|
||||
__seterrno_from_nt_status (status);
|
||||
|
@ -144,8 +143,14 @@ fhandler_mailslot::open (int flags, mode_t mode)
|
|||
return res;
|
||||
}
|
||||
|
||||
void __stdcall
|
||||
fhandler_mailslot::raw_read (void *in_ptr, size_t& len)
|
||||
{
|
||||
read_overlapped (in_ptr, len);
|
||||
}
|
||||
|
||||
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 */
|
||||
if (len == 425 || len == 426)
|
||||
|
@ -155,7 +160,7 @@ fhandler_mailslot::write (const void *ptr, size_t len)
|
|||
memcpy (buf, ptr, len);
|
||||
return raw_write (buf, 427);
|
||||
}
|
||||
return raw_write (ptr, len);
|
||||
return write_overlapped (ptr, len);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -183,7 +188,7 @@ fhandler_mailslot::ioctl (unsigned int cmd, void *buf)
|
|||
}
|
||||
/*FALLTHRU*/
|
||||
default:
|
||||
res = fhandler_base::ioctl (cmd, buf);
|
||||
res = fhandler_base_overlapped::ioctl (cmd, buf);
|
||||
break;
|
||||
}
|
||||
return res;
|
||||
|
|
Loading…
Reference in New Issue