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: POSIX msg queues: create fhandler with object name
Date: Fri, 21 May 2021 13:34:17 +0000 (GMT)	[thread overview]
Message-ID: <20210521133417.DA76E3848026@sourceware.org> (raw)

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

commit 65cb82839aa6a68de19c189d778ac5ca2ddc20ea
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Fri May 21 13:42:40 2021 +0200

    Cygwin: POSIX msg queues: create fhandler with object name
    
    build_fh_dev can take the POSIX object name as parameter anyway,
    so use that and drop from mqinfo call.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/fhandler.h         | 2 +-
 winsup/cygwin/fhandler_mqueue.cc | 7 +++----
 winsup/cygwin/posix_ipc.cc       | 8 ++++----
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index 38533974c..b0618963d 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -3116,7 +3116,7 @@ public:
 
   char *get_proc_fd_name (char *);
 
-  struct mq_info *mqinfo (const char *, int8_t *, HANDLE, size_t, mode_t, int);
+  struct mq_info *mqinfo (int8_t *, HANDLE, size_t, mode_t, int);
   struct mq_info *mqinfo () { return &mqi; }
 
   void fixup_after_fork (HANDLE);
diff --git a/winsup/cygwin/fhandler_mqueue.cc b/winsup/cygwin/fhandler_mqueue.cc
index dc10a3671..d068d2ad5 100644
--- a/winsup/cygwin/fhandler_mqueue.cc
+++ b/winsup/cygwin/fhandler_mqueue.cc
@@ -20,22 +20,21 @@ fhandler_mqueue::fhandler_mqueue () :
 }
 
 struct mq_info *
-fhandler_mqueue::mqinfo (const char *name, int8_t *mptr, HANDLE sect,
-			 size_t size, mode_t mode, int flags)
+fhandler_mqueue::mqinfo (int8_t *mptr, HANDLE sect, size_t size, mode_t mode,
+			 int flags)
 {
   WCHAR buf[MAX_PATH];
   UNICODE_STRING uname;
   OBJECT_ATTRIBUTES attr;
   NTSTATUS status;
 
-  set_name (name);
   mqinfo ()->mqi_hdr = (struct mq_hdr *) mptr;
   mqinfo ()->mqi_sect = sect;
   mqinfo ()->mqi_sectsize = size;
   mqinfo ()->mqi_mode = mode;
   mqinfo ()->mqi_flags = flags;
 
-  __small_swprintf (buf, L"mqueue/mtx%s", name);
+  __small_swprintf (buf, L"mqueue/mtx%s", get_name ());
   RtlInitUnicodeString (&uname, buf);
   InitializeObjectAttributes (&attr, &uname, OBJ_OPENIF | OBJ_CASE_INSENSITIVE,
                               get_shared_parent_dir (),
diff --git a/winsup/cygwin/posix_ipc.cc b/winsup/cygwin/posix_ipc.cc
index 056fa966a..f82f146bd 100644
--- a/winsup/cygwin/posix_ipc.cc
+++ b/winsup/cygwin/posix_ipc.cc
@@ -413,12 +413,12 @@ mq_open (const char *name, int oflag, ...)
 
 	  if (fdm < 0)
 	    __leave;
-	  fh = (fhandler_mqueue *) build_fh_dev (*mqueue_dev);
+	  fh = (fhandler_mqueue *) build_fh_dev (*mqueue_dev, name);
 	  if (!fh)
 	    __leave;
 	  fdm = fh;
 
-	  mqinfo = fh->mqinfo (name, mptr, secth, filesize, mode, nonblock);
+	  mqinfo = fh->mqinfo (mptr, secth, filesize, mode, nonblock);
 	  if (!mqinfo)
 	    __leave;
 
@@ -506,12 +506,12 @@ mq_open (const char *name, int oflag, ...)
 
       if (fdm < 0)
 	__leave;
-      fh = (fhandler_mqueue *) build_fh_dev (*mqueue_dev);
+      fh = (fhandler_mqueue *) build_fh_dev (*mqueue_dev, name);
       if (!fh)
 	__leave;
       fdm = fh;
 
-      mqinfo = fh->mqinfo (name, mptr, secth, filesize, statbuff.st_mode,
+      mqinfo = fh->mqinfo (mptr, secth, filesize, statbuff.st_mode,
 			   nonblock);
       if (!mqinfo)
 	__leave;


                 reply	other threads:[~2021-05-21 13:34 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=20210521133417.DA76E3848026@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).