xref: /haiku/src/system/libroot/posix/sys/flock.c (revision 5c6260dc232fcb2d4d5d1103c1623dba9663b753)
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 <syscalls.h>
13 
14 
15 int
16 flock(int fd, int op)
17 {
18 	status_t status = _kern_flock(fd, op);
19 
20 	pthread_testcancel();
21 
22 	if (status < B_OK) {
23 		errno = status;
24 		return -1;
25 	}
26 
27 	return 0;
28 }
29 
30