summaryrefslogtreecommitdiffstats
path: root/libc-top-half/musl/src/stdio/flockfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc-top-half/musl/src/stdio/flockfile.c')
-rw-r--r--libc-top-half/musl/src/stdio/flockfile.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/stdio/flockfile.c b/libc-top-half/musl/src/stdio/flockfile.c
new file mode 100644
index 0000000..8e22065
--- /dev/null
+++ b/libc-top-half/musl/src/stdio/flockfile.c
@@ -0,0 +1,9 @@
+#include "stdio_impl.h"
+#include "pthread_impl.h"
+
+void flockfile(FILE *f)
+{
+ if (!ftrylockfile(f)) return;
+ __lockfile(f);
+ __register_locked_file(f, __pthread_self());
+}