michallenc commented on PR #19110: URL: https://github.com/apache/nuttx/pull/19110#issuecomment-4677864331
> but this change is wrong. POSIX require file lock is process wide: https://pubs.opengroup.org/onlinepubs/7908799/xsh/fcntl.html @michallenc @acassis @lupyuen @linguini1 But process wide locking still works, the commit doesn't change that. It fixes the behavior for thread wide locking, which should also work - POSIX is not much clear about it, but it also states: > This command is the same as F_SETLK except that if a shared or exclusive lock is blocked by other locks, the thread will wait until the request can be satisfied And the Linux example clearly shows the locking should also work for threads - it seems unlikely Linux breaks POSIX in this case, so I think the change is fine. I have also now noticed lock for SHM is undefined according to POSIX > When the file descriptor fildes refers to a shared memory object, the behaviour of fcntl() is the same as for a regular file except the effect of the following values for the argument cmd are unspecified: F_SETFL, F_GETLK, F_SETLK, and F_SETLKW. But again, Linux supports it, so we should too. -- 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]
