fcntl.h (238614) | fcntl.h (238667) |
---|---|
1/*- 2 * Copyright (c) 1983, 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 18 unchanged lines hidden (view full) --- 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * @(#)fcntl.h 8.3 (Berkeley) 1/21/94 | 1/*- 2 * Copyright (c) 1983, 1990, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 18 unchanged lines hidden (view full) --- 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * @(#)fcntl.h 8.3 (Berkeley) 1/21/94 |
35 * $FreeBSD: head/sys/sys/fcntl.h 238614 2012-07-19 10:22:54Z kib $ | 35 * $FreeBSD: head/sys/sys/fcntl.h 238667 2012-07-21 13:02:11Z kib $ |
36 */ 37 38#ifndef _SYS_FCNTL_H_ 39#define _SYS_FCNTL_H_ 40 41/* 42 * This file includes the definitions for open and fcntl 43 * described by POSIX for <fcntl.h>; it also includes --- 62 unchanged lines hidden (view full) --- 106#define FHASLOCK 0x4000 /* descriptor holds advisory lock */ 107#endif 108 109/* Defined by POSIX 1003.1; BSD default, but must be distinct from O_RDONLY. */ 110#define O_NOCTTY 0x8000 /* don't assign controlling terminal */ 111 112#if __BSD_VISIBLE 113/* Attempt to bypass buffer cache */ | 36 */ 37 38#ifndef _SYS_FCNTL_H_ 39#define _SYS_FCNTL_H_ 40 41/* 42 * This file includes the definitions for open and fcntl 43 * described by POSIX for <fcntl.h>; it also includes --- 62 unchanged lines hidden (view full) --- 106#define FHASLOCK 0x4000 /* descriptor holds advisory lock */ 107#endif 108 109/* Defined by POSIX 1003.1; BSD default, but must be distinct from O_RDONLY. */ 110#define O_NOCTTY 0x8000 /* don't assign controlling terminal */ 111 112#if __BSD_VISIBLE 113/* Attempt to bypass buffer cache */ |
114#define O_DIRECT 0x00010000 | 114#define O_DIRECT 0x00010000 |
115#endif 116 117/* Defined by POSIX Extended API Set Part 2 */ 118#if __BSD_VISIBLE 119#define O_DIRECTORY 0x00020000 /* Fail if not directory */ 120#define O_EXEC 0x00040000 /* Open for execute only */ 121#endif 122#ifdef _KERNEL --- 85 unchanged lines hidden (view full) --- 208/* command values */ 209#define F_DUPFD 0 /* duplicate file descriptor */ 210#define F_GETFD 1 /* get file descriptor flags */ 211#define F_SETFD 2 /* set file descriptor flags */ 212#define F_GETFL 3 /* get file status flags */ 213#define F_SETFL 4 /* set file status flags */ 214#if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200112 215#define F_GETOWN 5 /* get SIGIO/SIGURG proc/pgrp */ | 115#endif 116 117/* Defined by POSIX Extended API Set Part 2 */ 118#if __BSD_VISIBLE 119#define O_DIRECTORY 0x00020000 /* Fail if not directory */ 120#define O_EXEC 0x00040000 /* Open for execute only */ 121#endif 122#ifdef _KERNEL --- 85 unchanged lines hidden (view full) --- 208/* command values */ 209#define F_DUPFD 0 /* duplicate file descriptor */ 210#define F_GETFD 1 /* get file descriptor flags */ 211#define F_SETFD 2 /* set file descriptor flags */ 212#define F_GETFL 3 /* get file status flags */ 213#define F_SETFL 4 /* set file status flags */ 214#if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200112 215#define F_GETOWN 5 /* get SIGIO/SIGURG proc/pgrp */ |
216#define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */ | 216#define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */ |
217#endif | 217#endif |
218#if __BSD_VISIBLE |
|
218#define F_OGETLK 7 /* get record locking information */ 219#define F_OSETLK 8 /* set record locking information */ 220#define F_OSETLKW 9 /* F_SETLK; wait if blocked */ 221#define F_DUP2FD 10 /* duplicate file descriptor to arg */ | 219#define F_OGETLK 7 /* get record locking information */ 220#define F_OSETLK 8 /* set record locking information */ 221#define F_OSETLKW 9 /* F_SETLK; wait if blocked */ 222#define F_DUP2FD 10 /* duplicate file descriptor to arg */ |
223#endif |
|
222#define F_GETLK 11 /* get record locking information */ 223#define F_SETLK 12 /* set record locking information */ 224#define F_SETLKW 13 /* F_SETLK; wait if blocked */ | 224#define F_GETLK 11 /* get record locking information */ 225#define F_SETLK 12 /* set record locking information */ 226#define F_SETLKW 13 /* F_SETLK; wait if blocked */ |
227#if __BSD_VISIBLE |
|
225#define F_SETLK_REMOTE 14 /* debugging support for remote locks */ 226#define F_READAHEAD 15 /* read ahead */ 227#define F_RDAHEAD 16 /* Darwin compatible read ahead */ | 228#define F_SETLK_REMOTE 14 /* debugging support for remote locks */ 229#define F_READAHEAD 15 /* read ahead */ 230#define F_RDAHEAD 16 /* Darwin compatible read ahead */ |
231#endif |
|
228#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 229#define F_DUPFD_CLOEXEC 17 /* Like F_DUPFD, but FD_CLOEXEC is set */ 230#endif 231 232/* file descriptor flags (F_GETFD, F_SETFD) */ 233#define FD_CLOEXEC 1 /* close-on-exec flag */ 234 235/* record locking flags (F_GETLK, F_SETLK, F_SETLKW) */ 236#define F_RDLCK 1 /* shared or read lock */ 237#define F_UNLCK 2 /* unlock */ 238#define F_WRLCK 3 /* exclusive or write lock */ | 232#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 233#define F_DUPFD_CLOEXEC 17 /* Like F_DUPFD, but FD_CLOEXEC is set */ 234#endif 235 236/* file descriptor flags (F_GETFD, F_SETFD) */ 237#define FD_CLOEXEC 1 /* close-on-exec flag */ 238 239/* record locking flags (F_GETLK, F_SETLK, F_SETLKW) */ 240#define F_RDLCK 1 /* shared or read lock */ 241#define F_UNLCK 2 /* unlock */ 242#define F_WRLCK 3 /* exclusive or write lock */ |
243#if __BSD_VISIBLE |
|
239#define F_UNLCKSYS 4 /* purge locks for a given system ID */ 240#define F_CANCEL 5 /* cancel an async lock request */ | 244#define F_UNLCKSYS 4 /* purge locks for a given system ID */ 245#define F_CANCEL 5 /* cancel an async lock request */ |
246#endif |
|
241#ifdef _KERNEL 242#define F_WAIT 0x010 /* Wait until lock is granted */ 243#define F_FLOCK 0x020 /* Use flock(2) semantics for lock */ 244#define F_POSIX 0x040 /* Use POSIX semantics for lock */ 245#define F_REMOTE 0x080 /* Lock owner is remote NFS client */ | 247#ifdef _KERNEL 248#define F_WAIT 0x010 /* Wait until lock is granted */ 249#define F_FLOCK 0x020 /* Use flock(2) semantics for lock */ 250#define F_POSIX 0x040 /* Use POSIX semantics for lock */ 251#define F_REMOTE 0x080 /* Lock owner is remote NFS client */ |
246#define F_NOINTR 0x100 /* Ignore signals when waiting */ | 252#define F_NOINTR 0x100 /* Ignore signals when waiting */ |
247#endif 248 249/* 250 * Advisory file segment locking data type - 251 * information passed to system by user 252 */ 253struct flock { 254 off_t l_start; /* starting offset */ 255 off_t l_len; /* len = 0 means until end of file */ 256 pid_t l_pid; /* lock owner */ 257 short l_type; /* lock type: read/write, etc. */ 258 short l_whence; /* type of l_start */ 259 int l_sysid; /* remote system id or zero for local */ 260}; 261 | 253#endif 254 255/* 256 * Advisory file segment locking data type - 257 * information passed to system by user 258 */ 259struct flock { 260 off_t l_start; /* starting offset */ 261 off_t l_len; /* len = 0 means until end of file */ 262 pid_t l_pid; /* lock owner */ 263 short l_type; /* lock type: read/write, etc. */ 264 short l_whence; /* type of l_start */ 265 int l_sysid; /* remote system id or zero for local */ 266}; 267 |
268#if __BSD_VISIBLE |
|
262/* 263 * Old advisory file segment locking data type, 264 * before adding l_sysid. 265 */ | 269/* 270 * Old advisory file segment locking data type, 271 * before adding l_sysid. 272 */ |
266struct oflock { | 273struct __oflock { |
267 off_t l_start; /* starting offset */ 268 off_t l_len; /* len = 0 means until end of file */ 269 pid_t l_pid; /* lock owner */ 270 short l_type; /* lock type: read/write, etc. */ 271 short l_whence; /* type of l_start */ 272}; | 274 off_t l_start; /* starting offset */ 275 off_t l_len; /* len = 0 means until end of file */ 276 pid_t l_pid; /* lock owner */ 277 short l_type; /* lock type: read/write, etc. */ 278 short l_whence; /* type of l_start */ 279}; |
280#endif |
|
273 | 281 |
274 | |
275#if __BSD_VISIBLE 276/* lock operations for flock(2) */ 277#define LOCK_SH 0x01 /* shared file lock */ 278#define LOCK_EX 0x02 /* exclusive file lock */ 279#define LOCK_NB 0x04 /* don't block when locking */ 280#define LOCK_UN 0x08 /* unlock file */ 281#endif 282 --- 31 unchanged lines hidden --- | 282#if __BSD_VISIBLE 283/* lock operations for flock(2) */ 284#define LOCK_SH 0x01 /* shared file lock */ 285#define LOCK_EX 0x02 /* exclusive file lock */ 286#define LOCK_NB 0x04 /* don't block when locking */ 287#define LOCK_UN 0x08 /* unlock file */ 288#endif 289 --- 31 unchanged lines hidden --- |