feat(unistd): cwd/link/readlink/path ops

This commit is contained in:
2026-09-05 23:32:29 -04:00
parent 523045b5ae
commit 9eb32c4010
22 changed files with 2001 additions and 1 deletions
+27
View File
@@ -0,0 +1,27 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <fcntl.h>
#include <unistd.h>
#include "../internal/syscall.h"
/*
* unlink/unlinkat: remove a directory entry. unlink(path) names the
* entry directly; unlinkat resolves a relative path against the
* directory fd and, when flag is AT_REMOVEDIR, removes the empty
* directory fd/path instead of a non-directory name. Symbolic links are
* themselves removed, never followed. Return 0, or -1 with errno set.
*/
int
unlink(const char *path)
{
return syscall_ret(__syscall1(SYS_unlink, (long)path));
}
int
unlinkat(int fd, const char *path, int flag)
{
return syscall_ret(__syscall3(SYS_unlinkat, fd, (long)path, flag));
}