OLD | NEW |
| (Empty) |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Partial <fcntl.h>-lookalike-ish. Note that this is a C header, so that crappy | |
6 // (and non-crappy) C programs can use it. | |
7 // | |
8 // In general, functions/types/macros are given "mojio_"/"MOJIO_"/etc. prefixes. | |
9 // There are a handful of exceptions (noted below). | |
10 | |
11 #ifndef MOJO_SERVICES_FILES_PUBLIC_C_MOJIO_FCNTL_H_ | |
12 #define MOJO_SERVICES_FILES_PUBLIC_C_MOJIO_FCNTL_H_ | |
13 | |
14 // Includes -------------------------------------------------------------------- | |
15 | |
16 #include "files/public/c/mojio_sys_types.h" | |
17 | |
18 // Macros ---------------------------------------------------------------------- | |
19 | |
20 // Values for |mojio_fcntl()|'s |cmd| argument (not all are actually | |
21 // implemented): | |
22 #define MOJIO_F_DUPFD 0 | |
23 #define MOJIO_F_GETFD 1 | |
24 #define MOJIO_F_SETFD 2 | |
25 #define MOJIO_F_GETFL 3 | |
26 #define MOJIO_F_SETFL 4 | |
27 #define MOJIO_F_GETLK 5 | |
28 #define MOJIO_F_SETLK 6 | |
29 #define MOJIO_F_SETLKW 7 | |
30 #define MOJIO_F_GETOWN 8 | |
31 #define MOJIO_F_SETOWN 9 | |
32 | |
33 // Values for |mojio_open()| and |mojio_fcntl()| flags: | |
34 #define MOJIO_O_ACCMODE 3 // MOJIO_O_RDONLY | MOJIO_O_RDWR | MOJIO_O_WRONLY. | |
35 #define MOJIO_O_RDONLY 0 | |
36 #define MOJIO_O_RDWR 1 | |
37 #define MOJIO_O_WRONLY 2 | |
38 #define MOJIO_O_CREAT 64 | |
39 #define MOJIO_O_EXCL 128 | |
40 #define MOJIO_O_NOCTTY 256 | |
41 #define MOJIO_O_TRUNC 512 | |
42 #define MOJIO_O_APPEND 1024 | |
43 #define MOJIO_O_NONBLOCK 2048 | |
44 #define MOJIO_O_DSYNC 4096 | |
45 #define MOJIO_O_RSYNC 8192 | |
46 #define MOJIO_O_SYNC 16384 | |
47 | |
48 // Types ----------------------------------------------------------------------- | |
49 | |
50 // TODO(vtl): |struct flock| equivalent? | |
51 | |
52 // Functions ------------------------------------------------------------------- | |
53 | |
54 #ifdef __cplusplus | |
55 extern "C" { | |
56 #endif | |
57 | |
58 int mojio_creat(const char* path, mojio_mode_t mode); | |
59 // TODO(vtl): int mojio_fcntl(int fd, int cmd, ...); | |
60 int mojio_open(const char* path, int oflag, ...); | |
61 | |
62 #ifdef __cplusplus | |
63 } // extern "C" | |
64 #endif | |
65 | |
66 #endif // MOJO_SERVICES_FILES_PUBLIC_C_MOJIO_FCNTL_H_ | |
OLD | NEW |