summaryrefslogtreecommitdiff
path: root/src/dirent/closedir.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dirent/closedir.c')
-rw-r--r--src/dirent/closedir.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/dirent/closedir.c b/src/dirent/closedir.c
new file mode 100644
index 00000000..daa72d50
--- /dev/null
+++ b/src/dirent/closedir.c
@@ -0,0 +1,20 @@
+#include <dirent.h>
+#include "nonstd/assert.h"
+#include "nonstd/types.h"
+#include "nonstd/syscall.h"
+
+int closedir(DIR *dirp)
+{
+ ASSERT_NONNULL(dirp);
+ SCNO(scno, "closedir", -1);
+
+ int r = __libc.syscall(scno, dirp);
+ if (r < 0) {
+ errno = -r;
+ return -1;
+ }
+ return 0;
+}
+/*
+POSIX(1)
+*/