Updated PCI IDs to latest snapshot.
[tangerine.git] / compiler / clib / include / fcntl.h
blobb901323166419b67834ae8a48e941d1ecccdc54c
1 #ifndef _FCNTL_H_
2 #define _FCNTL_H_
4 /*
5 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
6 $Id$
8 Desc: ANSI-C header file fcntl.h
9 Lang: english
12 #include <sys/_types.h>
13 #include <sys/cdefs.h>
15 #if __XSI_VISIBLE
16 #include <unistd.h>
17 #include <sys/stat.h>
18 #endif
20 #ifndef __AROS_PID_T_DECLARED
21 #define __AROS_PID_T_DECLARED
22 typedef __pid_t pid_t;
23 #endif
25 #ifndef __AROS_MODE_T_DECLARED
26 #define __AROS_MODE_T_DECLARED
27 typedef __mode_t mode_t;
28 #endif
30 #ifndef __AROS_OFF_T_DECLARED
31 #define __AROS_OFF_T_DECLARED
32 typedef __off_t off_t;
33 #endif
35 /* Flags for open */
37 /* Access modes: */
38 #define O_ACCMODE 0x0003
39 #define O_RDONLY 0x0001
40 #define O_WRONLY 0x0002
41 #define O_RDWR (O_RDONLY | O_WRONLY)
43 /* The GNU system specifies these */
44 #define O_READ O_RDONLY
45 #define O_WRITE O_WRONLY
47 /* This is not included in the result of modes & O_ACCMODE */
48 #define O_EXEC 0x0004
50 /* Open time flags */
51 #define O_NOCTTY 0 /* We ignore this one */
52 #define O_CREAT 0x0040
53 #define O_EXCL 0x0080
54 #define O_SHLOCK 0 /* files are always opened in shared mode,
55 if not otherwise specified */
56 #define O_EXLOCK 0x0100
57 #define O_TRUNC 0x0200
59 /* Operating modes */
60 #define O_APPEND 0x0400
61 #define O_NONBLOCK 0x0800
62 #define O_NDELAY O_NONBLOCK /* Alias */
63 #define O_SYNC 0x1000
64 #define O_FSYNC O_SYNC /* Alias */
65 #define O_ASYNC 0x2000
66 #define O_DSYNC 0x4000 /* Different from O_SYNC */
67 #define O_RSYNC 0x8000 /* Read sync */
69 /* Values for the second argument to `fcntl'. */
70 #define F_DUPFD 0 /* Duplicate file descriptor. */
71 #define F_GETFD 1 /* Get file descriptor flags. */
72 #define F_SETFD 2 /* Set file descriptor flags. */
73 #define F_GETFL 3 /* Get file status flags. */
74 #define F_SETFL 4 /* Set file status flags. */
75 #define F_GETLK 5 /* Get record locking info. */
76 #define F_SETLK 6 /* Set record locking info (non-blocking). */
77 #define F_SETLKW 7 /* Set record locking info (blocking). */
79 /* XXX missing */
80 #define F_GETLK64 5 /* Get record locking info. */
81 #define F_SETLK64 6 /* Set record locking info (non-blocking). */
82 #define F_SETLKW64 7 /* Set record locking info (blocking). */
84 # define F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */
85 # define F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */
87 # define F_SETSIG 10 /* Set number of signal to be sent. */
88 # define F_GETSIG 11 /* Get number of signal to be sent. */
90 /* For F_[GET|SET]FD. */
91 #define FD_CLOEXEC 1 /* actually anything with low bit set goes */
93 /* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
94 #define F_RDLCK 0 /* Read lock. */
95 #define F_WRLCK 1 /* Write lock. */
96 #define F_UNLCK 2 /* Remove lock. */
98 /* for old implementation of bsd flock () */
99 #define F_EXLCK 4 /* or 3 */
100 #define F_SHLCK 8 /* or 4 */
102 #ifdef __BSD_VISIBLE
103 /* operations for bsd flock(), also used by the kernel implementation */
104 # define LOCK_SH 1 /* shared lock */
105 # define LOCK_EX 2 /* exclusive lock */
106 # define LOCK_NB 4 /* or'd with one of the above to prevent
107 blocking */
108 # define LOCK_UN 8 /* remove lock */
109 #endif
111 #if __POSIX_VERSION >= 200112
112 #define POSIX_FADV_NORMAL 1
113 #define POSIX_FADV_SEQUENTIAL 2
114 #define POSIX_FADV_RANDOM 3
115 #define POSIX_FADV_WILLNEED 4
116 #define POSIX_FADV_DONTNEED 5
117 #define POSIX_FADV_NOREUSE 6
118 #endif
120 struct flock
122 short l_type; /* type of lock F_RDLCK, F_WRLCK, F_UNLCK */
123 short l_whence; /* flag for starting offset */
124 off_t l_start; /* starting offset */
125 off_t l_len; /* size, if 0 then until EOF */
126 pid_t l_pid; /* pid of process holding the lock. */
129 /* Prototypes */
130 __BEGIN_DECLS
132 int fcntl (int fd, int cmd, ...);
133 int open (const char * filename, int flags, ...);
134 int creat (const char * filename, int mode);
136 #if __POSIX_VERSION >= 200112
137 /* NOTIMPL int posix_fadvise(int fd, off_t offset, size_t len, int advice); */
138 /* NOTIMPL int posix_fallocate(int fd, off_t offset, size_t len); */
139 #endif
141 __END_DECLS
143 #endif /* _FCNTL_H_ */