summaryrefslogtreecommitdiff
path: root/src/dirent
diff options
context:
space:
mode:
Diffstat (limited to 'src/dirent')
-rw-r--r--src/dirent/DIR.h5
-rw-r--r--src/dirent/_dirent.h21
-rw-r--r--src/dirent/closedir.c25
-rw-r--r--src/dirent/opendir.c33
-rw-r--r--src/dirent/readdir.c50
-rw-r--r--src/dirent/rewinddir.c18
-rw-r--r--src/dirent/seekdir.c18
-rw-r--r--src/dirent/struct_dirent.h14
-rw-r--r--src/dirent/telldir.c18
9 files changed, 0 insertions, 202 deletions
diff --git a/src/dirent/DIR.h b/src/dirent/DIR.h
deleted file mode 100644
index cc43a5d8..00000000
--- a/src/dirent/DIR.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <dirent.h>
-typedef struct __DIR DIR;
-/*
-POSIX(1)
-*/
diff --git a/src/dirent/_dirent.h b/src/dirent/_dirent.h
deleted file mode 100644
index 8b144316..00000000
--- a/src/dirent/_dirent.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef ___DIRENT_H__
-#define ___DIRENT_H__
-
-#ifndef O_DIRECTORY
-#define O_DIRECTORY O_RDONLY
-#endif
-
-#ifndef O_SEARCH
-#define O_SEARCH O_RDONLY
-#endif
-
-#ifndef NAME_MAX
-#define NAME_MAX _POSIX_NAME_MAX
-#endif
-
-struct __DIR {
- int fd;
- struct dirent de;
-};
-
-#endif
diff --git a/src/dirent/closedir.c b/src/dirent/closedir.c
deleted file mode 100644
index c59fb783..00000000
--- a/src/dirent/closedir.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#if 0
-
-#include <dirent.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include "_assert.h"
-#include "_dirent.h"
-
-int closedir(DIR *dirp)
-{
- int ret = -1;
- ASSERT_NONNULL(dirp);
- ret = close(dirp->fd);
- if (ret != -1) {
- free(dirp);
- }
- return ret;
-}
-/*
-POSIX(1)
-*/
-
-
-#endif
diff --git a/src/dirent/opendir.c b/src/dirent/opendir.c
deleted file mode 100644
index e2507e54..00000000
--- a/src/dirent/opendir.c
+++ /dev/null
@@ -1,33 +0,0 @@
-#if 0
-
-#include <dirent.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include "_dirent.h"
-
-DIR * opendir(const char * dirname)
-{
- DIR *dir = malloc(sizeof(*dir));
- if (dir == NULL) {
- errno = ENOMEM;
- return NULL;
- }
-
- dir->fd = open(dirname, O_DIRECTORY | O_SEARCH);
- if (dir->fd == -1) {
- free(dir);
- return NULL;
- }
- fcntl(dir->fd, F_SETFD, FD_CLOEXEC);
-
- return dir;
-}
-
-/*
-POSIX(1)
-*/
-
-
-#endif
diff --git a/src/dirent/readdir.c b/src/dirent/readdir.c
deleted file mode 100644
index 9776691f..00000000
--- a/src/dirent/readdir.c
+++ /dev/null
@@ -1,50 +0,0 @@
-#if 0
-
-#include <dirent.h>
-#include <limits.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <string.h>
-#include <unistd.h>
-#include "_dirent.h"
-#include "_syscall.h"
-
-/** read a directory **/
-
-struct dirent * readdir(DIR * dirp)
-{
- if (read(dirp->fd, dirp, sizeof(*dirp)) == -1) {
- if (errno == EISDIR) {
- #ifdef __linux__
- struct {
- long inode;
- off_t offset;
- unsigned short reclen;
- char name[NAME_MAX + 1];
- } linux = { 0, 0, 0, "" };
- long ret = __scall3(getdents, dirp->fd, &linux, sizeof(linux));
- if (ret < 0) {
- errno = -ret;
- return NULL;
- }
-
- #ifdef _XOPEN_SOURCE
- dirp->de.d_ino = linux.inode;
- #endif
-
- strcpy(dirp->de.d_name, linux.name);
- return &dirp->de;
- #endif
- }
- return NULL;
- }
-
- return &dirp->de;
-}
-
-/*
-POSIX(1)
-*/
-
-
-#endif
diff --git a/src/dirent/rewinddir.c b/src/dirent/rewinddir.c
deleted file mode 100644
index e878f598..00000000
--- a/src/dirent/rewinddir.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#if 0
-
-#include <dirent.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include "_dirent.h"
-
-void rewinddir(DIR * dirp)
-{
- lseek(dirp->fd, 0, SEEK_SET);
-}
-
-/*
-POSIX(1)
-*/
-
-
-#endif
diff --git a/src/dirent/seekdir.c b/src/dirent/seekdir.c
deleted file mode 100644
index c93ecd0a..00000000
--- a/src/dirent/seekdir.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#if 0
-
-#include <sys/types.h>
-#include <dirent.h>
-#include <unistd.h>
-#include "_dirent.h"
-
-void seekdir(DIR * dirp, long loc)
-{
- lseek(dirp->fd, loc, SEEK_SET);
-}
-
-/*
-XOPEN(4)
-*/
-
-
-#endif
diff --git a/src/dirent/struct_dirent.h b/src/dirent/struct_dirent.h
deleted file mode 100644
index a6d4bb6c..00000000
--- a/src/dirent/struct_dirent.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <dirent.h>
-
-struct dirent {
- #if (defined _XOPEN_SOURCE)
- ino_t d_ino;
- #else
- unsigned long long int __padding;
- #endif
- char d_name[];
-};
-
-/*
-POSIX(1)
-*/
diff --git a/src/dirent/telldir.c b/src/dirent/telldir.c
deleted file mode 100644
index 24efd6c5..00000000
--- a/src/dirent/telldir.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#if 0
-
-#include <sys/types.h>
-#include <dirent.h>
-#include <unistd.h>
-#include "_dirent.h"
-
-long telldir(DIR * dirp)
-{
- return lseek(dirp->fd, 0, SEEK_CUR);
-}
-
-/*
-XOPEN(4)
-*/
-
-
-#endif