1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:07:36 +00:00

Add support for removing directories.

It's really only supported in Ext2FS since SynthFS doesn't really want you
mucking around with its files. This is pretty neat though :^)

I ran into some trouble with HashMap while working on this but opted to work
around it and leave that for a separate investigation.
This commit is contained in:
Andreas Kling 2019-01-28 04:16:01 +01:00
parent 031c62a21e
commit c95228b128
19 changed files with 185 additions and 40 deletions

View file

@ -44,6 +44,7 @@
__ERROR(EWHYTHO, "Failed without setting an error code (Bug!)") \
__ERROR(EBADWINDOW, "Bad window ID") \
__ERROR(EBADBACKING, "Bad backing store ID") \
__ERROR(ENOTEMPTY, "Directory not empty") \
enum __errno_values {

View file

@ -210,6 +210,12 @@ int unlink(const char* pathname)
__RETURN_WITH_ERRNO(rc, rc, -1);
}
int rmdir(const char* pathname)
{
int rc = syscall(SC_rmdir, pathname);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
int isatty(int fd)
{
int rc = syscall(SC_isatty, fd);

View file

@ -48,6 +48,7 @@ int ttyname_r(int fd, char* buffer, size_t);
off_t lseek(int fd, off_t, int whence);
int link(const char* oldpath, const char* newpath);
int unlink(const char* pathname);
int rmdir(const char* pathname);
int getdtablesize();
int dup(int old_fd);
int dup2(int old_fd, int new_fd);