feat(stat): stat/mkdir/chmod and mode macros
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "../internal/syscall.h"
|
||||
#include "stat_impl.h"
|
||||
|
||||
#if VLIBC_LEVEL_GE(2)
|
||||
|
||||
/*
|
||||
* mknod/mknodat over SYS_mknodat (XSI, level 2). The mode argument must
|
||||
* carry a file-type bit (S_IFIFO, S_IFCHR, S_IFBLK, S_IFREG, ...); dev is
|
||||
* the raw device id for the S_IFCHR/S_IFBLK cases and is otherwise
|
||||
* ignored by the kernel. Creating device nodes requires privilege
|
||||
* (CAP_MKNOD); creating a FIFO or a regular file does not.
|
||||
*/
|
||||
int
|
||||
mknodat(int fd, const char *path, mode_t mode, dev_t dev)
|
||||
{
|
||||
return syscall_ret(__syscall4(SYS_mknodat, fd, (long)path, (long)mode, (long)dev));
|
||||
}
|
||||
|
||||
int
|
||||
mknod(const char *path, mode_t mode, dev_t dev)
|
||||
{
|
||||
return mknodat(VLIBC_STAT_AT_FDCWD, path, mode, dev);
|
||||
}
|
||||
|
||||
#endif /* VLIBC_LEVEL_GE(2) */
|
||||
Reference in New Issue
Block a user