xref: /haiku/src/system/libroot/posix/glibc/libio/flockfile.c (revision 1acbe440b8dd798953bec31d18ee589aa3f71b73)
1 /*
2 ** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 ** Distributed under the terms of the OpenBeOS License.
4 */
5 
6 
7 #include "libioP.h"
8 
9 
10 #undef _IO_flockfile
11 #undef _IO_funlockfile
12 
13 
14 void
15 _IO_flockfile(_IO_FILE *stream)
16 {
17 	__libc_lock_lock_recursive(*stream->_lock);
18 }
19 
20 
21 void
22 _IO_funlockfile(_IO_FILE *stream)
23 {
24 	__libc_lock_unlock_recursive(*stream->_lock);
25 }
26 
27 
28 int
29 _IO_ftrylockfile(_IO_FILE *stream)
30 {
31 	// ToDo: that code has probably never been tested!
32 	//return __libc_lock_trylock_recursive(*stream->_lock);
33 	return 1;
34 }
35 
36 weak_alias (_IO_flockfile, flockfile);
37 weak_alias (_IO_funlockfile, funlockfile);
38 weak_alias (_IO_ftrylockfile, ftrylockfile);
39