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:
parent
3342549fcf
commit
65cb82839a
|
@ -3116,7 +3116,7 @@ public:
|
||||||
|
|
||||||
char *get_proc_fd_name (char *);
|
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; }
|
struct mq_info *mqinfo () { return &mqi; }
|
||||||
|
|
||||||
void fixup_after_fork (HANDLE);
|
void fixup_after_fork (HANDLE);
|
||||||
|
|
|
@ -20,22 +20,21 @@ fhandler_mqueue::fhandler_mqueue () :
|
||||||
}
|
}
|
||||||
|
|
||||||
struct mq_info *
|
struct mq_info *
|
||||||
fhandler_mqueue::mqinfo (const char *name, int8_t *mptr, HANDLE sect,
|
fhandler_mqueue::mqinfo (int8_t *mptr, HANDLE sect, size_t size, mode_t mode,
|
||||||
size_t size, mode_t mode, int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
WCHAR buf[MAX_PATH];
|
WCHAR buf[MAX_PATH];
|
||||||
UNICODE_STRING uname;
|
UNICODE_STRING uname;
|
||||||
OBJECT_ATTRIBUTES attr;
|
OBJECT_ATTRIBUTES attr;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
|
||||||
set_name (name);
|
|
||||||
mqinfo ()->mqi_hdr = (struct mq_hdr *) mptr;
|
mqinfo ()->mqi_hdr = (struct mq_hdr *) mptr;
|
||||||
mqinfo ()->mqi_sect = sect;
|
mqinfo ()->mqi_sect = sect;
|
||||||
mqinfo ()->mqi_sectsize = size;
|
mqinfo ()->mqi_sectsize = size;
|
||||||
mqinfo ()->mqi_mode = mode;
|
mqinfo ()->mqi_mode = mode;
|
||||||
mqinfo ()->mqi_flags = flags;
|
mqinfo ()->mqi_flags = flags;
|
||||||
|
|
||||||
__small_swprintf (buf, L"mqueue/mtx%s", name);
|
__small_swprintf (buf, L"mqueue/mtx%s", get_name ());
|
||||||
RtlInitUnicodeString (&uname, buf);
|
RtlInitUnicodeString (&uname, buf);
|
||||||
InitializeObjectAttributes (&attr, &uname, OBJ_OPENIF | OBJ_CASE_INSENSITIVE,
|
InitializeObjectAttributes (&attr, &uname, OBJ_OPENIF | OBJ_CASE_INSENSITIVE,
|
||||||
get_shared_parent_dir (),
|
get_shared_parent_dir (),
|
||||||
|
|
|
@ -413,12 +413,12 @@ mq_open (const char *name, int oflag, ...)
|
||||||
|
|
||||||
if (fdm < 0)
|
if (fdm < 0)
|
||||||
__leave;
|
__leave;
|
||||||
fh = (fhandler_mqueue *) build_fh_dev (*mqueue_dev);
|
fh = (fhandler_mqueue *) build_fh_dev (*mqueue_dev, name);
|
||||||
if (!fh)
|
if (!fh)
|
||||||
__leave;
|
__leave;
|
||||||
fdm = fh;
|
fdm = fh;
|
||||||
|
|
||||||
mqinfo = fh->mqinfo (name, mptr, secth, filesize, mode, nonblock);
|
mqinfo = fh->mqinfo (mptr, secth, filesize, mode, nonblock);
|
||||||
if (!mqinfo)
|
if (!mqinfo)
|
||||||
__leave;
|
__leave;
|
||||||
|
|
||||||
|
@ -506,12 +506,12 @@ mq_open (const char *name, int oflag, ...)
|
||||||
|
|
||||||
if (fdm < 0)
|
if (fdm < 0)
|
||||||
__leave;
|
__leave;
|
||||||
fh = (fhandler_mqueue *) build_fh_dev (*mqueue_dev);
|
fh = (fhandler_mqueue *) build_fh_dev (*mqueue_dev, name);
|
||||||
if (!fh)
|
if (!fh)
|
||||||
__leave;
|
__leave;
|
||||||
fdm = fh;
|
fdm = fh;
|
||||||
|
|
||||||
mqinfo = fh->mqinfo (name, mptr, secth, filesize, statbuff.st_mode,
|
mqinfo = fh->mqinfo (mptr, secth, filesize, statbuff.st_mode,
|
||||||
nonblock);
|
nonblock);
|
||||||
if (!mqinfo)
|
if (!mqinfo)
|
||||||
__leave;
|
__leave;
|
||||||
|
|
Loading…
Reference in New Issue