]> git.ipfire.org Git - thirdparty/glibc.git/blame - htl/lockfile.c
x86: In ld.so, diagnose missing APX support in APX-only builds
[thirdparty/glibc.git] / htl / lockfile.c
CommitLineData
33574c17 1/* lockfile - Handle locking and unlocking of streams. Hurd pthread version.
dff8da6b 2 Copyright (C) 2000-2024 Free Software Foundation, Inc.
33574c17
ST
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
ad2b41bf
ST
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
33574c17
ST
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
ad2b41bf 13 Lesser General Public License for more details.
33574c17 14
ad2b41bf
ST
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
5a82c748 17 <https://www.gnu.org/licenses/>. */
33574c17 18
33574c17
ST
19#include <pthread.h> /* Must come before <stdio.h>! */
20#include <stdio.h>
21
22void
23_cthreads_flockfile (FILE *fp)
24{
25 _IO_lock_lock (*fp->_lock);
26}
27
28void
29_cthreads_funlockfile (FILE *fp)
30{
31 _IO_lock_unlock (*fp->_lock);
32}
33
34int
35_cthreads_ftrylockfile (FILE *fp)
36{
37 return __libc_lock_trylock_recursive (*fp->_lock);
38}
39
40#undef _IO_flockfile
41#undef _IO_funlockfile
42#undef _IO_ftrylockfile
43#undef flockfile
44#undef funlockfile
45#undef ftrylockfile
46
47void _IO_flockfile (FILE *)
48 __attribute__ ((alias ("_cthreads_flockfile")));
49void _IO_funlockfile (FILE *)
50 __attribute__ ((alias ("_cthreads_funlockfile")));
51int _IO_ftrylockfile (FILE *)
52 __attribute__ ((alias ("_cthreads_ftrylockfile")));
53
54void flockfile (FILE *)
cfba5dbb 55 __attribute__ ((weak, alias ("_cthreads_flockfile")));
33574c17 56void funlockfile (FILE *)
cfba5dbb 57 __attribute__ ((weak, alias ("_cthreads_funlockfile")));
33574c17 58int ftrylockfile (FILE *)
cfba5dbb 59 __attribute__ ((weak, alias ("_cthreads_ftrylockfile")));