+ exec* functions
[meinos.git] / apps / include / fcntl.h
blobc933f8728818c33daeaa0a2db85006506d976aed
1 /*
2 meinOS - A unix-like x86 microkernel operating system
3 Copyright (C) 2008 Janosch Gräf <janosch.graef@gmx.net>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef _FCNTL_H_
20 #define _FCNTL_H_
22 #include <sys/types.h>
24 #define R_OK 4 // Test for read permission
25 #define W_OK 2 // Test for write permission
26 #define X_OK 1 // Test for execute permission
27 #define F_OK 0 // Test for existence
29 #ifndef SEEK_SET
30 #define SEEK_SET 0 // Seek from beginning of file
31 #define SEEK_CUR 1 // Seek from current position
32 #define SEEK_END 2 // Seek from end of file
33 #endif
35 #define O_RDONLY 1
36 #define O_WRONLY 2
37 #define O_RDWR 3
38 #define O_CREAT 4
39 #define O_EXCL 8
40 #define O_NOCTTY 16
41 #define O_TRUNC 32
42 #define O_APPEND 64
43 #define O_NONBLOCK 128
44 #define O_SYNC 256
45 #define O_ACCMODE 3
47 #define F_RDLCK 1
48 #define F_UNLCK 2
49 #define F_WRLCK 3
51 #define F_DUPFD 1
52 #define F_GETFD 2
53 #define F_SETFD 3
54 #define F_GETFL 4
55 #define F_SETFL 5
56 #define F_GETLK 6
57 #define F_SETLK 7
58 #define F_SETLKW 8
59 #define F_GETOWN 9
60 #define F_SETOWN 10
62 #define FD_CLOEXEC 1
64 struct flock {
65 short l_type;
66 short l_whence;
67 off_t l_start;
68 off_t l_len;
69 pid_t l_pid;
72 int fcntl(int fildes,int cmd,...);
73 int open(const char *path,int oflag,...);
75 static inline int creat(const char *path,mode_t mode) {
76 return open(path,O_WRONLY|O_CREAT|O_TRUNC,mode);
79 #endif