This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
[PATCH 064/114] Add <sys/dirent.h> header for Phoenix.
- From: Jakub Sejdak <jakub dot sejdak at phoesys dot com>
- To: newlib at sourceware dot org
- Cc: Kuba Sejdak <jakub dot sejdak at phoesys dot com>
- Date: Mon, 11 Apr 2016 12:21:22 +0200
- Subject: [PATCH 064/114] Add <sys/dirent.h> header for Phoenix.
- Authentication-results: sourceware.org; auth=none
- References: <1460370132-4880-1-git-send-email-jakub dot sejdak at phoesys dot com>
From: Kuba Sejdak <jakub.sejdak@phoesys.com>
---
newlib/libc/sys/phoenix/sys/dirent.h | 68 ++++++++++++++++++++++++++++++++++++
1 file changed, 68 insertions(+)
create mode 100644 newlib/libc/sys/phoenix/sys/dirent.h
diff --git a/newlib/libc/sys/phoenix/sys/dirent.h b/newlib/libc/sys/phoenix/sys/dirent.h
new file mode 100644
index 0000000..8cd62ae
--- /dev/null
+++ b/newlib/libc/sys/phoenix/sys/dirent.h
@@ -0,0 +1,68 @@
+/* Copyright (C) 2012-2016 Phoenix Systems (http://www.phoesys.com/).
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _SYS_DIRENT_H
+#define _SYS_DIRENT_H
+
+#include <phoenix/fs.h>
+#include <sys/lock.h>
+#include <sys/types.h>
+
+#define PATH_MAX_SIZE 1024
+
+#define HAVE_DD_LOCK
+
+typedef struct {
+ int dd_fd; /* Directory file. */
+ int dd_loc; /* Position in buffer. */
+ int dd_seek;
+ char *dd_buf; /* Pointer to buffer. */
+ int dd_len; /* Buffer size. */
+ int dd_size; /* Data size in buffer. */
+ _LOCK_RECURSIVE_T dd_lock;
+} DIR;
+
+#define __dirfd(dir) (dir)->dd_fd
+
+DIR *opendir(const char *name);
+struct dirent *readdir(DIR *dirp);
+void rewinddir(DIR *dirp);
+int closedir(DIR *dirp);
+
+long telldir(DIR *dirp);
+void seekdir(DIR *dirp, off_t loc);
+int scandir(const char *__dir,
+ struct dirent ***__namelist,
+ int (*select) (const struct dirent *),
+ int (*compar) (const struct dirent **, const struct dirent **));
+int alphasort(const struct dirent **__a, const struct dirent **__b);
+
+#define _seekdir seekdir
+
+/* Declare which dirent fields are available in Phoenix-RTOS. */
+#undef _DIRENT_HAVE_D_NAMLEN
+#define _DIRENT_HAVE_D_OFF
+#define _DIRENT_HAVE_D_RECLEN
+
+#define d_fileno d_ino /* Backwards compatibility. */
+
+#ifdef __USE_LARGEFILE64
+#define dirent64 dirent
+#endif
+
+#endif
--
2.5.0