feat(stat): stat/mkdir/chmod and mode macros

This commit is contained in:
2026-09-05 16:35:50 -04:00
parent 87ab610a9b
commit 98f4c3169c
11 changed files with 935 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <sys/stat.h>
#include "../internal/syscall.h"
#include "stat_impl.h"
/*
* mkfifo/mkfifoat over SYS_mknodat with the type bits fixed to S_IFIFO:
* creating a FIFO is mknodat(..., mode | S_IFIFO, dev = 0). POSIX defines
* mkfifo with no device argument, so the dev slot is always 0 here.
*/
int
mkfifoat(int fd, const char *path, mode_t mode)
{
return syscall_ret(__syscall4(SYS_mknodat, fd, (long)path, (long)(mode | S_IFIFO), 0));
}
int
mkfifo(const char *path, mode_t mode)
{
return mkfifoat(VLIBC_STAT_AT_FDCWD, path, mode);
}