xref: /haiku/src/system/libroot/posix/sys/flock.c (revision 220d04022750f40f8bac8f01fa551211e28d04f2)
1 /*
2  * Copyright 2008, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include <sys/file.h>
8 
9 #include <errno.h>
10 #include <pthread.h>
11 
12 #include <errno_private.h>
13 #include <syscalls.h>
14 
15 
16 int
17 flock(int fd, int op)
18 {
19 	status_t status = _kern_flock(fd, op);
20 
21 	pthread_testcancel();
22 
23 	if (status < B_OK) {
24 		__set_errno(status);
25 		return -1;
26 	}
27 
28 	return 0;
29 }
30 
31