From 7035d232f834f945632ec557c6abb90bfad8b29b Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 8 Jan 2017 09:14:11 -0600 Subject: [PATCH] NX server: Correct message queue names. Should not be at /dev, but rather relative to /var/mqueue. --- configs/mikroe-stm32f4/fulldemo/defconfig | 2 +- configs/sam3u-ek/nxwm/defconfig | 2 +- configs/sam4e-ek/nxwm/defconfig | 2 +- configs/sama5d3x-ek/nxwm/defconfig | 2 +- configs/sama5d4-ek/nxwm/defconfig | 2 +- configs/samv71-xult/nxwm/defconfig | 2 +- configs/samv71-xult/vnxwm/defconfig | 2 +- configs/shenzhou/nxwm/defconfig | 2 +- configs/sim/nxwm/defconfig | 2 +- configs/stm3220g-eval/nxwm/defconfig | 2 +- configs/stm3240g-eval/knxwm/defconfig | 2 +- configs/stm3240g-eval/nxwm/defconfig | 2 +- configs/stm32f429i-disco/nxwm/defconfig | 2 +- fs/mqueue/mq_open.c | 11 ++++++++++- include/nuttx/nx/nx.h | 2 +- include/nuttx/nx/nxmu.h | 4 ++-- 16 files changed, 26 insertions(+), 17 deletions(-) diff --git a/configs/mikroe-stm32f4/fulldemo/defconfig b/configs/mikroe-stm32f4/fulldemo/defconfig index f65118ce8c..158b700dbf 100644 --- a/configs/mikroe-stm32f4/fulldemo/defconfig +++ b/configs/mikroe-stm32f4/fulldemo/defconfig @@ -1663,7 +1663,7 @@ CONFIG_NXWM_TASKBAR_LEFT=y CONFIG_NXWM_STARTWINDOW_VSPACING=4 CONFIG_NXWM_STARTWINDOW_HSPACING=4 # CONFIG_NXWM_CUSTOM_STARTWINDOW_ICON is not set -CONFIG_NXWM_STARTWINDOW_MQNAME="/dev/nxwm" +CONFIG_NXWM_STARTWINDOW_MQNAME="nxwm" CONFIG_NXWM_STARTWINDOW_MXMSGS=32 CONFIG_NXWM_STARTWINDOW_MXMPRIO=42 CONFIG_NXWM_STARTWINDOW_PRIO=100 diff --git a/configs/sam3u-ek/nxwm/defconfig b/configs/sam3u-ek/nxwm/defconfig index 2ca2b66c45..befaa84f55 100644 --- a/configs/sam3u-ek/nxwm/defconfig +++ b/configs/sam3u-ek/nxwm/defconfig @@ -1195,7 +1195,7 @@ CONFIG_NXWM_TASKBAR_LEFT=y CONFIG_NXWM_STARTWINDOW_VSPACING=4 CONFIG_NXWM_STARTWINDOW_HSPACING=4 # CONFIG_NXWM_CUSTOM_STARTWINDOW_ICON is not set -CONFIG_NXWM_STARTWINDOW_MQNAME="/dev/nxwm" +CONFIG_NXWM_STARTWINDOW_MQNAME="nxwm" CONFIG_NXWM_STARTWINDOW_MXMSGS=32 CONFIG_NXWM_STARTWINDOW_MXMPRIO=42 CONFIG_NXWM_STARTWINDOW_PRIO=100 diff --git a/configs/sam4e-ek/nxwm/defconfig b/configs/sam4e-ek/nxwm/defconfig index 9e628e8a36..60e3a7ed6a 100644 --- a/configs/sam4e-ek/nxwm/defconfig +++ b/configs/sam4e-ek/nxwm/defconfig @@ -1522,7 +1522,7 @@ CONFIG_NXWM_TOOLBAR_FONTID=5 CONFIG_NXWM_STARTWINDOW_VSPACING=4 CONFIG_NXWM_STARTWINDOW_HSPACING=4 # CONFIG_NXWM_CUSTOM_STARTWINDOW_ICON is not set -CONFIG_NXWM_STARTWINDOW_MQNAME="/dev/nxwm" +CONFIG_NXWM_STARTWINDOW_MQNAME="nxwm" CONFIG_NXWM_STARTWINDOW_MXMSGS=32 CONFIG_NXWM_STARTWINDOW_MXMPRIO=42 CONFIG_NXWM_STARTWINDOW_PRIO=100 diff --git a/configs/sama5d3x-ek/nxwm/defconfig b/configs/sama5d3x-ek/nxwm/defconfig index 7473154461..fc158b4e7f 100644 --- a/configs/sama5d3x-ek/nxwm/defconfig +++ b/configs/sama5d3x-ek/nxwm/defconfig @@ -1281,7 +1281,7 @@ CONFIG_NXWM_TOOLBAR_FONTID=6 CONFIG_NXWM_STARTWINDOW_VSPACING=8 CONFIG_NXWM_STARTWINDOW_HSPACING=8 # CONFIG_NXWM_CUSTOM_STARTWINDOW_ICON is not set -CONFIG_NXWM_STARTWINDOW_MQNAME="/dev/nxwm" +CONFIG_NXWM_STARTWINDOW_MQNAME="nxwm" CONFIG_NXWM_STARTWINDOW_MXMSGS=32 CONFIG_NXWM_STARTWINDOW_MXMPRIO=42 CONFIG_NXWM_STARTWINDOW_PRIO=100 diff --git a/configs/sama5d4-ek/nxwm/defconfig b/configs/sama5d4-ek/nxwm/defconfig index c085fad274..b4f9f7505a 100644 --- a/configs/sama5d4-ek/nxwm/defconfig +++ b/configs/sama5d4-ek/nxwm/defconfig @@ -1674,7 +1674,7 @@ CONFIG_NXWM_TOOLBAR_FONTID=6 CONFIG_NXWM_STARTWINDOW_VSPACING=8 CONFIG_NXWM_STARTWINDOW_HSPACING=8 # CONFIG_NXWM_CUSTOM_STARTWINDOW_ICON is not set -CONFIG_NXWM_STARTWINDOW_MQNAME="/dev/nxwm" +CONFIG_NXWM_STARTWINDOW_MQNAME="nxwm" CONFIG_NXWM_STARTWINDOW_MXMSGS=32 CONFIG_NXWM_STARTWINDOW_MXMPRIO=42 CONFIG_NXWM_STARTWINDOW_PRIO=100 diff --git a/configs/samv71-xult/nxwm/defconfig b/configs/samv71-xult/nxwm/defconfig index 0fecc15f8f..109da74912 100644 --- a/configs/samv71-xult/nxwm/defconfig +++ b/configs/samv71-xult/nxwm/defconfig @@ -1321,7 +1321,7 @@ CONFIG_NXWM_TOOLBAR_FONTID=5 CONFIG_NXWM_STARTWINDOW_VSPACING=4 CONFIG_NXWM_STARTWINDOW_HSPACING=4 # CONFIG_NXWM_CUSTOM_STARTWINDOW_ICON is not set -CONFIG_NXWM_STARTWINDOW_MQNAME="/dev/nxwm" +CONFIG_NXWM_STARTWINDOW_MQNAME="nxwm" CONFIG_NXWM_STARTWINDOW_MXMSGS=32 CONFIG_NXWM_STARTWINDOW_MXMPRIO=42 CONFIG_NXWM_STARTWINDOW_PRIO=100 diff --git a/configs/samv71-xult/vnxwm/defconfig b/configs/samv71-xult/vnxwm/defconfig index 8a24d9550f..e0339cb27d 100644 --- a/configs/samv71-xult/vnxwm/defconfig +++ b/configs/samv71-xult/vnxwm/defconfig @@ -1514,7 +1514,7 @@ CONFIG_NXWM_TOOLBAR_FONTID=5 CONFIG_NXWM_STARTWINDOW_VSPACING=4 CONFIG_NXWM_STARTWINDOW_HSPACING=4 # CONFIG_NXWM_CUSTOM_STARTWINDOW_ICON is not set -CONFIG_NXWM_STARTWINDOW_MQNAME="/dev/nxwm" +CONFIG_NXWM_STARTWINDOW_MQNAME="nxwm" CONFIG_NXWM_STARTWINDOW_MXMSGS=32 CONFIG_NXWM_STARTWINDOW_MXMPRIO=42 CONFIG_NXWM_STARTWINDOW_PRIO=100 diff --git a/configs/shenzhou/nxwm/defconfig b/configs/shenzhou/nxwm/defconfig index 20eef97c8b..42d8ed2084 100644 --- a/configs/shenzhou/nxwm/defconfig +++ b/configs/shenzhou/nxwm/defconfig @@ -1673,7 +1673,7 @@ CONFIG_NXWM_TASKBAR_LEFT=y CONFIG_NXWM_STARTWINDOW_VSPACING=4 CONFIG_NXWM_STARTWINDOW_HSPACING=4 # CONFIG_NXWM_CUSTOM_STARTWINDOW_ICON is not set -CONFIG_NXWM_STARTWINDOW_MQNAME="/dev/nxwm" +CONFIG_NXWM_STARTWINDOW_MQNAME="nxwm" CONFIG_NXWM_STARTWINDOW_MXMSGS=32 CONFIG_NXWM_STARTWINDOW_MXMPRIO=42 CONFIG_NXWM_STARTWINDOW_PRIO=100 diff --git a/configs/sim/nxwm/defconfig b/configs/sim/nxwm/defconfig index 882196f437..7573cf969d 100644 --- a/configs/sim/nxwm/defconfig +++ b/configs/sim/nxwm/defconfig @@ -979,7 +979,7 @@ CONFIG_NXWM_TASKBAR_LEFT=y CONFIG_NXWM_STARTWINDOW_VSPACING=4 CONFIG_NXWM_STARTWINDOW_HSPACING=4 # CONFIG_NXWM_CUSTOM_STARTWINDOW_ICON is not set -CONFIG_NXWM_STARTWINDOW_MQNAME="/dev/nxwm" +CONFIG_NXWM_STARTWINDOW_MQNAME="nxwm" CONFIG_NXWM_STARTWINDOW_MXMSGS=32 CONFIG_NXWM_STARTWINDOW_MXMPRIO=42 CONFIG_NXWM_STARTWINDOW_PRIO=100 diff --git a/configs/stm3220g-eval/nxwm/defconfig b/configs/stm3220g-eval/nxwm/defconfig index dcc4cf28bf..a4889c9c5e 100644 --- a/configs/stm3220g-eval/nxwm/defconfig +++ b/configs/stm3220g-eval/nxwm/defconfig @@ -1706,7 +1706,7 @@ CONFIG_NXWM_TASKBAR_LEFT=y CONFIG_NXWM_STARTWINDOW_VSPACING=4 CONFIG_NXWM_STARTWINDOW_HSPACING=4 # CONFIG_NXWM_CUSTOM_STARTWINDOW_ICON is not set -CONFIG_NXWM_STARTWINDOW_MQNAME="/dev/nxwm" +CONFIG_NXWM_STARTWINDOW_MQNAME="nxwm" CONFIG_NXWM_STARTWINDOW_MXMSGS=32 CONFIG_NXWM_STARTWINDOW_MXMPRIO=42 CONFIG_NXWM_STARTWINDOW_PRIO=100 diff --git a/configs/stm3240g-eval/knxwm/defconfig b/configs/stm3240g-eval/knxwm/defconfig index 74a0b95fcc..f3db5debcd 100644 --- a/configs/stm3240g-eval/knxwm/defconfig +++ b/configs/stm3240g-eval/knxwm/defconfig @@ -1389,7 +1389,7 @@ CONFIG_NXWM_TASKBAR_LEFT=y CONFIG_NXWM_STARTWINDOW_VSPACING=4 CONFIG_NXWM_STARTWINDOW_HSPACING=4 # CONFIG_NXWM_CUSTOM_STARTWINDOW_ICON is not set -CONFIG_NXWM_STARTWINDOW_MQNAME="/dev/nxwm" +CONFIG_NXWM_STARTWINDOW_MQNAME="nxwm" CONFIG_NXWM_STARTWINDOW_MXMSGS=32 CONFIG_NXWM_STARTWINDOW_MXMPRIO=42 CONFIG_NXWM_STARTWINDOW_PRIO=100 diff --git a/configs/stm3240g-eval/nxwm/defconfig b/configs/stm3240g-eval/nxwm/defconfig index c9e8c477d9..3ba430caec 100644 --- a/configs/stm3240g-eval/nxwm/defconfig +++ b/configs/stm3240g-eval/nxwm/defconfig @@ -1711,7 +1711,7 @@ CONFIG_NXWM_TASKBAR_LEFT=y CONFIG_NXWM_STARTWINDOW_VSPACING=4 CONFIG_NXWM_STARTWINDOW_HSPACING=4 # CONFIG_NXWM_CUSTOM_STARTWINDOW_ICON is not set -CONFIG_NXWM_STARTWINDOW_MQNAME="/dev/nxwm" +CONFIG_NXWM_STARTWINDOW_MQNAME="nxwm" CONFIG_NXWM_STARTWINDOW_MXMSGS=32 CONFIG_NXWM_STARTWINDOW_MXMPRIO=42 CONFIG_NXWM_STARTWINDOW_PRIO=100 diff --git a/configs/stm32f429i-disco/nxwm/defconfig b/configs/stm32f429i-disco/nxwm/defconfig index da307b8cfb..03750fdf1a 100644 --- a/configs/stm32f429i-disco/nxwm/defconfig +++ b/configs/stm32f429i-disco/nxwm/defconfig @@ -1497,7 +1497,7 @@ CONFIG_NXWM_TASKBAR_LEFT=y CONFIG_NXWM_STARTWINDOW_VSPACING=4 CONFIG_NXWM_STARTWINDOW_HSPACING=4 # CONFIG_NXWM_CUSTOM_STARTWINDOW_ICON is not set -CONFIG_NXWM_STARTWINDOW_MQNAME="/dev/nxwm" +CONFIG_NXWM_STARTWINDOW_MQNAME="nxwm" CONFIG_NXWM_STARTWINDOW_MXMSGS=32 CONFIG_NXWM_STARTWINDOW_MXMPRIO=42 CONFIG_NXWM_STARTWINDOW_PRIO=100 diff --git a/fs/mqueue/mq_open.c b/fs/mqueue/mq_open.c index 23258f9338..a36497ed46 100644 --- a/fs/mqueue/mq_open.c +++ b/fs/mqueue/mq_open.c @@ -100,12 +100,21 @@ mqd_t mq_open(FAR const char *mq_name, int oflags, ...) /* Make sure that a non-NULL name is supplied */ - if (!mq_name) + if (mq_name == NULL || *mq_name == '/0') { errcode = EINVAL; goto errout; } + /* Skip over any leading '/'. All message queue paths are relative to + * CONFIG_FS_MQUEUE_MPATH. + */ + + while (*mq_name == '/') + { + mq_name++; + } + /* Get the full path to the message queue */ snprintf(fullpath, MAX_MQUEUE_PATH, CONFIG_FS_MQUEUE_MPATH "/%s", mq_name); diff --git a/include/nuttx/nx/nx.h b/include/nuttx/nx/nx.h index ae4fc97379..0650128bcc 100644 --- a/include/nuttx/nx/nx.h +++ b/include/nuttx/nx/nx.h @@ -64,7 +64,7 @@ /* Default server MQ name used by nx_run() macro */ -#define NX_DEFAULT_SERVER_MQNAME "/dev/nxs" +#define NX_DEFAULT_SERVER_MQNAME "nxs" /* Mouse button bits */ diff --git a/include/nuttx/nx/nxmu.h b/include/nuttx/nx/nxmu.h index 49940aafd9..ca8481ebaf 100644 --- a/include/nuttx/nx/nxmu.h +++ b/include/nuttx/nx/nxmu.h @@ -71,8 +71,8 @@ /* Used to create unique client MQ name */ -#define NX_CLIENT_MQNAMEFMT "/dev/nxc%d" -#define NX_CLIENT_MXNAMELEN (16) +#define NX_CLIENT_MQNAMEFMT "nxc%d" +#define NX_CLIENT_MXNAMELEN (12) #define NX_MXSVRMSGLEN (64) /* Maximum size of a client->server command */ #define NX_MXEVENTLEN (64) /* Maximum size of an event */