summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/src/readdir_r.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2002-09-14 17:04:05 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2002-09-14 17:04:05 +0000
commit193fe690070bb040b36bf7d2639b454d88c37d3f (patch)
tree26c894c8f3799b2ceb91ac83a0d550bb8ed06932 /cpukit/libcsupport/src/readdir_r.c
parent2002-09-13 Eric Norum <eric.norum@usask.ca> (diff)
downloadrtems-193fe690070bb040b36bf7d2639b454d88c37d3f.tar.bz2
2002-09-14 Eric Norum <eric.norum@usask.ca>
* src/readdir_r.c: New file. * Makefile.am: Reflect above.
Diffstat (limited to 'cpukit/libcsupport/src/readdir_r.c')
-rw-r--r--cpukit/libcsupport/src/readdir_r.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/cpukit/libcsupport/src/readdir_r.c b/cpukit/libcsupport/src/readdir_r.c
new file mode 100644
index 0000000000..9ddb84f97c
--- /dev/null
+++ b/cpukit/libcsupport/src/readdir_r.c
@@ -0,0 +1,22 @@
+/*
+ * readdir_r - reentrant version of readdir()
+ *
+ * $Id$
+ */
+
+#include <sys/types.h>
+#include <dirent.h>
+#include <errno.h>
+#include <stdio.h>
+
+/*
+ * The RTEMS version of readdir is already thread-safe.
+ */
+
+int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)
+{
+ *result = readdir(dirp);
+ if (*result)
+ *entry = **result;
+ return *result ? 0 : errno;
+}