This is an automated email from the ASF dual-hosted git repository.

lupyuen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit e1a9b953e259c5498eda2794971f11ae724848e1
Author: Michal Lenc <[email protected]>
AuthorDate: Wed Jun 10 16:05:02 2026 +0200

    fs/vfs/fs_lock.c: support flock for SHM driver
    
    We can apply file lock on SHM inode as well. Ensure file_lock_get_path
    function passes and doesn't return EBADF errno.
    
    Signed-off-by: Michal Lenc <[email protected]>
---
 fs/vfs/fs_lock.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/vfs/fs_lock.c b/fs/vfs/fs_lock.c
index 54c9eebcc75..135232da452 100644
--- a/fs/vfs/fs_lock.c
+++ b/fs/vfs/fs_lock.c
@@ -102,10 +102,13 @@ static int file_lock_get_path(FAR struct file *filep, FAR 
char *path)
   FAR struct tcb_s *tcb = this_task();
   bool is_allowed_type;
 
-  /* We only apply file lock on mountpt and driver (f_inode won't be NULL). */
+  /* We only apply file lock on mountpt, driver or shm
+   * (f_inode won't be NULL).
+   */
 
   is_allowed_type = INODE_IS_MOUNTPT(filep->f_inode) ||
-                    INODE_IS_DRIVER(filep->f_inode);
+                    INODE_IS_DRIVER(filep->f_inode) ||
+                    INODE_IS_SHM(filep->f_inode);
 
   if (!is_allowed_type || tcb->flags & TCB_FLAG_SIGNAL_ACTION)
     {

Reply via email to