Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/fcntl.h
Show First 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | |||||
#if __BSD_VISIBLE | #if __BSD_VISIBLE | ||||
#define O_VERIFY 0x00200000 /* open only after verification */ | #define O_VERIFY 0x00200000 /* open only after verification */ | ||||
#define O_BENEATH 0x00400000 /* Fail if not under cwd */ | #define O_BENEATH 0x00400000 /* Fail if not under cwd */ | ||||
#define O_RESOLVE_BENEATH 0x00800000 /* As O_BENEATH, but do not allow | #define O_RESOLVE_BENEATH 0x00800000 /* As O_BENEATH, but do not allow | ||||
resolve to walk out of cwd even to | resolve to walk out of cwd even to | ||||
return back */ | return back */ | ||||
#endif | #endif | ||||
#define O_DSYNC 0x00800000 /* POSIX data sync */ | |||||
/* | /* | ||||
* XXX missing O_DSYNC, O_RSYNC. | * XXX missing O_RSYNC. | ||||
*/ | */ | ||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
/* Only for devfs d_close() flags. */ | /* Only for devfs d_close() flags. */ | ||||
#define FLASTCLOSE O_DIRECTORY | #define FLASTCLOSE O_DIRECTORY | ||||
#define FREVOKE O_VERIFY | #define FREVOKE O_VERIFY | ||||
/* Only for fo_close() from half-succeeded open */ | /* Only for fo_close() from half-succeeded open */ | ||||
#define FOPENFAILED O_TTY_INIT | #define FOPENFAILED O_TTY_INIT | ||||
/* convert from open() flags to/from fflags; convert O_RD/WR to FREAD/FWRITE */ | /* convert from open() flags to/from fflags; convert O_RD/WR to FREAD/FWRITE */ | ||||
#define FFLAGS(oflags) ((oflags) & O_EXEC ? (oflags) : (oflags) + 1) | #define FFLAGS(oflags) ((oflags) & O_EXEC ? (oflags) : (oflags) + 1) | ||||
#define OFLAGS(fflags) ((fflags) & O_EXEC ? (fflags) : (fflags) - 1) | #define OFLAGS(fflags) ((fflags) & O_EXEC ? (fflags) : (fflags) - 1) | ||||
/* bits to save after open */ | /* bits to save after open */ | ||||
#define FMASK (FREAD|FWRITE|FAPPEND|FASYNC|FFSYNC|FNONBLOCK|O_DIRECT|FEXEC) | #define FMASK (FREAD|FWRITE|FAPPEND|FASYNC|FFSYNC|FDSYNC|FNONBLOCK|O_DIRECT|FEXEC) | ||||
/* bits settable by fcntl(F_SETFL, ...) */ | /* bits settable by fcntl(F_SETFL, ...) */ | ||||
#define FCNTLFLAGS (FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FRDAHEAD|O_DIRECT) | #define FCNTLFLAGS (FAPPEND|FASYNC|FFSYNC|FDSYNC|FNONBLOCK|FRDAHEAD|O_DIRECT) | ||||
#if defined(COMPAT_FREEBSD7) || defined(COMPAT_FREEBSD6) || \ | #if defined(COMPAT_FREEBSD7) || defined(COMPAT_FREEBSD6) || \ | ||||
defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) | defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4) | ||||
/* | /* | ||||
* Set by shm_open(3) in older libc's to get automatic MAP_ASYNC | * Set by shm_open(3) in older libc's to get automatic MAP_ASYNC | ||||
* behavior for POSIX shared memory objects (which are otherwise | * behavior for POSIX shared memory objects (which are otherwise | ||||
* implemented as plain files). | * implemented as plain files). | ||||
*/ | */ | ||||
#define FPOSIXSHM O_NOFOLLOW | #define FPOSIXSHM O_NOFOLLOW | ||||
#undef FCNTLFLAGS | #undef FCNTLFLAGS | ||||
#define FCNTLFLAGS (FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FPOSIXSHM|FRDAHEAD| \ | #define FCNTLFLAGS (FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FPOSIXSHM|FRDAHEAD| \ | ||||
O_DIRECT) | O_DIRECT) | ||||
#endif | #endif | ||||
#endif | #endif | ||||
/* | /* | ||||
* The O_* flags used to have only F* names, which were used in the kernel | * The O_* flags used to have only F* names, which were used in the kernel | ||||
* and by fcntl. We retain the F* names for the kernel f_flag field | * and by fcntl. We retain the F* names for the kernel f_flag field | ||||
* and for backward compatibility for fcntl. These flags are deprecated. | * and for backward compatibility for fcntl. These flags are deprecated. | ||||
*/ | */ | ||||
#if __BSD_VISIBLE | #if __BSD_VISIBLE | ||||
#define FAPPEND O_APPEND /* kernel/compat */ | #define FAPPEND O_APPEND /* kernel/compat */ | ||||
#define FASYNC O_ASYNC /* kernel/compat */ | #define FASYNC O_ASYNC /* kernel/compat */ | ||||
#define FFSYNC O_FSYNC /* kernel */ | #define FFSYNC O_FSYNC /* kernel */ | ||||
#define FDSYNC O_DSYNC /* kernel */ | |||||
#define FNONBLOCK O_NONBLOCK /* kernel */ | #define FNONBLOCK O_NONBLOCK /* kernel */ | ||||
#define FNDELAY O_NONBLOCK /* compat */ | #define FNDELAY O_NONBLOCK /* compat */ | ||||
#define O_NDELAY O_NONBLOCK /* compat */ | #define O_NDELAY O_NONBLOCK /* compat */ | ||||
#endif | #endif | ||||
/* | /* | ||||
* We are out of bits in f_flag (which is a short). However, | * Historically, we ran out of bits in f_flag (which was once a short). | ||||
* the flag bits not set in FMASK are only meaningful in the | * However, the flag bits not set in FMASK are only meaningful in the | ||||
* initial open syscall. Those bits can thus be given a | * initial open syscall. Those bits were thus given a | ||||
* different meaning for fcntl(2). | * different meaning for fcntl(2). | ||||
*/ | */ | ||||
#if __BSD_VISIBLE | #if __BSD_VISIBLE | ||||
/* Read ahead */ | /* Read ahead */ | ||||
#define FRDAHEAD O_CREAT | #define FRDAHEAD O_CREAT | ||||
#endif | #endif | ||||
#if __POSIX_VISIBLE >= 200809 | #if __POSIX_VISIBLE >= 200809 | ||||
▲ Show 20 Lines • Show All 159 Lines • Show Last 20 Lines |