blob: e2566468b16405b65d3d87f349997a1dbbaefe16 (
plain)
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
31
32
33
34
35
36
37
38
39
|
/*
* shim/fcntl.h — the record-locking constants WASI hides.
*
* anthy's src-worddic/priv_dic.c takes a write lock on the private dictionary with
* struct flock + fcntl(fd, F_SETLKW, &lck). WASI has neither record locks nor the
* constants: the wasi-sdk sysroot's fcntl.h keeps struct flock (line 28) but hides
* F_RDLCK/F_WRLCK/F_UNLCK/F_SETLK/F_SETLKW behind
* `#ifdef __wasilibc_unmodified_upstream`.
*
* So this header pulls in the real one with #include_next and adds only the missing
* macros, letting the call compile. fcntl() itself is in libc.a and returns an error
* for a lock request; anthy's caller already handles that by closing the lock fd and
* carrying on, and the embedder uses the read-only main dictionary anyway.
*/
#ifndef ANTHY_WASM_SHIM_FCNTL_H
#define ANTHY_WASM_SHIM_FCNTL_H
#include_next <fcntl.h>
#ifndef F_RDLCK
#define F_RDLCK 0
#endif
#ifndef F_WRLCK
#define F_WRLCK 1
#endif
#ifndef F_UNLCK
#define F_UNLCK 2
#endif
#ifndef F_GETLK
#define F_GETLK 5
#endif
#ifndef F_SETLK
#define F_SETLK 6
#endif
#ifndef F_SETLKW
#define F_SETLKW 7
#endif
#endif /* ANTHY_WASM_SHIM_FCNTL_H */
|