forked from Bananymous/banan-os
Kernel/LibC: Implement creat with open
This allows getting rid of unnecessary SYS_CREATE. Directory creation still has its own syscall, but I could combine it with SYS_OPEN also.
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int creat(const char* path, mode_t mode)
|
||||
{
|
||||
return syscall(SYS_CREATE, path, S_IFREG | __UMASKED_MODE(mode));
|
||||
return open(path, O_WRONLY | O_CREAT | O_TRUNC, mode);
|
||||
}
|
||||
|
||||
int open(const char* path, int oflag, ...)
|
||||
|
||||
@@ -56,7 +56,6 @@ __BEGIN_DECLS
|
||||
O(SYS_POWEROFF, poweroff) \
|
||||
O(SYS_CHMOD, chmod) \
|
||||
O(SYS_FCHMOD, fchmod) \
|
||||
O(SYS_CREATE, create) \
|
||||
O(SYS_CREATE_DIR, create_dir) \
|
||||
O(SYS_UNLINK, unlink) \
|
||||
O(SYS_READLINK, readlink) \
|
||||
|
||||
Reference in New Issue
Block a user