Fennix  1.0.0
Full Documentation
Loading...
Searching...
No Matches
fcntl.h
Go to the documentation of this file.
1/*
2 This file is part of Fennix Kernel.
3
4 Fennix Kernel is free software: you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation, either version 3 of
7 the License, or (at your option) any later version.
8
9 Fennix Kernel is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with Fennix Kernel. If not, see <https://www.gnu.org/licenses/>.
16*/
17
18#ifndef __FENNIX_API_FCNTL_H__
19#define __FENNIX_API_FCNTL_H__
20
21#ifdef __kernel__
22#include <types.h>
23#endif
24
25/* cmd */
26#define F_DUPFD 0x1
27#define F_DUPFD_CLOEXEC 0x101
28#define F_DUPFD_CLOFORK 0x201
29#define F_GETFD 0x2
30#define F_SETFD 0x3
31#define F_GETFL 0x4
32#define F_SETFL 0x5
33#define F_GETLK 0x6
34#define F_SETLK 0x7
35#define F_SETLKW 0x8
36#define F_OFD_GETLK 0x9
37#define F_OFD_SETLK 0xA
38#define F_OFD_SETLKW 0xB
39#define F_GETOWN 0xC
40#define F_GETOWN_EX 0xD
41#define F_SETOWN 0xE
42#define F_SETOWN_EX 0xF
43
44#define FD_CLOEXEC 0x1
45#define FD_CLOFORK 0x2
46
47/* l_type */
48#define F_RDLCK 0x1
49#define F_UNLCK 0x2
50#define F_WRLCK 0x3
51
52/* type */
53#define F_OWNER_PID 0
54#define F_OWNER_PGRP 1
55
56/* oflag */
57#define O_CLOEXEC 02000000
58#define O_CLOFORK 04000000
59#define O_CREAT 0x8
60#define O_DIRECTORY 0200000
61#define O_EXCL 0x20
62#define O_NOCTTY 0x40
63#define O_NOFOLLOW 0400000
64#define O_TRUNC 0x400
65#define O_TTY_INIT 0x800
66
67#define O_APPEND 0x4
68#define O_DSYNC 0x10
69#define O_NONBLOCK 0x80
70#define O_RSYNC 0x100
71#define O_SYNC 0x200
72
73#define O_ACCMODE 0x3
74
75#define O_EXEC 0x4
76#define O_RDONLY 0x1
77#define O_RDWR 0x3
78#define O_SEARCH 0x10
79#define O_WRONLY 0x2
80
81#define AT_FDCWD
82#define AT_EACCESS
83#define AT_SYMLINK_NOFOLLOW
84#define AT_SYMLINK_FOLLOW
85#define AT_REMOVEDIR
86
87#define POSIX_FADV_DONTNEED
88#define POSIX_FADV_NOREUSE
89#define POSIX_FADV_NORMAL
90#define POSIX_FADV_RANDOM
91#define POSIX_FADV_SEQUENTIAL
92#define POSIX_FADV_WILLNEED
93
94typedef struct f_owner_ex
95{
96 int type; /* Discriminator for pid. */
97 pid_t pid; /* Process ID or process group ID. */
99
100typedef struct flock
101{
102 short l_type; /* Type of lock; F_RDLCK, F_WRLCK, F_UNLCK. */
103 short l_whence; /* Flag for starting offset. */
104 off_t l_start; /* Relative offset in bytes. */
105 off_t l_len; /* Size; if 0 then until EOF. */
106 pid_t l_pid; /* For a process-owned file lock, ignored on input or the process ID of the owning process on output; for an OFD-owned file lock, zero on input or (pid_t)-1 on output. */
108
109#endif // !__FENNIX_API_FCNTL_H__
short l_type
Definition fcntl.h:102
pid_t l_pid
Definition fcntl.h:106
off_t l_start
Definition fcntl.h:104
short l_whence
Definition fcntl.h:103
off_t l_len
Definition fcntl.h:105
pid_t pid
Definition fcntl.h:97
int type
Definition fcntl.h:96
Definition fcntl.h:101