diff --git a/configs/spark/composite/defconfig b/configs/spark/composite/defconfig index a9e5dc654f..e1e587827e 100644 --- a/configs/spark/composite/defconfig +++ b/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/configs/spark/nsh/defconfig b/configs/spark/nsh/defconfig index ba2f2c0009..edabbf497c 100644 --- a/configs/spark/nsh/defconfig +++ b/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/configs/spark/usbmsc/defconfig b/configs/spark/usbmsc/defconfig index 9dba9d6bcf..9c961578a5 100644 --- a/configs/spark/usbmsc/defconfig +++ b/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/configs/spark/usbnsh/defconfig b/configs/spark/usbnsh/defconfig index af299c3e78..2476c535b5 100644 --- a/configs/spark/usbnsh/defconfig +++ b/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/configs/spark/usbserial/defconfig b/configs/spark/usbserial/defconfig index d9dce6ff95..6529fe3fe6 100644 --- a/configs/spark/usbserial/defconfig +++ b/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/fs/semaphore/Kconfig b/fs/semaphore/Kconfig index abf0bb9bed..84f9da8681 100644 --- a/fs/semaphore/Kconfig +++ b/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/fs/vfs/fs_open.c b/fs/vfs/fs_open.c index 3f2e97ee2c..24b574b51a 100644 --- a/fs/vfs/fs_open.c +++ b/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/fs/vfs/fs_stat.c b/fs/vfs/fs_stat.c index b1526de41c..b96c26e7d9 100644 --- a/fs/vfs/fs_stat.c +++ b/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/fs/vfs/fs_unlink.c b/fs/vfs/fs_unlink.c index 577f804711..3154b6bd44 100644 --- a/fs/vfs/fs_unlink.c +++ b/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/include/sys/stat.h b/include/sys/stat.h index f465ac441d..4fe9f5c0bb 100644 --- a/include/sys/stat.h +++ b/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