aboutsummaryrefslogtreecommitdiff
path: root/flock_mmap
diff options
context:
space:
mode:
authorDavid Timber <dxdt@dev.snart.me>2024-03-22 13:55:27 +0900
committerDavid Timber <dxdt@dev.snart.me>2024-03-22 13:55:27 +0900
commit7cb0eb6f3be00172b1a54cfcd206ab753ec96c67 (patch)
tree86f8acefd51cbb55193f3bda30f4d557f367a041 /flock_mmap
parent5fc02e2e847608a67d46af04d5f935cd889b23c3 (diff)
More on flock_mmap, fix the Makefile
Diffstat (limited to 'flock_mmap')
-rw-r--r--flock_mmap/Makefile2
-rw-r--r--flock_mmap/README.md21
2 files changed, 21 insertions, 2 deletions
diff --git a/flock_mmap/Makefile b/flock_mmap/Makefile
index 0275f91..f55485d 100644
--- a/flock_mmap/Makefile
+++ b/flock_mmap/Makefile
@@ -1,4 +1,4 @@
-CC := cc
+CC ?= cc
OBJ = flock_mmap lock
do: build test
diff --git a/flock_mmap/README.md b/flock_mmap/README.md
index 623fd5c..36ce390 100644
--- a/flock_mmap/README.md
+++ b/flock_mmap/README.md
@@ -26,7 +26,7 @@ make 2> /dev/null
```
### Result A
-- Linux
+- Linux: glibc, ulibc, musl
```
./tests.sh
@@ -48,3 +48,22 @@ make 2> /dev/null
[TEST]flock() and close() unlocks the file*: YES
[TEST]flock() and holding unlocks the file : NO
```
+
+## WHY?
+Not sure. Just don't mix `mmap()` with `flock()`, I guess.
+
+```
+HISTORY
+ 4.4BSD (the flock() call first appeared in 4.2BSD). A version of
+ flock(), possibly implemented in terms of fcntl(2), appears on most
+ UNIX systems.
+```
+```
+VERSIONS
+ Since Linux 2.0, flock() is implemented as a system call in its own
+ right rather than being emulated in the GNU C library as a call to fc‐
+ ntl(2). With this implementation, there is no interaction between the
+ types of lock placed by flock() and fcntl(2), and flock() does not de‐
+ tect deadlock. (Note, however, that on some systems, such as the mod‐
+ ern BSDs, flock() and fcntl(2) locks do interact with one another.)
+```