summaryrefslogtreecommitdiff
path: root/nonstd/stubs/fcntl.h
blob: 2c7376038c63e266d514229a2248a515fe7b77d3 (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
40
41
42
43
44
45
46
47
48
#ifndef __FCNTL_H__
#define __FCNTL_H__
#include "nonstd/types.h"

#define F_DUPFD 1
#define F_DUPFD_CLOEXEC 2
#define F_GETFD 3
#define F_SETFD 4
#define F_GETFL 5
#define F_SETFL 6
#define F_GETLK 7
#define F_SETLK 8
#define F_SETLKW 9
#define F_GETOWN 10
#define F_SETOWN 11

#define FD_CLOEXEC 1

#define F_RDLCK 1
#define F_UNLCK 2
#define F_WRLCK 3

#define O_CLOEXEC 02000000
#define O_CREAT (1 << 1)
#define O_DIRECTORY (1 << 2)
#define O_EXCL (1 << 3)
#define O_NCTTY (1 << 4)
#define O_NOFOLLOW (1 << 5)
#define O_TRUNC (1 << 6)
#define O_TTY_INIT (1 << 7)

#define O_APPEND (1 << 8)
#define O_DSYNC (1 << 9)
#define O_NONBLOCK (1 << 10)
#define O_RSYNC (1 << 11)
#define O_SYNC (1 << 12)

#define O_EXEC (1 << 13)
#define O_RDONLY (1 << 14)
#define O_RDWR 02
#define O_SEARCH (1 << 16)
#define O_WRONLY (1 << 17)

#define O_ACCMODE (O_EXEC|O_RDONLY|O_RDWR|O_SEARCH|O_WRONLY)

#define open(path, mode, flags)         __libc.syscall(__libc.syscall_lookup("open"), path, mode, flags)

#endif