mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 01:05:54 +08:00
fs: support openat/fchmodat/mkfifoat/fstatat/...at api
Refs to: https://linux.die.net/man/2/openat Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
@@ -112,6 +112,18 @@
|
||||
|
||||
#define FD_CLOEXEC 1
|
||||
|
||||
/* The flag for openat, faccessat, ... */
|
||||
|
||||
#define AT_FDCWD -100 /* Special value used to indicate openat should use the current
|
||||
* working directory.
|
||||
*/
|
||||
#define AT_SYMLINK_NOFOLLOW 0x0100 /* Do not follow symbolic links. */
|
||||
#define AT_EACCESS 0x0200 /* Test access permitted for effective IDs, not real IDs. */
|
||||
#define AT_REMOVEDIR 0x0200 /* Remove directory instead of unlinking file. */
|
||||
#define AT_SYMLINK_FOLLOW 0x0400 /* Follow symbolic links. */
|
||||
#define AT_NO_AUTOMOUNT 0x0800 /* Suppress terminal automount traversal */
|
||||
#define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname */
|
||||
|
||||
/* These are the notifications that can be received from F_NOTIFY (linux) */
|
||||
|
||||
#define DN_ACCESS 0 /* A file was accessed */
|
||||
@@ -185,6 +197,7 @@ extern "C"
|
||||
/* POSIX-like File System Interfaces */
|
||||
|
||||
int open(FAR const char *path, int oflag, ...);
|
||||
int openat(int dirfd, FAR const char *path, int oflag, ...);
|
||||
int fcntl(int fd, int cmd, ...);
|
||||
|
||||
int posix_fallocate(int fd, off_t offset, off_t len);
|
||||
|
||||
@@ -188,6 +188,8 @@ int putc(int c, FAR FILE *stream);
|
||||
int putchar(int c);
|
||||
int puts(FAR const IPTR char *s);
|
||||
int rename(FAR const char *oldpath, FAR const char *newpath);
|
||||
int renameat(int olddirfd, FAR const char *oldpath,
|
||||
int newdirfd, FAR const char *newpath);
|
||||
int sprintf(FAR char *buf, FAR const IPTR char *fmt, ...)
|
||||
printf_like(2, 3);
|
||||
int asprintf(FAR char **ptr, FAR const IPTR char *fmt, ...)
|
||||
|
||||
@@ -171,15 +171,23 @@ extern "C"
|
||||
#endif
|
||||
|
||||
int mkdir(FAR const char *pathname, mode_t mode);
|
||||
int mkdirat(int dirfd, FAR const char *pathname, mode_t mode);
|
||||
int mkfifo(FAR const char *pathname, mode_t mode);
|
||||
int mkfifoat(int dirfd, FAR const char *pathname, mode_t mode);
|
||||
int mknod(FAR const char *path, mode_t mode, dev_t dev);
|
||||
int mknodat(int dirfd, FAR const char *path, mode_t mode, dev_t dev);
|
||||
int stat(FAR const char *path, FAR struct stat *buf);
|
||||
int lstat(FAR const char *path, FAR struct stat *buf);
|
||||
int fstat(int fd, FAR struct stat *buf);
|
||||
int fstatat(int dirfd, FAR const char *path, FAR struct stat *buf,
|
||||
int flags);
|
||||
int chmod(FAR const char *path, mode_t mode);
|
||||
int lchmod(FAR const char *path, mode_t mode);
|
||||
int fchmod(int fd, mode_t mode);
|
||||
int fchmodat(int dirfd, FAR const char *path, mode_t mode, int flags);
|
||||
int utimens(FAR const char *path, const struct timespec times[2]);
|
||||
int utimensat(int dirfd, FAR const char *path,
|
||||
const struct timespec times[2], int flags);
|
||||
int lutimens(FAR const char *path, const struct timespec times[2]);
|
||||
int futimens(int fd, const struct timespec times[2]);
|
||||
|
||||
|
||||
@@ -373,6 +373,8 @@ int setitimer(int which, FAR const struct itimerval *value,
|
||||
|
||||
int utimes(FAR const char *path, const struct timeval times[2]);
|
||||
int lutimes(FAR const char *path, const struct timeval times[2]);
|
||||
int futimesat(int dirfd, FAR const char *path,
|
||||
const struct timeval times[2]);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: futimes
|
||||
|
||||
@@ -368,14 +368,24 @@ FAR char *getcwd(FAR char *buf, size_t size);
|
||||
/* File path operations */
|
||||
|
||||
int access(FAR const char *path, int amode);
|
||||
int faccessat(int dirfd, FAR const char *path, int mode, int flags);
|
||||
int rmdir(FAR const char *pathname);
|
||||
int unlink(FAR const char *pathname);
|
||||
int unlinkat(int dirfd, FAR const char *pathname, int flags);
|
||||
int truncate(FAR const char *path, off_t length);
|
||||
int link(FAR const char *path1, FAR const char *path2);
|
||||
int linkat(int olddirfd, FAR const char *path1,
|
||||
int newdirfd, FAR const char *path2, int flags);
|
||||
int symlink(FAR const char *path1, FAR const char *path2);
|
||||
int symlinkat(FAR const char *path1, int dirfd,
|
||||
FAR const char *path2);
|
||||
ssize_t readlink(FAR const char *path, FAR char *buf, size_t bufsize);
|
||||
ssize_t readlinkat(int dirfd, FAR const char *path, FAR char *buf,
|
||||
size_t bufsize);
|
||||
int chown(FAR const char *path, uid_t owner, gid_t group);
|
||||
int lchown(FAR const char *path, uid_t owner, gid_t group);
|
||||
int fchownat(int dirfd, FAR const char *path, uid_t owner,
|
||||
gid_t group, int flags);
|
||||
|
||||
/* Execution of programs from files */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user