1 /* $Id: fcntl.h,v 1.6 2002/10/29 04:45:08 rex Exp $
6 * file control options. Conforming to the Single UNIX(r) Specification
7 * Version 2, System Interface & Headers Issue 5
9 * This file is part of the ReactOS Operating System.
12 * Created by KJK::Hyperion <noog@libero.it>
14 * THIS SOFTWARE IS NOT COPYRIGHTED
16 * This source code is offered for use in the public domain. You may
17 * use, modify or distribute it freely.
19 * This code is distributed in the hope that it will be useful but
20 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
21 * DISCLAMED. This includes but is not limited to warranties of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
25 #ifndef __FCNTL_H_INCLUDED__
26 #define __FCNTL_H_INCLUDED__
30 #include <sys/types.h>
37 the structure flock describes a file lock
41 short l_type
; /* type of lock; F_RDLCK, F_WRLCK, F_UNLCK */
42 short l_whence
; /* flag for starting offset */
43 off_t l_start
; /* relative offset in bytes */
44 off_t l_len
; /* size; if 0 then until EOF */
45 pid_t l_pid
; /* process ID of the process holding the lock;
46 returned with F_GETLK */
51 values for cmd used by fcntl()
55 F_DUPFD
, /* duplicate file descriptor */
56 F_GETFD
, /* get file descriptor flags */
57 F_GETLK
, /* get record locking information */
58 F_SETFD
, /* set file descriptor flags */
59 F_GETFL
, /* get file status flags and file access modes */
60 F_SETFL
, /* set file status flags */
61 F_SETLK
, /* set record locking information */
62 F_SETLKW
, /* set record locking information; wait if blocked */
63 /* ReactOS-specific */
64 F_NEWFD
, /* create new file descriptor */
65 F_DELFD
, /* delete file descriptor */
66 F_GETALL
, /* get a copy of the internal descriptor object */
67 F_SETALL
, /* initialize internal descriptor object */
68 F_GETXP
, /* get file descriptor extra data pointer */
69 F_SETXP
, /* set file descriptor extra data pointer */
70 F_GETXS
, /* get file descriptor extra data size */
71 F_SETXS
, /* set file descriptor extra data size */
72 F_GETFH
, /* get file handle */
73 F_SETFH
/* set file handle */
77 file descriptor flags used for fcntl()
79 /* Close the file descriptor upon execution of an exec family function. */
80 #define FD_CLOEXEC (0x00000001)
83 values for l_type used for record locking with fcntl()
85 /* Shared or read lock. */
89 /* Exclusive or write lock. */
93 file flags used for open()
95 /* Create file if it does not exist. */
96 #define O_CREAT (0x00000100)
98 #define O_TRUNC (0x00000200)
99 /* Exclusive use flag. */
100 #define O_EXCL (0x00000400)
101 /* Do not assign controlling terminal. */
102 #define O_NOCTTY (0x00000800)
103 /* ReactOS-specific */
104 /* File must be a directory */
105 #define _O_DIRFILE (0x00100000)
108 file status flags used for open() and fcntl()
110 /* Set append mode. */
111 #define O_APPEND (0x00000008)
112 /* Non-blocking mode. */
113 #define O_NONBLOCK (0x00001000)
114 /* Write according to synchronised I/O data integrity completion. */
115 #define O_DSYNC (0x00002000)
116 /* Synchronised read I/O operations. */
117 #define O_RSYNC (0x00004000)
118 /* Write according to synchronised I/O file integrity completion. */
119 #define O_SYNC (0x00008000)
122 file access modes used for open() and fcntl()
124 /* Open for reading only. */
125 #define O_RDONLY (0x00000000)
126 /* Open for writing only. */
127 #define O_WRONLY (0x00000001)
128 /* Open for reading and writing. */
129 #define O_RDWR (0x00000002)
132 mask for use with file access modes
134 #define O_ACCMODE (0x00000007)
137 int creat(const char *, mode_t
);
138 int fcntl(int, int, ...);
139 int open(const char *, int, ...);
141 int _Wcreat(const wchar_t *, mode_t
);
142 int _Wopen(const wchar_t *, int, ...);
146 #endif /* __FCNTL_H_INCLUDED__ */