summaryrefslogtreecommitdiff
path: root/components/libc/compilers
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2023-06-10 21:35:25 +0800
committerGitHub <[email protected]>2023-06-10 21:35:25 +0800
commit99e80f8d3311a5222a028165f9d708870a3bb301 (patch)
treec239c7abb13ab00e455bb8670053e7bfbfc5aab8 /components/libc/compilers
parentc33a21509affaf366deee896fb1f9575fb73168f (diff)
[dfs] Add DFS v2.0 (#7606)
Diffstat (limited to 'components/libc/compilers')
-rw-r--r--components/libc/compilers/common/include/dirent.h10
-rw-r--r--components/libc/compilers/common/include/unistd.h24
-rw-r--r--components/libc/compilers/newlib/fcntl.h16
3 files changed, 44 insertions, 6 deletions
diff --git a/components/libc/compilers/common/include/dirent.h b/components/libc/compilers/common/include/dirent.h
index 55ebcd2d01..857be6388b 100644
--- a/components/libc/compilers/common/include/dirent.h
+++ b/components/libc/compilers/common/include/dirent.h
@@ -26,10 +26,14 @@ extern "C" {
#define FT_SOCKET 1 /* socket file */
#define FT_DIRECTORY 2 /* directory */
#define FT_USER 3 /* user defined */
+#define FT_DEVICE 4 /* device */
+#define FT_SYMLINK 5 /* symbol link */
#define DT_UNKNOWN 0x00
-#define DT_REG 0x01
-#define DT_DIR 0x02
+#define DT_FIFO 0x01
+#define DT_SYMLINK 0x03
+#define DT_DIR 0x04
+#define DT_REG 0x08
#ifndef HAVE_DIR_STRUCTURE
#define HAVE_DIR_STRUCTURE
@@ -61,7 +65,7 @@ DIR *opendir(const char *);
struct dirent *readdir(DIR *);
int readdir_r(DIR *, struct dirent *, struct dirent **);
void rewinddir(DIR *);
-void seekdir(DIR *, long int);
+void seekdir(DIR *, long);
long telldir(DIR *);
#ifdef __cplusplus
diff --git a/components/libc/compilers/common/include/unistd.h b/components/libc/compilers/common/include/unistd.h
index 6e63bc94d8..6a2173f7e2 100644
--- a/components/libc/compilers/common/include/unistd.h
+++ b/components/libc/compilers/common/include/unistd.h
@@ -1,10 +1,32 @@
/*
- * Copyright (c) 2006-2022, RT-Thread Development Team
+ * Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
+ * 2023/06/08 Bernard Add macro definition for `#pragma once`
*/
+#ifndef UNISTD_H__
+#define UNISTD_H__
+
#include "sys/unistd.h"
+
+#ifndef F_OK
+#define F_OK 0
+#endif
+
+#ifndef R_OK
+#define R_OK 4
+#endif
+
+#ifndef W_OK
+#define W_OK 2
+#endif
+
+#ifndef X_OK
+#define X_OK 1
+#endif
+
+#endif /* UNISTD_H__ */
diff --git a/components/libc/compilers/newlib/fcntl.h b/components/libc/compilers/newlib/fcntl.h
index 847ae3d35b..ce8b621125 100644
--- a/components/libc/compilers/newlib/fcntl.h
+++ b/components/libc/compilers/newlib/fcntl.h
@@ -13,12 +13,24 @@
#include <sys/_default_fcntl.h>
-#ifndef O_DIRECTORY
-#define O_DIRECTORY 0x200000
+#ifndef O_EXEC
+#define O_EXEC 0x400000
+#endif
+
+#ifndef O_TMPFILE
+#define O_TMPFILE 0x800000
#endif
#ifndef O_BINARY
#define O_BINARY 0x10000
#endif
+#ifndef O_NOFOLLOW
+#define O_NOFOLLOW 0x100000
+#endif
+
+#ifndef O_DIRECTORY
+#define O_DIRECTORY 0x200000
+#endif
+
#endif