feat(stat): stat/mkdir/chmod and mode macros
This commit is contained in:
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user