linux/include/uapi/linux/fcntl.h

/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _UAPI_LINUX_FCNTL_H
#define _UAPI_LINUX_FCNTL_H

#include <asm/fcntl.h>
#include <linux/openat2.h>

#define F_SETLEASE
#define F_GETLEASE

/*
 * Request nofications on a directory.
 * See below for events that may be notified.
 */
#define F_NOTIFY

#define F_DUPFD_QUERY

/* Was the file just created? */
#define F_CREATED_QUERY

/*
 * Cancel a blocking posix lock; internal use only until we expose an
 * asynchronous lock api to userspace:
 */
#define F_CANCELLK

/* Create a file descriptor with FD_CLOEXEC set. */
#define F_DUPFD_CLOEXEC

/*
 * Set and get of pipe page size array
 */
#define F_SETPIPE_SZ
#define F_GETPIPE_SZ

/*
 * Set/Get seals
 */
#define F_ADD_SEALS
#define F_GET_SEALS

/*
 * Types of seals
 */
#define F_SEAL_SEAL
#define F_SEAL_SHRINK
#define F_SEAL_GROW
#define F_SEAL_WRITE
#define F_SEAL_FUTURE_WRITE
#define F_SEAL_EXEC
/* (1U << 31) is reserved for signed error codes */

/*
 * Set/Get write life time hints. {GET,SET}_RW_HINT operate on the
 * underlying inode, while {GET,SET}_FILE_RW_HINT operate only on
 * the specific file.
 */
#define F_GET_RW_HINT
#define F_SET_RW_HINT
#define F_GET_FILE_RW_HINT
#define F_SET_FILE_RW_HINT

/*
 * Valid hint values for F_{GET,SET}_RW_HINT. 0 is "not set", or can be
 * used to clear any hints previously set.
 */
#define RWH_WRITE_LIFE_NOT_SET
#define RWH_WRITE_LIFE_NONE
#define RWH_WRITE_LIFE_SHORT
#define RWH_WRITE_LIFE_MEDIUM
#define RWH_WRITE_LIFE_LONG
#define RWH_WRITE_LIFE_EXTREME

/*
 * The originally introduced spelling is remained from the first
 * versions of the patch set that introduced the feature, see commit
 * v4.13-rc1~212^2~51.
 */
#define RWF_WRITE_LIFE_NOT_SET

/*
 * Types of directory notifications that may be requested.
 */
#define DN_ACCESS
#define DN_MODIFY
#define DN_CREATE
#define DN_DELETE
#define DN_RENAME
#define DN_ATTRIB
#define DN_MULTISHOT

#define AT_FDCWD


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

/* Reserved for per-syscall flags	0xff. */
#define AT_SYMLINK_NOFOLLOW
/* Reserved for per-syscall flags	0x200 */
#define AT_SYMLINK_FOLLOW
#define AT_NO_AUTOMOUNT
#define AT_EMPTY_PATH
/*
 * 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
#define AT_STATX_SYNC_AS_STAT
#define AT_STATX_FORCE_SYNC
#define AT_STATX_DONT_SYNC

#define AT_RECURSIVE

/*
 * 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
#define AT_RENAME_EXCHANGE
#define AT_RENAME_WHITEOUT

/* Flag for faccessat(2). */
#define AT_EACCESS
/* Flag for unlinkat(2). */
#define AT_REMOVEDIR
/* Flags for name_to_handle_at(2). */
#define AT_HANDLE_FID
#define AT_HANDLE_MNT_ID_UNIQUE

#if defined(__KERNEL__)
#define AT_GETATTR_NOSEC
#endif

#endif /* _UAPI_LINUX_FCNTL_H */