xiaoxiang781216 commented on code in PR #19456:
URL: https://github.com/apache/nuttx/pull/19456#discussion_r3613363217
##########
fs/hostfs/hostfs.c:
##########
@@ -609,6 +609,29 @@ static int hostfs_ioctl(FAR struct file *filep, int cmd,
unsigned long arg)
return ret;
}
+ /* POSIX file locks reach filesystems as private FIOC_* commands after
+ * fcntl() handling in VFS. Backends that can forward non-blocking lock
+ * commands to the host may implement host_fcntl(). Other backends return
+ * -ENOTTY so VFS falls back to NuttX internal file locks. Do not forward
+ * F_SETLKW because a blocking host fcntl() can stop the whole sim OS.
+ */
+
+ if (cmd == FIOC_GETLK)
+ {
+ ret = host_fcntl(hf->fd, F_GETLK, (FAR struct flock *)(uintptr_t)arg);
+ goto out;
+ }
+ else if (cmd == FIOC_SETLK)
+ {
+ ret = host_fcntl(hf->fd, F_SETLK, (FAR struct flock *)(uintptr_t)arg);
+ goto out;
+ }
+ else if (cmd == FIOC_SETLKW)
+ {
+ ret = -ENOTTY;
Review Comment:
let's loop with FIOC_SETLK/sleep
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]