posix-next API 0.1.0
Out-of-tree Zephyr POSIX module
Loading...
Searching...
No Matches
fcntl.h File Reference

POSIX file control options (<fcntl.h>) More...

#include <sys/stat.h>
#include <zephyr/sys/fdtable.h>
Include dependency graph for fcntl.h:

Go to the source code of this file.

Data Structures

struct  flock
 File segment locking structure used with F_GETLK, F_SETLK, and F_SETLKW. More...
 

Macros

#define F_DUPFD   ZVFS_F_DUPFD
 Duplicate a file descriptor to the lowest available descriptor >= arg.
 
#define F_DUPFD_CLOEXEC   ZVFS_F_DUPFD_CLOEXEC
 Duplicate a file descriptor with the close-on-exec flag set.
 
#define F_GETFD   ZVFS_F_GETFD
 Get file descriptor flags.
 
#define F_SETFD   ZVFS_F_SETFD
 Set file descriptor flags.
 
#define F_GETFL   ZVFS_F_GETFL
 Get file status flags and file access modes.
 
#define F_SETFL   ZVFS_F_SETFL
 Set file status flags.
 
#define F_GETLK   ZVFS_F_GETLK
 Get the first lock that blocks the lock described by the argument.
 
#define F_SETLK   ZVFS_F_SETLK
 Set or clear a file segment lock (non-blocking).
 
#define F_SETLKW   ZVFS_F_SETLKW
 Set or clear a file segment lock (blocking).
 
#define F_GETOWN   ZVFS_F_GETOWN
 Get the process or process group ID that receives SIGIO/SIGURG signals.
 
#define F_SETOWN   ZVFS_F_SETOWN
 Set the process or process group ID that receives SIGIO/SIGURG signals.
 
#define FD_CLOEXEC   ZVFS_FD_CLOEXEC
 Close-on-exec flag for file descriptors.
 
#define F_RDLCK   ZVFS_F_RDLCK
 Lock type: shared read lock.
 
#define F_UNLCK   ZVFS_F_UNLCK
 Lock type: unlock (release a lock).
 
#define F_WRLCK   ZVFS_F_WRLCK
 Lock type: exclusive write lock.
 
#define SEEK_CUR   ZVFS_SEEK_CUR
 Set offset relative to current file position.
 
#define SEEK_END   ZVFS_SEEK_END
 Set offset relative to end of file.
 
#define SEEK_SET   ZVFS_SEEK_SET
 Set offset to absolute position.
 
#define O_CLOEXEC   ZVFS_O_CLOEXEC
 Close file descriptor on exec (open() flag).
 
#define O_CREAT   ZVFS_O_CREAT
 Create file if it does not exist (open() flag).
 
#define O_DIRECTORY   ZVFS_O_DIRECTORY
 Fail if path does not name a directory (open() flag).
 
#define O_EXCL   ZVFS_O_EXCL
 Exclusive creation: fail if file already exists (open() flag, with O_CREAT).
 
#define O_NOCTTY   ZVFS_O_NOCTTY
 Do not assign a controlling terminal (open() flag).
 
#define O_NOFOLLOW   ZVFS_O_NOFOLLOW
 Do not follow symbolic links (open() flag).
 
#define O_TRUNC   ZVFS_O_TRUNC
 Truncate file to zero length on open (open() flag).
 
#define O_TTY_INIT   ZVFS_O_TTY_INIT
 Initialise terminal to conforming state (open() flag).
 
#define O_APPEND   ZVFS_O_APPEND
 Write operations append to end of file.
 
#define O_DSYNC   ZVFS_O_DSYNC
 Write I/O completes as defined for synchronised I/O data integrity.
 
#define O_NONBLOCK   ZVFS_O_NONBLOCK
 Non-blocking I/O mode.
 
#define O_RSYNC   ZVFS_O_RSYNC
 Synchronised read I/O (same as O_SYNC for reads).
 
#define O_SYNC   ZVFS_O_SYNC
 Write I/O completes as defined for synchronised I/O file integrity.
 
#define O_EXEC   ZVFS_O_EXEC
 Open for execute only (no read, write, or search).
 
#define O_RDONLY   ZVFS_O_RDONLY
 Open for reading only.
 
#define O_RDWR   ZVFS_O_RDWR
 Open for reading and writing.
 
#define O_SEARCH   ZVFS_O_SEARCH
 Open directory for search only.
 
#define O_WRONLY   ZVFS_O_WRONLY
 Open for writing only.
 
#define O_ACCMODE   (ZVFS_O_RDONLY | ZVFS_O_RDWR | ZVFS_O_WRONLY)
 Mask to extract the file access mode from open flags.
 
#define AT_FDCWD   ZVFS_AT_FDCWD
 Equivalent to "." in the current directory (used with *at() functions).
 
#define AT_EACCESS   ZVFS_AT_EACCESS
 Use effective IDs (faccessat flag).
 
#define AT_SYMLINK_NOFOLLOW   ZVFS_AT_SYMLINK_NOFOLLOW
 Do not follow symbolic links (*at flag).
 
#define AT_SYMLINK_FOLLOW   ZVFS_AT_SYMLINK_FOLLOW
 Follow symbolic links (*at flag).
 
#define AT_REMOVEDIR   ZVFS_AT_REMOVEDIR
 Remove directory (unlinkat flag).
 
#define POSIX_FADV_NORMAL   ZVFS_POSIX_FADV_NORMAL
 No advice (default access pattern).
 
#define POSIX_FADV_RANDOM   ZVFS_POSIX_FADV_RANDOM
 Data will be accessed in random order.
 
#define POSIX_FADV_SEQUENTIAL   ZVFS_POSIX_FADV_SEQUENTIAL
 Data will be accessed sequentially.
 
#define POSIX_FADV_WILLNEED   ZVFS_POSIX_FADV_WILLNEED
 Data will be needed in the near future.
 
#define POSIX_FADV_DONTNEED   ZVFS_POSIX_FADV_DONTNEED
 Data will not be accessed in the near future.
 
#define POSIX_FADV_NOREUSE   ZVFS_POSIX_FADV_NOREUSE
 Data will be accessed only once.
 
#define _FLOCK_DECLARED
 
#define __flock_defined
 
#define _MODE_T_DECLARED
 
#define __mode_t_defined
 
#define _OFF_T_DECLARED
 
#define __off_t_defined
 
#define _PID_T_DECLARED
 
#define __pid_t_defined
 

Typedefs

typedef int mode_t
 File permission bits type.
 
typedef long off_t
 File offset type.
 
typedef int pid_t
 Process ID type.
 

Functions

int creat (const char *path, mode_t mode)
 Create or truncate a file.
 
int fcntl (int fildes, int cmd,...)
 Perform file control operations on an open file descriptor.
 
int open (const char *name, int flags,...)
 Open or create a file.
 
int openat (int fd, const char *path, int oflag,...)
 Open or create a file relative to a directory file descriptor.
 
int posix_fadvise (int fd, off_t offset, off_t len, int advice)
 Declare an expected access pattern for a file region.
 
int posix_fallocate (int fd, off_t offset, off_t len)
 Guarantee that disk space is allocated for a file region.
 

Detailed Description

POSIX file control options (<fcntl.h>)

Defines the file-control commands, file-descriptor flags, file-access mode flags, and related types used with open(), creat(), and fcntl().

See also
POSIX.1-2017 <fcntl.h>

Definition in file fcntl.h.

Macro Definition Documentation

◆ __flock_defined

#define __flock_defined

Definition at line 173 of file fcntl.h.

◆ __mode_t_defined

#define __mode_t_defined

Definition at line 180 of file fcntl.h.

◆ __off_t_defined

#define __off_t_defined

Definition at line 187 of file fcntl.h.

◆ __pid_t_defined

#define __pid_t_defined

Definition at line 194 of file fcntl.h.

◆ _FLOCK_DECLARED

#define _FLOCK_DECLARED

Definition at line 172 of file fcntl.h.

◆ _MODE_T_DECLARED

#define _MODE_T_DECLARED

Definition at line 179 of file fcntl.h.

◆ _OFF_T_DECLARED

#define _OFF_T_DECLARED

Definition at line 186 of file fcntl.h.

◆ _PID_T_DECLARED

#define _PID_T_DECLARED

Definition at line 193 of file fcntl.h.

Typedef Documentation

◆ mode_t

typedef int mode_t

File permission bits type.

Definition at line 178 of file fcntl.h.

◆ off_t

typedef long off_t

File offset type.

Definition at line 185 of file fcntl.h.

◆ pid_t

typedef int pid_t

Process ID type.

Definition at line 192 of file fcntl.h.