include/uapi/linux/fcntl.h

Source file repositories/reference/linux-study-clean/include/uapi/linux/fcntl.h

File Facts

System
Linux kernel
Corpus path
include/uapi/linux/fcntl.h
Extension
.h
Size
7297 bytes
Lines
194
Domain
Core OS
Bucket
Core Kernel Interface
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

struct delegation {
	__u32	d_flags;	/* Must be 0 */
	__u16	d_type;		/* F_RDLCK, F_WRLCK, F_UNLCK */
	__u16	__pad;		/* Must be 0 */
};

/*
 * Types of directory notifications that may be requested.
 */
#define DN_ACCESS	0x00000001	/* File accessed */
#define DN_MODIFY	0x00000002	/* File modified */
#define DN_CREATE	0x00000004	/* File created */
#define DN_DELETE	0x00000008	/* File removed */
#define DN_RENAME	0x00000010	/* File renamed */
#define DN_ATTRIB	0x00000020	/* File changed attibutes */
#define DN_MULTISHOT	0x80000000	/* Don't remove notifier */

/* Reserved kernel ranges [-100], [-10000, -40000]. */
#define AT_FDCWD		-100    /* Special value for dirfd used to
					   indicate openat should use the
					   current working directory. */

/*
 * The concept of process and threads in userland and the kernel is a confusing
 * one - within the kernel every thread is a 'task' with its own individual PID,
 * however from userland's point of view threads are grouped by a single PID,
 * which is that of the 'thread group leader', typically the first thread
 * spawned.
 *
 * To cut the Gideon knot, for internal kernel usage, we refer to
 * PIDFD_SELF_THREAD to refer to the current thread (or task from a kernel
 * perspective), and PIDFD_SELF_THREAD_GROUP to refer to the current thread
 * group leader...
 */
#define PIDFD_SELF_THREAD		-10000 /* Current thread. */
#define PIDFD_SELF_THREAD_GROUP		-10001 /* Current thread group leader. */

#define FD_PIDFS_ROOT			-10002 /* Root of the pidfs filesystem */
#define FD_NSFS_ROOT			-10003 /* Root of the nsfs filesystem */
#define FD_INVALID			-10009 /* Invalid file descriptor: -10000 - EBADF = -10009 */

/* Generic flags for the *at(2) family of syscalls. */

/* Reserved for per-syscall flags	0xff. */
#define AT_SYMLINK_NOFOLLOW		0x100   /* Do not follow symbolic
						   links. */
/* Reserved for per-syscall flags	0x200 */
#define AT_SYMLINK_FOLLOW		0x400   /* Follow symbolic links. */
#define AT_NO_AUTOMOUNT			0x800	/* Suppress terminal automount
						   traversal. */
#define AT_EMPTY_PATH			0x1000	/* Allow empty relative
						   pathname to operate on dirfd
						   directly. */
/*
 * These flags are currently statx(2)-specific, but they could be made generic
 * in the future and so they should not be used for other per-syscall flags.
 */
#define AT_STATX_SYNC_TYPE		0x6000	/* Type of synchronisation required from statx() */
#define AT_STATX_SYNC_AS_STAT		0x0000	/* - Do whatever stat() does */
#define AT_STATX_FORCE_SYNC		0x2000	/* - Force the attributes to be sync'd with the server */
#define AT_STATX_DONT_SYNC		0x4000	/* - Don't sync attributes with the server */

#define AT_RECURSIVE			0x8000	/* Apply to the entire subtree */

/*
 * Per-syscall flags for the *at(2) family of syscalls.
 *
 * These are flags that are so syscall-specific that a user passing these flags
 * to the wrong syscall is so "clearly wrong" that we can safely call such
 * usage "undefined behaviour".
 *
 * For example, the constants AT_REMOVEDIR and AT_EACCESS have the same value.
 * AT_EACCESS is meaningful only to faccessat, while AT_REMOVEDIR is meaningful
 * only to unlinkat. The two functions do completely different things and
 * therefore, the flags can be allowed to overlap. For example, passing
 * AT_REMOVEDIR to faccessat would be undefined behavior and thus treating it
 * equivalent to AT_EACCESS is valid undefined behavior.
 *
 * Note for implementers: When picking a new per-syscall AT_* flag, try to
 * reuse already existing flags first. This leaves us with as many unused bits
 * as possible, so we can use them for generic bits in the future if necessary.
 */

/* Flags for renameat2(2) (must match legacy RENAME_* flags). */
#define AT_RENAME_NOREPLACE	0x0001
#define AT_RENAME_EXCHANGE	0x0002
#define AT_RENAME_WHITEOUT	0x0004

/* Flag for faccessat(2). */
#define AT_EACCESS		0x200	/* Test access permitted for

Annotation

Implementation Notes