forked from phoenix-rtos/libphoenix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fcntl.h
70 lines (50 loc) · 1.02 KB
/
fcntl.h
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
* Phoenix-RTOS
*
* libphoenix
*
* fcntl.h
*
* Copyright 2017, 2018 Phoenix Systems
* Author: Aleksander Kaminski
*
* This file is part of Phoenix-RTOS.
*
* %LICENSE%
*/
#ifndef _LIBPHOENIX_FCNTL_H_
#define _LIBPHOENIX_FCNTL_H_
#include <sys/types.h>
#define O_RDONLY 0x0001
#define O_WRONLY 0x0002
#define O_RDWR 0x0004
#define O_APPEND 0x0008
#define O_CREAT 0x0100
#define O_TRUNC 0x0200
#define O_EXCL 0x0400
#define O_SYNC 0x0800
#define O_NONBLOCK 0x1000
#define O_NDELAY O_NONBLOCK
#define O_NOCTTY 0x2000
int fcntl(int fildes, int cmd, ...);
int open(const char *path, int oflag, ...);
int creat(const char *pathname, mode_t mode);
/* cmd's for fcntl */
enum { F_DUPFD, F_DUPFD_CLOEXEC, F_GETFD, F_SETFD, F_GETFL, F_SETFL,
F_GETOWN, F_SETOWN, F_GETLK, F_SETLK, F_SETLKW };
#define FD_CLOEXEC 1
enum {
LOCK_SH = 1,
LOCK_EX = 2,
LOCK_NB = 4,
LOCK_UN = 8,
};
enum { F_RDLCK, F_UNLCK, F_WRLCK };
struct flock {
short l_type;
short l_whence;
off_t l_start;
off_t l_len;
pid_t l_pid;
};
#endif