Kernel/LibC/Userspace: Implement mkdir and creat

Touch now uses creat insteadd of open with O_CREAT flag
This commit is contained in:
2023-10-25 19:45:18 +03:00
parent e9b7cf332d
commit 6ee4d10651
11 changed files with 83 additions and 10 deletions

View File

@@ -4,6 +4,11 @@
#include <sys/syscall.h>
#include <unistd.h>
int creat(const char* path, mode_t mode)
{
return syscall(SYS_CREATE, path, S_IFREG | mode);
}
int open(const char* path, int oflag, ...)
{
va_list args;

View File

@@ -56,6 +56,8 @@ __BEGIN_DECLS
#define SYS_TTY_CTRL 53
#define SYS_POWEROFF 54
#define SYS_CHMOD 55
#define SYS_CREATE 56 // creat, mkfifo
#define SYS_CREATE_DIR 57 // mkdir
__END_DECLS

View File

@@ -28,3 +28,8 @@ int stat(const char* __restrict path, struct stat* __restrict buf)
{
return syscall(SYS_STAT, path, buf, 0);
}
int mkdir(const char* path, mode_t mode)
{
return syscall(SYS_CREATE_DIR, path, mode);
}