Remix.run Logo
Igrom 13 hours ago

>fcntl(fd, F_GETLK, &lock), fcntl(fd, F_SETLK, &lock), and fcntl(fd, F_SETLKW, &lock)

There's also `flock`, the CLI utility in util-linux, that allows using flocks in shell scripts.

cachius 13 hours ago | parent | next [-]

What are flocks in this context? Surely not a number of sheep...

gbacon 6 hours ago | parent | next [-]

https://man.openbsd.org/flock.2

https://man7.org/linux/man-pages/man2/flock.2.html

ncruces 13 hours ago | parent | prev [-]

File locks.

pjmlp 9 hours ago | parent | prev | next [-]

In UNIX/POSIX file locks are advisory, not enforced, it only works if all processes play ball.

zbentley 7 hours ago | parent [-]

Sure, but the discussion is around whether they’re atomic, not whether they’re advisory.

zbentley 7 hours ago | parent | prev [-]

Aren’t flock and POSIX locks backed by totally different systems?