summaryrefslogtreecommitdiffstats
path: root/libc-bottom-half/cloudlibc/src/libc/dirent/rewinddir.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc-bottom-half/cloudlibc/src/libc/dirent/rewinddir.c')
-rw-r--r--libc-bottom-half/cloudlibc/src/libc/dirent/rewinddir.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libc-bottom-half/cloudlibc/src/libc/dirent/rewinddir.c b/libc-bottom-half/cloudlibc/src/libc/dirent/rewinddir.c
new file mode 100644
index 0000000..8dd5882
--- /dev/null
+++ b/libc-bottom-half/cloudlibc/src/libc/dirent/rewinddir.c
@@ -0,0 +1,15 @@
+// Copyright (c) 2015-2016 Nuxi, https://nuxi.nl/
+//
+// SPDX-License-Identifier: BSD-2-Clause
+
+#include <wasi/api.h>
+#include <dirent.h>
+
+#include "dirent_impl.h"
+
+void rewinddir(DIR *dirp) {
+ // Update cookie.
+ dirp->cookie = __WASI_DIRCOOKIE_START;
+ // Mark entire buffer as processed to force a read of new data.
+ dirp->buffer_used = dirp->buffer_processed = dirp->buffer_size;
+}