This source file includes following definitions.
- fcntl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 #include <sys/prex.h>
31 #include <sys/posix.h>
32 #include <ipc/fs.h>
33 #include <sys/fcntl.h>
34
35 #include <stdarg.h>
36 #include <string.h>
37
38 int
39 fcntl(int fd, int cmd, ...)
40 {
41 struct fcntl_msg m;
42 va_list args;
43 long arg;
44
45 va_start(args, cmd);
46 arg = va_arg(args, long);
47 va_end(args);
48
49 m.hdr.code = FS_FCNTL;
50 m.fd = fd;
51 m.cmd = cmd;
52 if (cmd == F_GETLK || cmd == F_SETLK || cmd == F_SETLKW)
53 memcpy(&m.lock, (char *)arg, sizeof(struct flock));
54 else
55 m.arg = arg;
56
57 if (__posix_call(__fs_obj, &m, sizeof(m), 1) != 0)
58 return -1;
59 return m.arg;
60 }
|