summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/nshlib/nsh_fscmds.c4
-rw-r--r--nuttx/configs/spark/composite/defconfig2
-rw-r--r--nuttx/configs/spark/nsh/defconfig2
-rw-r--r--nuttx/configs/spark/usbmsc/defconfig2
-rw-r--r--nuttx/configs/spark/usbnsh/defconfig2
-rw-r--r--nuttx/configs/spark/usbserial/defconfig2
-rw-r--r--nuttx/fs/semaphore/Kconfig2
-rw-r--r--nuttx/fs/vfs/fs_open.c5
-rw-r--r--nuttx/fs/vfs/fs_stat.c31
-rw-r--r--nuttx/fs/vfs/fs_unlink.c6
-rw-r--r--nuttx/include/sys/stat.h8
11 files changed, 52 insertions, 14 deletions
diff --git a/apps/nshlib/nsh_fscmds.c b/apps/nshlib/nsh_fscmds.c
index 550e80ac5..e4ecbdb67 100644
--- a/apps/nshlib/nsh_fscmds.c
+++ b/apps/nshlib/nsh_fscmds.c
@@ -284,6 +284,10 @@ static int ls_handler(FAR struct nsh_vtbl_s *vtbl, FAR const char *dirpath,
{
details[0]='b';
}
+ else
+ {
+ details[0]='?';
+ }
if ((buf.st_mode & S_IRUSR) != 0)
{
diff --git a/nuttx/configs/spark/composite/defconfig b/nuttx/configs/spark/composite/defconfig
index a9e5dc654..e1e587827 100644
--- a/nuttx/configs/spark/composite/defconfig
+++ b/nuttx/configs/spark/composite/defconfig
@@ -645,7 +645,7 @@ CONFIG_DISABLE_PSEUDOFS_OPERATIONS=y
CONFIG_FS_READABLE=y
CONFIG_FS_WRITABLE=y
ONFIG_FS_NAMED_SEMAPHORES=y
-CONFIG_FS_NAMED_SEMPATH="/var/sem"
+CONFIG_FS_NAMED_SEMPATH="/var/lock"
# CONFIG_FS_RAMMAP is not set
CONFIG_FS_FAT=y
CONFIG_FAT_LCNAMES=y
diff --git a/nuttx/configs/spark/nsh/defconfig b/nuttx/configs/spark/nsh/defconfig
index ba2f2c000..edabbf497 100644
--- a/nuttx/configs/spark/nsh/defconfig
+++ b/nuttx/configs/spark/nsh/defconfig
@@ -645,7 +645,7 @@ CONFIG_DISABLE_PSEUDOFS_OPERATIONS=y
CONFIG_FS_READABLE=y
CONFIG_FS_WRITABLE=y
ONFIG_FS_NAMED_SEMAPHORES=y
-CONFIG_FS_NAMED_SEMPATH="/var/sem"
+CONFIG_FS_NAMED_SEMPATH="/var/lock"
# CONFIG_FS_RAMMAP is not set
CONFIG_FS_FAT=y
CONFIG_FAT_LCNAMES=y
diff --git a/nuttx/configs/spark/usbmsc/defconfig b/nuttx/configs/spark/usbmsc/defconfig
index 9dba9d6bc..9c961578a 100644
--- a/nuttx/configs/spark/usbmsc/defconfig
+++ b/nuttx/configs/spark/usbmsc/defconfig
@@ -609,7 +609,7 @@ CONFIG_DISABLE_PSEUDOFS_OPERATIONS=y
CONFIG_FS_READABLE=y
CONFIG_FS_WRITABLE=y
ONFIG_FS_NAMED_SEMAPHORES=y
-CONFIG_FS_NAMED_SEMPATH="/var/sem"
+CONFIG_FS_NAMED_SEMPATH="/var/lock"
# CONFIG_FS_RAMMAP is not set
CONFIG_FS_FAT=y
CONFIG_FAT_LCNAMES=y
diff --git a/nuttx/configs/spark/usbnsh/defconfig b/nuttx/configs/spark/usbnsh/defconfig
index af299c3e7..2476c535b 100644
--- a/nuttx/configs/spark/usbnsh/defconfig
+++ b/nuttx/configs/spark/usbnsh/defconfig
@@ -599,7 +599,7 @@ CONFIG_DISABLE_PSEUDOFS_OPERATIONS=y
CONFIG_FS_READABLE=y
CONFIG_FS_WRITABLE=y
ONFIG_FS_NAMED_SEMAPHORES=y
-CONFIG_FS_NAMED_SEMPATH="/var/sem"
+CONFIG_FS_NAMED_SEMPATH="/var/lock"
# CONFIG_FS_RAMMAP is not set
CONFIG_FS_FAT=y
# CONFIG_FAT_LCNAMES is not set
diff --git a/nuttx/configs/spark/usbserial/defconfig b/nuttx/configs/spark/usbserial/defconfig
index d9dce6ff9..6529fe3fe 100644
--- a/nuttx/configs/spark/usbserial/defconfig
+++ b/nuttx/configs/spark/usbserial/defconfig
@@ -619,7 +619,7 @@ CONFIG_DISABLE_PSEUDOFS_OPERATIONS=y
CONFIG_FS_READABLE=y
CONFIG_FS_WRITABLE=y
ONFIG_FS_NAMED_SEMAPHORES=y
-CONFIG_FS_NAMED_SEMPATH="/var/sem"
+CONFIG_FS_NAMED_SEMPATH="/var/lock"
# CONFIG_FS_RAMMAP is not set
CONFIG_FS_FAT=y
CONFIG_FAT_LCNAMES=y
diff --git a/nuttx/fs/semaphore/Kconfig b/nuttx/fs/semaphore/Kconfig
index abf0bb9be..84f9da868 100644
--- a/nuttx/fs/semaphore/Kconfig
+++ b/nuttx/fs/semaphore/Kconfig
@@ -13,7 +13,7 @@ if FS_NAMED_SEMAPHORES
config FS_NAMED_SEMPATH
string "Path to semaphore storage"
- default "/var/sem"
+ default "/var/lock"
---help---
The path to where named semaphores will exist in the VFS namespace.
diff --git a/nuttx/fs/vfs/fs_open.c b/nuttx/fs/vfs/fs_open.c
index 3f2e97ee2..24b574b51 100644
--- a/nuttx/fs/vfs/fs_open.c
+++ b/nuttx/fs/vfs/fs_open.c
@@ -135,8 +135,9 @@ int open(const char *path, int oflags, ...)
goto errout;
}
- /* Verify that the inode is valid and either a "normal" or a mountpoint. We
- * specifically exclude block drivers.
+ /* Verify that the inode is valid and either a "normal" character driver or a
+ * mountpoint. We specifically exclude block drivers and and "special"
+ * inodes (semaphores, message queues, shared memory).
*/
#ifndef CONFIG_DISABLE_MOUNTPOINT
diff --git a/nuttx/fs/vfs/fs_stat.c b/nuttx/fs/vfs/fs_stat.c
index b1526de41..b96c26e7d 100644
--- a/nuttx/fs/vfs/fs_stat.c
+++ b/nuttx/fs/vfs/fs_stat.c
@@ -59,7 +59,34 @@ static inline int statpseudo(FAR struct inode *inode, FAR struct stat *buf)
/* Most of the stat entries just do not apply */
memset(buf, 0, sizeof(struct stat) );
- if (inode->u.i_ops)
+
+ if (INODE_IS_SPECIAL(inode))
+ {
+#if defined(CONFIG_FS_NAMED_SEMAPHORES)
+ if (INODE_IS_NAMEDSEM(inode))
+ {
+ buf->st_mode = S_IFSEM;
+ }
+ else
+#endif
+#if !defined(CONFIG_DISABLE_MQUEUE)
+ if (INODE_IS_MQUEUE(inode))
+ {
+ buf->st_mode = S_IFMQ;
+ }
+ else
+#endif
+#if defined(CONFIG_FS_SHM)
+ if (INODE_IS_SHM(inode)) */
+ {
+ buf->st_mode | S_IFSHM;
+ }
+ else
+#endif
+ {
+ }
+ }
+ else if (inode->u.i_ops)
{
if (inode->u.i_ops->read)
{
@@ -81,7 +108,7 @@ static inline int statpseudo(FAR struct inode *inode, FAR struct stat *buf)
buf->st_mode |= S_IFBLK;
}
- else
+ else /* if (INODE_IS_DRIVER(inode)) */
{
/* What is it if it also has child inodes? */
diff --git a/nuttx/fs/vfs/fs_unlink.c b/nuttx/fs/vfs/fs_unlink.c
index 577f80471..3154b6bd4 100644
--- a/nuttx/fs/vfs/fs_unlink.c
+++ b/nuttx/fs/vfs/fs_unlink.c
@@ -140,7 +140,7 @@ int unlink(FAR const char *pathname)
* should remove the node.
*/
- if (inode->u.i_ops)
+ if (!INODE_IS_SPECIAL(inode) && inode->u.i_ops)
{
/* If this is a pseudo-file node (i.e., it has no operations)
* then rmdir should remove the node.
@@ -183,12 +183,12 @@ int unlink(FAR const char *pathname)
goto errout_with_inode;
}
}
-#else
+ else
+#endif
{
errcode = ENXIO;
goto errout_with_inode;
}
-#endif
/* Successfully unlinked */
diff --git a/nuttx/include/sys/stat.h b/nuttx/include/sys/stat.h
index f465ac441..4fe9f5c0b 100644
--- a/nuttx/include/sys/stat.h
+++ b/nuttx/include/sys/stat.h
@@ -71,13 +71,16 @@
#define S_ISGID 0002000 /* Set group ID bit */
#define S_ISUID 0004000 /* Set UID bit */
-#define S_IFIFO 0010000 /* File type bites */
+#define S_IFIFO 0010000 /* File type bytes */
#define S_IFCHR 0020000
#define S_IFDIR 0040000
#define S_IFBLK 0060000
#define S_IFREG 0100000
#define S_IFLNK 0120000
#define S_IFSOCK 0140000
+#define S_IFMQ 0150000
+#define S_IFSEM 0160000
+#define S_IFSHM 0170000
#define S_IFMT 0170000
/* File type macros that operate on an instance of mode_t */
@@ -89,6 +92,9 @@
#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
+#define S_ISMQ(m) (((m) & S_IFMT) == S_IFMQ)
+#define S_ISSSEM(m) (((m) & S_IFMT) == S_IFSEM)
+#define S_ISSHM(m) (((m) & S_IFMT) == S_IFSHM)
/****************************************************************************
* Type Definitions