Commit f4191f3d authored by Zhangjin Wu's avatar Zhangjin Wu Committed by Willy Tarreau

tools/nolibc: add rmdir() support

a reverse operation of mkdir() is meaningful, add rmdir() here.

required by nolibc-test to remove /proc while CONFIG_PROC_FS is not
enabled.
Reviewed-by: default avatarThomas Weißschuh <linux@weissschuh.net>
Signed-off-by: default avatarZhangjin Wu <falcon@tinylab.org>
Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
parent f7a419e3
......@@ -611,6 +611,28 @@ int mkdir(const char *path, mode_t mode)
return __sysret(sys_mkdir(path, mode));
}
/*
* int rmdir(const char *path);
*/
static __attribute__((unused))
int sys_rmdir(const char *path)
{
#ifdef __NR_rmdir
return my_syscall1(__NR_rmdir, path);
#elif defined(__NR_unlinkat)
return my_syscall3(__NR_unlinkat, AT_FDCWD, path, AT_REMOVEDIR);
#else
return -ENOSYS;
#endif
}
static __attribute__((unused))
int rmdir(const char *path)
{
return __sysret(sys_rmdir(path));
}
/*
* int mknod(const char *path, mode_t mode, dev_t dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment