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

POSIX file status types and functions (<sys/stat.h>) More...

#include <time.h>
#include <zephyr/toolchain.h>
#include <zephyr/sys/fdtable.h>
Include dependency graph for stat.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  timespec
 Time value with nanosecond resolution. More...
 
struct  stat
 File status information returned by stat(), fstat(), and lstat(). More...
 

Macros

#define _BLKCNT_T_DECLARED
 
#define __blkcnt_t_defined
 
#define _BLKSIZE_T_DECLARED
 
#define __blksize_t_defined
 
#define _DEV_T_DECLARED
 
#define __dev_t_defined
 
#define _GID_T_DECLARED
 
#define __gid_t_defined
 
#define _INO_T_DECLARED
 
#define __ino_t_defined
 
#define _MODE_T_DECLARED
 
#define __mode_t_defined
 
#define _NLINK_T_DECLARED
 
#define __nlink_t_defined
 
#define _OFF_T_DECLARED
 
#define __off_t_defined
 
#define _TIMESPEC_DECLARED
 
#define __timespec_defined
 
#define _UID_T_DECLARED
 
#define __uid_t_defined
 
#define _STAT_DECLARED
 
#define __stat_defined
 
#define S_IFMT   ZVFS_MODE_IFMT
 Bit mask for the file type bits in st_mode.
 
#define S_IFBLK   ZVFS_MODE_IFBLK
 Block special file.
 
#define S_IFCHR   ZVFS_MODE_IFCHR
 Character special file.
 
#define S_IFIFO   ZVFS_MODE_IFIFO
 FIFO special file.
 
#define S_IFREG   ZVFS_MODE_IFREG
 Regular file.
 
#define S_IFDIR   ZVFS_MODE_IFDIR
 Directory.
 
#define S_IFLNK   ZVFS_MODE_IFLNK
 Symbolic link.
 
#define S_IFSOCK   ZVFS_MODE_IFSOCK
 Socket.
 
#define S_IFSHM   ZVFS_MODE_IFSHM
 Shared memory object (Zephyr extension).
 
#define S_IRWXU   ZVFS_S_IRWXU
 Read, write, execute permission for owner.
 
#define S_IRUSR   ZVFS_S_IRUSR
 Read permission for owner.
 
#define S_IWUSR   ZVFS_S_IWUSR
 Write permission for owner.
 
#define S_IXUSR   ZVFS_S_IXUSR
 Execute permission for owner.
 
#define S_IRWXG   ZVFS_S_IRWXG
 Read, write, execute permission for group.
 
#define S_IRGRP   ZVFS_S_IRGRP
 Read permission for group.
 
#define S_IWGRP   ZVFS_S_IWGRP
 Write permission for group.
 
#define S_IXGRP   ZVFS_S_IXGRP
 Execute permission for group.
 
#define S_IRWXO   ZVFS_S_IRWXO
 Read, write, execute permission for others.
 
#define S_IROTH   ZVFS_S_IROTH
 Read permission for others.
 
#define S_IWOTH   ZVFS_S_IWOTH
 Write permission for others.
 
#define S_IXOTH   ZVFS_S_IXOTH
 Execute permission for others.
 
#define S_ISUID   ZVFS_S_ISUID
 Set-user-ID bit.
 
#define S_ISGID   ZVFS_S_ISGID
 Set-group-ID bit.
 
#define S_ISVTX   ZVFS_S_ISVTX
 Sticky bit (restricted deletion).
 
#define S_ISBLK(m)   (((m) & S_IFMT) == S_IFBLK)
 Test whether m is a block special file.
 
#define S_ISCHR(m)   (((m) & S_IFMT) == S_IFCHR)
 Test whether m is a character special file.
 
#define S_ISDIR(m)   (((m) & S_IFMT) == S_IFDIR)
 Test whether m is a directory.
 
#define S_ISFIFO(m)   (((m) & S_IFMT) == S_IFIFO)
 Test whether m is a FIFO.
 
#define S_ISREG(m)   (((m) & S_IFMT) == S_IFREG)
 Test whether m is a regular file.
 
#define S_ISLNK(m)   (((m) & S_IFMT) == S_IFLNK)
 Test whether m is a symbolic link.
 
#define S_ISSOCK(m)   (((m) & S_IFMT) == S_IFSOCK)
 Test whether m is a socket.
 
#define S_TYPEISMQ(buf)   (0)
 Test whether the file is a message queue (always 0).
 
#define S_TYPEISSEM(buf)   (0)
 Test whether the file is a semaphore (always 0).
 
#define S_TYPEISSHM(st)   (((st)->st_mode & S_IFMT) == S_IFSHM)
 Test whether the file is a shared memory object.
 
#define S_TYPEISTMO(buf)   (0)
 Test whether the file is a typed memory object (always 0).
 
#define UTIME_NOW   -1
 Set st_atim or st_mtim to the current time (utimensat flag).
 
#define UTIME_OMIT   -2
 Leave st_atim or st_mtim unchanged (utimensat flag).
 

Typedefs

typedef long blkcnt_t
 
typedef unsigned long blksize_t
 
typedef int dev_t
 
typedef unsigned short gid_t
 
typedef long ino_t
 
typedef int mode_t
 
typedef unsigned short nlink_t
 
typedef long off_t
 
typedef unsigned short uid_t
 

Functions

int chmod (const char *path, mode_t mode)
 Change the mode of a file.
 
int fchmod (int fildes, mode_t mode)
 Change the mode of an open file.
 
int fchmodat (int fd, const char *path, mode_t mode, int flag)
 Change the mode of a file relative to a directory descriptor.
 
int fstat (int fildes, struct stat *buf)
 Get status of an open file.
 
int fstatat (int fd, const char *ZRESTRICT path, struct stat *ZRESTRICT buf, int flag)
 Get status of a file relative to a directory descriptor.
 
int futimens (int fildes, const struct timespec times[2])
 Set file access and modification times of an open file (nanosecond resolution).
 
int lstat (const char *ZRESTRICT path, struct stat *ZRESTRICT buf)
 Get status of a file (does not follow symbolic links).
 
int mkdir (const char *path, mode_t mode)
 Create a directory.
 
int mkdirat (int fd, const char *path, mode_t mode)
 Create a directory relative to a directory descriptor.
 
int mkfifo (const char *path, mode_t mode)
 Create a FIFO special file.
 
int mkfifoat (int fd, const char *path, mode_t mode)
 Create a FIFO special file relative to a directory descriptor.
 
int mknod (const char *path, mode_t mode, dev_t dev)
 Create a special or regular file (XSI extension).
 
int mknodat (int fd, const char *path, mode_t mode, dev_t dev)
 Create a special or regular file relative to a directory descriptor (XSI).
 
 TOOLCHAIN_DISABLE_WARNING (TOOLCHAIN_WARNING_SHADOW)
 
int stat (const char *ZRESTRICT path, struct stat *ZRESTRICT buf)
 Get status of a file by path (follows symbolic links).
 
 TOOLCHAIN_ENABLE_WARNING (TOOLCHAIN_WARNING_SHADOW)
 
mode_t umask (mode_t cmask)
 Set the file mode creation mask.
 
int utimensat (int fd, const char *path, const struct timespec times[2], int flag)
 Set file access and modification times relative to a directory descriptor.
 

Detailed Description

POSIX file status types and functions (<sys/stat.h>)

See also
POSIX.1-2017 <sys/stat.h>

Definition in file stat.h.

Macro Definition Documentation

◆ __blkcnt_t_defined

#define __blkcnt_t_defined

Definition at line 35 of file stat.h.

◆ __blksize_t_defined

#define __blksize_t_defined

Definition at line 41 of file stat.h.

◆ __dev_t_defined

#define __dev_t_defined

Definition at line 47 of file stat.h.

◆ __gid_t_defined

#define __gid_t_defined

Definition at line 53 of file stat.h.

◆ __ino_t_defined

#define __ino_t_defined

Definition at line 59 of file stat.h.

◆ __mode_t_defined

#define __mode_t_defined

Definition at line 65 of file stat.h.

◆ __nlink_t_defined

#define __nlink_t_defined

Definition at line 71 of file stat.h.

◆ __off_t_defined

#define __off_t_defined

Definition at line 77 of file stat.h.

◆ __stat_defined

#define __stat_defined

Definition at line 128 of file stat.h.

◆ __timespec_defined

#define __timespec_defined

Definition at line 96 of file stat.h.

◆ __uid_t_defined

#define __uid_t_defined

Definition at line 103 of file stat.h.

◆ _BLKCNT_T_DECLARED

#define _BLKCNT_T_DECLARED

Definition at line 34 of file stat.h.

◆ _BLKSIZE_T_DECLARED

#define _BLKSIZE_T_DECLARED

Definition at line 40 of file stat.h.

◆ _DEV_T_DECLARED

#define _DEV_T_DECLARED

Definition at line 46 of file stat.h.

◆ _GID_T_DECLARED

#define _GID_T_DECLARED

Definition at line 52 of file stat.h.

◆ _INO_T_DECLARED

#define _INO_T_DECLARED

Definition at line 58 of file stat.h.

◆ _MODE_T_DECLARED

#define _MODE_T_DECLARED

Definition at line 64 of file stat.h.

◆ _NLINK_T_DECLARED

#define _NLINK_T_DECLARED

Definition at line 70 of file stat.h.

◆ _OFF_T_DECLARED

#define _OFF_T_DECLARED

Definition at line 76 of file stat.h.

◆ _STAT_DECLARED

#define _STAT_DECLARED

Definition at line 127 of file stat.h.

◆ _TIMESPEC_DECLARED

#define _TIMESPEC_DECLARED

Definition at line 95 of file stat.h.

◆ _UID_T_DECLARED

#define _UID_T_DECLARED

Definition at line 102 of file stat.h.

Typedef Documentation

◆ blkcnt_t

typedef long blkcnt_t

Definition at line 33 of file stat.h.

◆ blksize_t

typedef unsigned long blksize_t

Definition at line 39 of file stat.h.

◆ dev_t

typedef int dev_t

Definition at line 45 of file stat.h.

◆ gid_t

typedef unsigned short gid_t

Definition at line 51 of file stat.h.

◆ ino_t

typedef long ino_t

Definition at line 57 of file stat.h.

◆ mode_t

typedef int mode_t

Definition at line 63 of file stat.h.

◆ nlink_t

typedef unsigned short nlink_t

Definition at line 69 of file stat.h.

◆ off_t

typedef long off_t

Definition at line 75 of file stat.h.

◆ uid_t

typedef unsigned short uid_t

Definition at line 101 of file stat.h.