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: use queue name as key Date: Fri, 21 May 2021 13:34:02 +0000 (GMT) [thread overview] Message-ID: <20210521133402.B8F91384781C@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=6c901b928fd1a9b0e7a233912434910d74adc92d commit 6c901b928fd1a9b0e7a233912434910d74adc92d Author: Corinna Vinschen <corinna@vinschen.de> Date: Fri May 21 12:54:49 2021 +0200 Cygwin: POSIX msg queues: use queue name as key Drop creating a unique ID, the queue name itself is already unique. This allows to move ipc object generation into the fhandler in the next step. Signed-off-by: Corinna Vinschen <corinna@vinschen.de> Diff: --- winsup/cygwin/mqueue_types.h | 9 ++++----- winsup/cygwin/posix_ipc.cc | 13 ++++--------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/winsup/cygwin/mqueue_types.h b/winsup/cygwin/mqueue_types.h index eab372238..2e6fd38c5 100644 --- a/winsup/cygwin/mqueue_types.h +++ b/winsup/cygwin/mqueue_types.h @@ -30,15 +30,14 @@ struct mq_hdr int32_t mqh_free; /* index of first free message */ int32_t mqh_nwait; /* #threads blocked in mq_receive() */ pid_t mqh_pid; /* nonzero PID if mqh_event set */ - char mqh_uname[36]; /* unique name used to identify synchronization - objects connected to this queue */ + char __mqh_ext[36]; /* free for extensions */ union { struct sigevent mqh_event; /* for mq_notify() */ uint64_t __mqh_dummy[4]; }; - uint64_t __mgh_ext[4]; /* Free for extensions. */ - uint32_t mqh_magic; /* Expect MQI_MAGIC here, otherwise it's - an old-style message queue. */ + uint64_t __mgh_ext2[4]; /* free for extensions */ + uint32_t mqh_magic; /* Expect MQI_MAGIC here, otherwise it's + an old-style message queue. */ }; #pragma pack (pop) diff --git a/winsup/cygwin/posix_ipc.cc b/winsup/cygwin/posix_ipc.cc index e239ca4c7..401c78dd7 100644 --- a/winsup/cygwin/posix_ipc.cc +++ b/winsup/cygwin/posix_ipc.cc @@ -102,7 +102,7 @@ ipc_mutex_init (HANDLE *pmtx, const char *name) OBJECT_ATTRIBUTES attr; NTSTATUS status; - __small_swprintf (buf, L"mqueue/mtx_%s", name); + __small_swprintf (buf, L"mqueue/mtx%s", name); RtlInitUnicodeString (&uname, buf); InitializeObjectAttributes (&attr, &uname, OBJ_OPENIF | OBJ_CASE_INSENSITIVE, get_shared_parent_dir (), @@ -148,7 +148,7 @@ ipc_cond_init (HANDLE *pevt, const char *name, char sr) OBJECT_ATTRIBUTES attr; NTSTATUS status; - __small_swprintf (buf, L"mqueue/evt_%s%c", name, sr); + __small_swprintf (buf, L"mqueue/evt%s%c", name, sr); RtlInitUnicodeString (&uname, buf); InitializeObjectAttributes (&attr, &uname, OBJ_OPENIF | OBJ_CASE_INSENSITIVE, get_shared_parent_dir (), @@ -422,7 +422,6 @@ mq_open (const char *name, int oflag, ...) struct msg_hdr *msghdr; struct mq_attr *attr; struct mq_info *mqinfo = NULL; - LUID luid; size_t len = strlen (name); char mqname[ipc_names[mqueue].prefix_len + len]; @@ -492,7 +491,7 @@ mq_open (const char *name, int oflag, ...) mqinfo = fh->mqinfo (name, mptr, secth, filesize, mode, nonblock); /* Initialize mutex & condition variables */ - i = _mq_ipc_init (mqinfo, mqhdr->mqh_uname); + i = _mq_ipc_init (mqinfo, fh->get_name ()); if (i != 0) { set_errno (i); @@ -508,10 +507,6 @@ mq_open (const char *name, int oflag, ...) mqhdr->mqh_attr.mq_curmsgs = 0; mqhdr->mqh_nwait = 0; mqhdr->mqh_pid = 0; - NtAllocateLocallyUniqueId (&luid); - __small_sprintf (mqhdr->mqh_uname, "%016X%08x%08x", - hash_path_name (0, mqname), - luid.HighPart, luid.LowPart); mqhdr->mqh_head = 0; mqhdr->mqh_magic = MQI_MAGIC; index = sizeof (struct mq_hdr); @@ -596,7 +591,7 @@ mq_open (const char *name, int oflag, ...) nonblock); /* Initialize mutex & condition variable */ - i = _mq_ipc_init (mqinfo, mqhdr->mqh_uname); + i = _mq_ipc_init (mqinfo, fh->get_name ()); if (i != 0) { set_errno (i);
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=20210521133402.B8F91384781C@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: linkBe 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).