Kernel/LibC/Userspace: Implement mkdir and creat
Touch now uses creat insteadd of open with O_CREAT flag
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user