Cygwin: timerfd/signalfd: return EINVAL from write
Linux returns EINVAL, "fd is attached to an object which is unsuitable for writing". If we don't handle write locally, write returns EBADF. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
173e067a31
commit
7f983079d4
|
@ -2650,6 +2650,7 @@ class fhandler_signalfd : public fhandler_base
|
|||
int signalfd (const sigset_t *mask, int flags);
|
||||
int __reg2 fstat (struct stat *buf);
|
||||
void __reg3 read (void *ptr, size_t& len);
|
||||
ssize_t __stdcall write (const void *, size_t);
|
||||
|
||||
int poll ();
|
||||
inline sigset_t get_sigset () const { return sigset; }
|
||||
|
@ -2693,6 +2694,7 @@ class fhandler_timerfd : public fhandler_base
|
|||
|
||||
int __reg2 fstat (struct stat *buf);
|
||||
void __reg3 read (void *ptr, size_t& len);
|
||||
ssize_t __stdcall write (const void *, size_t);
|
||||
int dup (fhandler_base *child, int);
|
||||
int ioctl (unsigned int, void *);
|
||||
int close ();
|
||||
|
|
|
@ -49,6 +49,7 @@ fhandler_signalfd::signalfd (const sigset_t *mask, int flags)
|
|||
nohandle (true);
|
||||
set_unique_id ();
|
||||
set_ino (get_unique_id ());
|
||||
set_flags (O_RDWR | O_BINARY);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -139,6 +140,13 @@ fhandler_signalfd::read (void *ptr, size_t& len)
|
|||
return;
|
||||
}
|
||||
|
||||
ssize_t __stdcall
|
||||
fhandler_signalfd::write (const void *, size_t)
|
||||
{
|
||||
set_errno (EINVAL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Called from select */
|
||||
int
|
||||
fhandler_signalfd::poll ()
|
||||
|
|
|
@ -44,12 +44,10 @@ fhandler_timerfd::timerfd (clockid_t clock_id, int flags)
|
|||
set_nonblocking (true);
|
||||
if (flags & TFD_CLOEXEC)
|
||||
set_close_on_exec (true);
|
||||
if (get_unique_id () == 0)
|
||||
{
|
||||
nohandle (true);
|
||||
set_unique_id ();
|
||||
set_ino (get_unique_id ());
|
||||
}
|
||||
nohandle (true);
|
||||
set_unique_id ();
|
||||
set_ino (get_unique_id ());
|
||||
set_flags (O_RDWR | O_BINARY);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -125,6 +123,13 @@ fhandler_timerfd::read (void *ptr, size_t& len)
|
|||
return;
|
||||
}
|
||||
|
||||
ssize_t __stdcall
|
||||
fhandler_timerfd::write (const void *, size_t)
|
||||
{
|
||||
set_errno (EINVAL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
HANDLE
|
||||
fhandler_timerfd::get_timerfd_handle ()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue