Skip to content

Commit f616c43

Browse files
karthi012nashif
authored andcommitted
lib: posix: fs: add rmdir support
Implementation of rmdir, Posix style file system API to remove directory Signed-off-by: Karthikeyan Krishnasamy <[email protected]>
1 parent 90c6106 commit f616c43

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

include/zephyr/posix/unistd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ int rename(const char *old, const char *newp);
4444
int unlink(const char *path);
4545
int stat(const char *path, struct stat *buf);
4646
int mkdir(const char *path, mode_t mode);
47+
int rmdir(const char *path);
4748

4849
FUNC_NORETURN void _exit(int status);
4950

lib/posix/options/fs.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,3 +462,13 @@ int fstat(int fildes, struct stat *buf)
462462
#ifdef CONFIG_POSIX_FILE_SYSTEM_ALIAS_FSTAT
463463
FUNC_ALIAS(fstat, _fstat, int);
464464
#endif
465+
466+
/**
467+
* @brief Remove a directory.
468+
*
469+
* See IEEE 1003.1
470+
*/
471+
int rmdir(const char *path)
472+
{
473+
return unlink(path);
474+
}

0 commit comments

Comments
 (0)