#ifndef _ASM_GENERIC_FCNTL_H1#define _ASM_GENERIC_FCNTL_H23#include <linux/types.h>45/*6* FMODE_EXEC is 0x207* FMODE_NONOTIFY is 0x10000008* These cannot be used by userspace O_* until internal and external open9* flags are split.10* -Eric Paris11*/1213/*14* When introducing new O_* bits, please check its uniqueness in fcntl_init().15*/1617#define O_ACCMODE 0000000318#define O_RDONLY 0000000019#define O_WRONLY 0000000120#define O_RDWR 0000000221#ifndef O_CREAT22#define O_CREAT 00000100 /* not fcntl */23#endif24#ifndef O_EXCL25#define O_EXCL 00000200 /* not fcntl */26#endif27#ifndef O_NOCTTY28#define O_NOCTTY 00000400 /* not fcntl */29#endif30#ifndef O_TRUNC31#define O_TRUNC 00001000 /* not fcntl */32#endif33#ifndef O_APPEND34#define O_APPEND 0000200035#endif36#ifndef O_NONBLOCK37#define O_NONBLOCK 0000400038#endif39#ifndef O_DSYNC40#define O_DSYNC 00010000 /* used to be O_SYNC, see below */41#endif42#ifndef FASYNC43#define FASYNC 00020000 /* fcntl, for BSD compatibility */44#endif45#ifndef O_DIRECT46#define O_DIRECT 00040000 /* direct disk access hint */47#endif48#ifndef O_LARGEFILE49#define O_LARGEFILE 0010000050#endif51#ifndef O_DIRECTORY52#define O_DIRECTORY 00200000 /* must be a directory */53#endif54#ifndef O_NOFOLLOW55#define O_NOFOLLOW 00400000 /* don't follow links */56#endif57#ifndef O_NOATIME58#define O_NOATIME 0100000059#endif60#ifndef O_CLOEXEC61#define O_CLOEXEC 02000000 /* set close_on_exec */62#endif6364/*65* Before Linux 2.6.33 only O_DSYNC semantics were implemented, but using66* the O_SYNC flag. We continue to use the existing numerical value67* for O_DSYNC semantics now, but using the correct symbolic name for it.68* This new value is used to request true Posix O_SYNC semantics. It is69* defined in this strange way to make sure applications compiled against70* new headers get at least O_DSYNC semantics on older kernels.71*72* This has the nice side-effect that we can simply test for O_DSYNC73* wherever we do not care if O_DSYNC or O_SYNC is used.74*75* Note: __O_SYNC must never be used directly.76*/77#ifndef O_SYNC78#define __O_SYNC 0400000079#define O_SYNC (__O_SYNC|O_DSYNC)80#endif8182#ifndef O_PATH83#define O_PATH 01000000084#endif8586#ifndef O_NDELAY87#define O_NDELAY O_NONBLOCK88#endif8990#define F_DUPFD 0 /* dup */91#define F_GETFD 1 /* get close_on_exec */92#define F_SETFD 2 /* set/clear close_on_exec */93#define F_GETFL 3 /* get file->f_flags */94#define F_SETFL 4 /* set file->f_flags */95#ifndef F_GETLK96#define F_GETLK 597#define F_SETLK 698#define F_SETLKW 799#endif100#ifndef F_SETOWN101#define F_SETOWN 8 /* for sockets. */102#define F_GETOWN 9 /* for sockets. */103#endif104#ifndef F_SETSIG105#define F_SETSIG 10 /* for sockets. */106#define F_GETSIG 11 /* for sockets. */107#endif108109#ifndef CONFIG_64BIT110#ifndef F_GETLK64111#define F_GETLK64 12 /* using 'struct flock64' */112#define F_SETLK64 13113#define F_SETLKW64 14114#endif115#endif116117#ifndef F_SETOWN_EX118#define F_SETOWN_EX 15119#define F_GETOWN_EX 16120#endif121122#define F_OWNER_TID 0123#define F_OWNER_PID 1124#define F_OWNER_PGRP 2125126struct f_owner_ex {127int type;128__kernel_pid_t pid;129};130131/* for F_[GET|SET]FL */132#define FD_CLOEXEC 1 /* actually anything with low bit set goes */133134/* for posix fcntl() and lockf() */135#ifndef F_RDLCK136#define F_RDLCK 0137#define F_WRLCK 1138#define F_UNLCK 2139#endif140141/* for old implementation of bsd flock () */142#ifndef F_EXLCK143#define F_EXLCK 4 /* or 3 */144#define F_SHLCK 8 /* or 4 */145#endif146147/* for leases */148#ifndef F_INPROGRESS149#define F_INPROGRESS 16150#endif151152/* operations for bsd flock(), also used by the kernel implementation */153#define LOCK_SH 1 /* shared lock */154#define LOCK_EX 2 /* exclusive lock */155#define LOCK_NB 4 /* or'd with one of the above to prevent156blocking */157#define LOCK_UN 8 /* remove lock */158159#define LOCK_MAND 32 /* This is a mandatory flock ... */160#define LOCK_READ 64 /* which allows concurrent read operations */161#define LOCK_WRITE 128 /* which allows concurrent write operations */162#define LOCK_RW 192 /* which allows concurrent read & write ops */163164#define F_LINUX_SPECIFIC_BASE 1024165166#ifndef HAVE_ARCH_STRUCT_FLOCK167#ifndef __ARCH_FLOCK_PAD168#define __ARCH_FLOCK_PAD169#endif170171struct flock {172short l_type;173short l_whence;174__kernel_off_t l_start;175__kernel_off_t l_len;176__kernel_pid_t l_pid;177__ARCH_FLOCK_PAD178};179#endif180181#ifndef CONFIG_64BIT182183#ifndef HAVE_ARCH_STRUCT_FLOCK64184#ifndef __ARCH_FLOCK64_PAD185#define __ARCH_FLOCK64_PAD186#endif187188struct flock64 {189short l_type;190short l_whence;191__kernel_loff_t l_start;192__kernel_loff_t l_len;193__kernel_pid_t l_pid;194__ARCH_FLOCK64_PAD195};196#endif197#endif /* !CONFIG_64BIT */198199#endif /* _ASM_GENERIC_FCNTL_H */200201202