2023-03-12 15:32:09 +01:00
|
|
|
#include <bits/errno-return.h>
|
2023-04-15 20:26:15 +02:00
|
|
|
#include <fcntl.h>
|
2023-03-12 15:32:09 +01:00
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/syscall.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
extern "C"
|
|
|
|
{
|
2023-03-12 16:55:46 +01:00
|
|
|
int mkdir(const char* path, mode_t mode)
|
2023-03-12 15:32:09 +01:00
|
|
|
{
|
2023-03-12 16:55:46 +01:00
|
|
|
long rc = syscall(SYS_mkdir, path, mode);
|
2023-03-12 15:32:09 +01:00
|
|
|
__errno_return(rc, int);
|
|
|
|
}
|
2023-03-18 09:13:31 +01:00
|
|
|
|
|
|
|
int mknod(const char* path, mode_t mode, dev_t dev)
|
|
|
|
{
|
|
|
|
long rc = syscall(SYS_mknod, path, mode, dev);
|
|
|
|
__errno_return(rc, int);
|
|
|
|
}
|
2023-04-10 19:56:03 +02:00
|
|
|
|
|
|
|
int stat(const char* path, struct stat* st)
|
|
|
|
{
|
2023-04-15 20:26:15 +02:00
|
|
|
long rc = syscall(SYS_fstatat, AT_FDCWD, path, st, 0);
|
2023-04-10 19:56:03 +02:00
|
|
|
__errno_return(rc, int);
|
|
|
|
}
|
|
|
|
|
|
|
|
int fstat(int fd, struct stat* st)
|
|
|
|
{
|
2023-04-15 20:26:15 +02:00
|
|
|
long rc = syscall(SYS_fstatat, fd, "", st, AT_EMPTY_PATH);
|
2023-04-10 19:56:03 +02:00
|
|
|
__errno_return(rc, int);
|
|
|
|
}
|
2023-05-01 20:00:43 +02:00
|
|
|
|
|
|
|
int fstatat(int dirfd, const char* path, struct stat* st, int flags)
|
|
|
|
{
|
|
|
|
long rc = syscall(SYS_fstatat, dirfd, path, st, flags);
|
|
|
|
__errno_return(rc, int);
|
|
|
|
}
|
2023-03-12 15:32:09 +01:00
|
|
|
}
|