Sample Header Ad - 728x90

When I use flock it exits immediately instead of waiting

2 votes
1 answer
271 views
I was confused for a very long time with the meaning of the -n flag for flock(1). Basically there are many guides for this tool, and often what we see is some command like flock -n 100. Here, fd number 100 is associated with some lockfile and used to perform locking. Today I kept getting confused because I would do some simple tests, and flock would exit with failure immediately. What exactly does the -n flag of flock do? Am I right in thinking that -n 100 associates file descriptor number 100 with some lockfile?
Asked by Steven Lu (2422 rep)
Mar 7, 2024, 06:00 PM
Last activity: Mar 7, 2024, 06:25 PM