Cygwin: fhandler_mqueue: disable more methods, add fcntl

Unsupported functionality returns EPERM, fcntl supports
only F_GETFD and F_GETFL.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2021-05-25 23:00:32 +02:00
parent 2b4c7f90d4
commit 59ba43dd9e
2 changed files with 31 additions and 4 deletions

View File

@ -3151,11 +3151,23 @@ public:
void fixup_after_fork (HANDLE);
int mkdir (mode_t);
#define NO_IMPL { set_errno (EPERM); return -1; }
ssize_t __reg3 fgetxattr (const char *, void *, size_t) NO_IMPL;
int __reg3 fsetxattr (const char *, const void *, size_t, int) NO_IMPL;
int __reg3 fadvise (off_t, off_t, int) NO_IMPL;
int __reg3 ftruncate (off_t, bool) NO_IMPL;
int link (const char *) NO_IMPL;
int mkdir (mode_t) NO_IMPL;
ssize_t __reg3 pread (void *, size_t, off_t, void *aio = NULL) NO_IMPL;
ssize_t __reg3 pwrite (void *, size_t, off_t, void *aio = NULL) NO_IMPL;
int lock (int, struct flock *) NO_IMPL;
int mand_lock (int, struct flock *) NO_IMPL;
void __reg3 read (void *, size_t&);
off_t lseek (off_t, int);
int __reg2 fstat (struct stat *);
int dup (fhandler_base *, int);
int fcntl (int cmd, intptr_t);
int ioctl (unsigned int, void *);
int close ();

View File

@ -376,10 +376,25 @@ fhandler_mqueue::get_proc_fd_name (char *buf)
}
int
fhandler_mqueue::mkdir (mode_t mode)
fhandler_mqueue::fcntl (int cmd, intptr_t arg)
{
set_errno (EPERM);
return -1;
int res;
switch (cmd)
{
case F_GETFD:
res = close_on_exec () ? FD_CLOEXEC : 0;
break;
case F_GETFL:
res = get_flags ();
debug_printf ("GETFL: %y", res);
break;
default:
set_errno (EINVAL);
res = -1;
break;
}
return res;
}
/* Do what fhandler_virtual does for read/lseek */