about summary refs log tree commit diff
path: root/stdio-common
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-05-06 16:01:15 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-05-10 23:35:44 -0300
commite874d3d189f355fdf0e9ef9c0d0f493c6cf767be (patch)
tree50c4ae4ce2b0691961672c1a0ebf5286d84cabbc /stdio-common
parent7b4e7ca9db350b53cc88ff3d0bc99279225f5cc7 (diff)
downloadglibc-e874d3d189f355fdf0e9ef9c0d0f493c6cf767be.tar.gz
glibc-e874d3d189f355fdf0e9ef9c0d0f493c6cf767be.tar.xz
glibc-e874d3d189f355fdf0e9ef9c0d0f493c6cf767be.zip
linux: Move ftrylockfile/_IO_ftrylockfile into libc
The nptl version is used as default, since now with symbol always
present the single-thread optimization is tricky.

Hurd is not change, it is used it own lock scheme (which call
 _cthreads_ftrylockfile).

Checked on x86_64-linux-gnu.
Diffstat (limited to 'stdio-common')
-rw-r--r--stdio-common/ftrylockfile.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/stdio-common/ftrylockfile.c b/stdio-common/ftrylockfile.c
index 4f7e2dd617..f7e2ef6137 100644
--- a/stdio-common/ftrylockfile.c
+++ b/stdio-common/ftrylockfile.c
@@ -17,14 +17,13 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include <stdio.h>
-
-#undef _IO_ftrylockfile
+#include <stdio-lock.h>
+#include <sys/single_threaded.h>
 
 int
 __ftrylockfile (FILE *stream)
 {
-  /* Do nothing.  Using this version does not do any locking.  */
-  return 1;
+  return _IO_lock_trylock (*stream->_lock);
 }
 weak_alias (__ftrylockfile, ftrylockfile);
 weak_alias (__ftrylockfile, _IO_ftrylockfile)