diff options
author | Andreas Kling <awesomekling@gmail.com> | 2018-11-18 14:57:41 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2018-11-18 15:02:16 +0100 |
commit | de4604ac95261fe95f5921b0d16ee65fb501332a (patch) | |
tree | 16bf9be7e4d94862179c99d5cdcee29a0b7ca744 /LibC | |
parent | 303577df16cf990d1c0cb2c83cd8a954258809ba (diff) | |
download | serenity-de4604ac95261fe95f5921b0d16ee65fb501332a.zip |
Finally hook up the mkdir code to a syscall.
Added a /bin/mkdir that makes directories. How very neat :^)
There are various limitations because of missing functionality.
Diffstat (limited to 'LibC')
-rw-r--r-- | LibC/errno_numbers.h | 1 | ||||
-rw-r--r-- | LibC/stat.cpp | 7 | ||||
-rw-r--r-- | LibC/sys/stat.h | 1 |
3 files changed, 9 insertions, 0 deletions
diff --git a/LibC/errno_numbers.h b/LibC/errno_numbers.h index 87f09a748d..fde1369071 100644 --- a/LibC/errno_numbers.h +++ b/LibC/errno_numbers.h @@ -41,6 +41,7 @@ __ERROR(ENOSYS, "No such syscall") \ __ERROR(ENOTIMPL, "Not implemented") \ __ERROR(EAFNOSUPPORT, "Address family not supported") \ + __ERROR(EWHYTHO, "Failed without setting an error code (Bug!)") \ enum __errno_values { #undef __ERROR diff --git a/LibC/stat.cpp b/LibC/stat.cpp index 9dd53da298..7ddd35314c 100644 --- a/LibC/stat.cpp +++ b/LibC/stat.cpp @@ -1,4 +1,5 @@ #include <sys/stat.h> +#include <errno.h> #include <Kernel/Syscall.h> extern "C" { @@ -8,5 +9,11 @@ mode_t umask(mode_t mask) return Syscall::invoke(Syscall::SC_umask, (dword)mask); } +int mkdir(const char* pathname, mode_t mode) +{ + int rc = Syscall::invoke(Syscall::SC_mkdir, (dword)pathname, (dword)mode); + __RETURN_WITH_ERRNO(rc, rc, -1); +} + } diff --git a/LibC/sys/stat.h b/LibC/sys/stat.h index 0cba204b11..e5fc40e5e5 100644 --- a/LibC/sys/stat.h +++ b/LibC/sys/stat.h @@ -7,5 +7,6 @@ __BEGIN_DECLS mode_t umask(mode_t); int chmod(const char* pathname, mode_t); +int mkdir(const char* pathname, mode_t); __END_DECLS |