posix-next API 0.1.0
Out-of-tree Zephyr POSIX module
Loading...
Searching...
No Matches
POSIX_FD_MGMT

POSIX File Descriptor Management option group. 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_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 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 SEEK_CUR   1
 Seek relative to the current file offset.
 
#define SEEK_END   2
 Seek relative to the end of the file.
 
#define SEEK_SET   0
 Seek relative to the start of the file.
 

Functions

int fcntl (int fildes, int cmd,...)
 Perform file control operations on an open file descriptor.
 
int dup (int fildes)
 Duplicate an open file descriptor to the lowest available descriptor.
 
int dup2 (int fildes, int fildes2)
 Duplicate an open file descriptor to a specific descriptor number.
 
int ftruncate (int fildes, off_t length)
 Truncate an open file to a specified length.
 
off_t lseek (int fildes, off_t offset, int whence)
 Reposition the file offset of an open file descriptor.
 

Detailed Description

POSIX File Descriptor Management option group.

Covers dup(), dup2(), ftruncate(), lseek(), and related file-descriptor manipulation functions.

Macro Definition Documentation

◆ F_DUPFD

#define F_DUPFD   ZVFS_F_DUPFD

Duplicate a file descriptor to the lowest available descriptor >= arg.

Definition at line 34 of file fcntl.h.

◆ F_DUPFD_CLOEXEC

#define F_DUPFD_CLOEXEC   ZVFS_F_DUPFD_CLOEXEC

Duplicate a file descriptor with the close-on-exec flag set.

Definition at line 37 of file fcntl.h.

◆ F_GETFD

#define F_GETFD   ZVFS_F_GETFD

Get file descriptor flags.

Definition at line 40 of file fcntl.h.

◆ F_GETFL

#define F_GETFL   ZVFS_F_GETFL

Get file status flags and file access modes.

Definition at line 44 of file fcntl.h.

◆ F_GETOWN

#define F_GETOWN   ZVFS_F_GETOWN

Get the process or process group ID that receives SIGIO/SIGURG signals.

Definition at line 55 of file fcntl.h.

◆ F_SETFD

#define F_SETFD   ZVFS_F_SETFD

Set file descriptor flags.

Definition at line 42 of file fcntl.h.

◆ F_SETFL

#define F_SETFL   ZVFS_F_SETFL

Set file status flags.

Definition at line 46 of file fcntl.h.

◆ F_SETOWN

#define F_SETOWN   ZVFS_F_SETOWN

Set the process or process group ID that receives SIGIO/SIGURG signals.

Definition at line 57 of file fcntl.h.

◆ FD_CLOEXEC

#define FD_CLOEXEC   ZVFS_FD_CLOEXEC

Close-on-exec flag for file descriptors.

Definition at line 61 of file fcntl.h.

◆ SEEK_CUR [1/2]

#define SEEK_CUR   ZVFS_SEEK_CUR

Set offset relative to current file position.

Seek relative to the current file offset.

Definition at line 75 of file fcntl.h.

◆ SEEK_CUR [2/2]

#define SEEK_CUR   1

Seek relative to the current file offset.

Definition at line 76 of file unistd.h.

◆ SEEK_END [1/2]

#define SEEK_END   ZVFS_SEEK_END

Set offset relative to end of file.

Seek relative to the end of the file.

Definition at line 80 of file fcntl.h.

◆ SEEK_END [2/2]

#define SEEK_END   2

Seek relative to the end of the file.

Definition at line 81 of file unistd.h.

◆ SEEK_SET [1/2]

#define SEEK_SET   ZVFS_SEEK_SET

Set offset to absolute position.

Seek relative to the start of the file.

Definition at line 85 of file fcntl.h.

◆ SEEK_SET [2/2]

#define SEEK_SET   0

Seek relative to the start of the file.

Definition at line 86 of file unistd.h.

Function Documentation

◆ dup()

int dup ( int  fildes)

Duplicate an open file descriptor to the lowest available descriptor.

See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/dup.html

◆ dup2()

int dup2 ( int  fildes,
int  fildes2 
)

Duplicate an open file descriptor to a specific descriptor number.

See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html

◆ fcntl()

int fcntl ( int  fildes,
int  cmd,
  ... 
)

Perform file control operations on an open file descriptor.

Parameters
fildesFile descriptor.
cmdControl command (F_GETFD, F_SETFD, F_GETFL, F_SETFL, F_GETLK, …).
...Optional argument (type depends on cmd).
Returns
Command-specific value on success, or -1 with errno set on failure.
See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html

◆ ftruncate()

int ftruncate ( int  fildes,
off_t  length 
)

Truncate an open file to a specified length.

See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html

◆ lseek()

off_t lseek ( int  fildes,
off_t  offset,
int  whence 
)

Reposition the file offset of an open file descriptor.

See also
https://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html