xref: /haiku/src/system/libroot/posix/glibc/libio/flockfile.c (revision 93aeb8c3bc3f13cb1f282e3e749258a23790d947)
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