]>
Commit | Line | Data |
---|---|---|
33574c17 ST |
1 | /* lockfile - Handle locking and unlocking of streams. Hurd pthread version. |
2 | Copyright (C) 2000-2018 Free Software Foundation, Inc. | |
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 | |
17 | <http://www.gnu.org/licenses/>. */ | |
33574c17 ST |
18 | |
19 | #include <cthreads.h> | |
20 | #include <pthread.h> /* Must come before <stdio.h>! */ | |
21 | #include <stdio.h> | |
22 | ||
23 | void | |
24 | _cthreads_flockfile (FILE *fp) | |
25 | { | |
26 | _IO_lock_lock (*fp->_lock); | |
27 | } | |
28 | ||
29 | void | |
30 | _cthreads_funlockfile (FILE *fp) | |
31 | { | |
32 | _IO_lock_unlock (*fp->_lock); | |
33 | } | |
34 | ||
35 | int | |
36 | _cthreads_ftrylockfile (FILE *fp) | |
37 | { | |
38 | return __libc_lock_trylock_recursive (*fp->_lock); | |
39 | } | |
40 | ||
41 | #undef _IO_flockfile | |
42 | #undef _IO_funlockfile | |
43 | #undef _IO_ftrylockfile | |
44 | #undef flockfile | |
45 | #undef funlockfile | |
46 | #undef ftrylockfile | |
47 | ||
48 | void _IO_flockfile (FILE *) | |
49 | __attribute__ ((alias ("_cthreads_flockfile"))); | |
50 | void _IO_funlockfile (FILE *) | |
51 | __attribute__ ((alias ("_cthreads_funlockfile"))); | |
52 | int _IO_ftrylockfile (FILE *) | |
53 | __attribute__ ((alias ("_cthreads_ftrylockfile"))); | |
54 | ||
55 | void flockfile (FILE *) | |
cfba5dbb | 56 | __attribute__ ((weak, alias ("_cthreads_flockfile"))); |
33574c17 | 57 | void funlockfile (FILE *) |
cfba5dbb | 58 | __attribute__ ((weak, alias ("_cthreads_funlockfile"))); |
33574c17 | 59 | int ftrylockfile (FILE *) |
cfba5dbb | 60 | __attribute__ ((weak, alias ("_cthreads_ftrylockfile"))); |