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>
This commit is contained in:
Corinna Vinschen 2021-05-21 13:42:40 +02:00
parent 3342549fcf
commit 65cb82839a
3 changed files with 8 additions and 9 deletions

View File

@ -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);

View File

@ -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 (),

View File

@ -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;