public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: fhandler_mqueue: disable more methods, add fcntl
Date: Tue, 25 May 2021 21:01:13 +0000 (GMT)	[thread overview]
Message-ID: <20210525210113.AD0913945049@sourceware.org> (raw)

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 */


                 reply	other threads:[~2021-05-25 21:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210525210113.AD0913945049@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).