public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: fhandler_mqueue: disable more methods, add fcntl
@ 2021-05-25 21:01 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2021-05-25 21:01 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=59ba43dd9ed05b697b52398a3c8fdc5d97ef1f76

commit 59ba43dd9ed05b697b52398a3c8fdc5d97ef1f76
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Tue May 25 23:00:32 2021 +0200

    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>

Diff:
---
 winsup/cygwin/fhandler.h         | 14 +++++++++++++-
 winsup/cygwin/fhandler_mqueue.cc | 21 ++++++++++++++++++---
 2 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index 4c475184e..a24c95b1b 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -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 ();
 
diff --git a/winsup/cygwin/fhandler_mqueue.cc b/winsup/cygwin/fhandler_mqueue.cc
index 6215d7b62..745c80643 100644
--- a/winsup/cygwin/fhandler_mqueue.cc
+++ b/winsup/cygwin/fhandler_mqueue.cc
@@ -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 */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-25 21:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-25 21:01 [newlib-cygwin] Cygwin: fhandler_mqueue: disable more methods, add fcntl Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).