summaryrefslogtreecommitdiff
path: root/components/libc
diff options
context:
space:
mode:
Diffstat (limited to 'components/libc')
-rw-r--r--components/libc/compilers/common/sys/ioctl.h4
-rw-r--r--components/libc/posix/Kconfig34
-rw-r--r--components/libc/posix/io/SConscript30
-rw-r--r--components/libc/posix/io/aio/SConscript (renamed from components/libc/posix/aio/SConscript)2
-rw-r--r--components/libc/posix/io/aio/aio.c (renamed from components/libc/posix/aio/posix_aio.c)2
-rw-r--r--components/libc/posix/io/aio/aio.h (renamed from components/libc/posix/aio/posix_aio.h)4
-rw-r--r--components/libc/posix/io/libc.c (renamed from components/libc/posix/src/libc.c)0
-rw-r--r--components/libc/posix/io/libc.h (renamed from components/libc/posix/src/libc.h)0
-rw-r--r--components/libc/posix/io/mman/SConscript11
-rw-r--r--components/libc/posix/io/mman/mman.c (renamed from components/libc/posix/src/mmap.c)2
-rw-r--r--components/libc/posix/io/mman/sys/mman.h (renamed from components/libc/compilers/common/sys/mman.h)4
-rw-r--r--components/libc/posix/io/poll/SConscript14
-rw-r--r--components/libc/posix/io/poll/poll.c (renamed from components/libc/posix/src/poll.c)2
-rw-r--r--components/libc/posix/io/poll/poll.h (renamed from components/libc/compilers/common/poll.h)0
-rw-r--r--components/libc/posix/io/select.c (renamed from components/libc/posix/src/select.c)0
-rw-r--r--components/libc/posix/io/termios/SConscript11
-rw-r--r--components/libc/posix/io/termios/termios.c (renamed from components/libc/posix/termios/posix_termios.c)2
-rw-r--r--components/libc/posix/io/termios/termios.h (renamed from components/libc/posix/termios/posix_termios.h)4
-rw-r--r--components/libc/posix/ipc/Kconfig17
-rw-r--r--components/libc/posix/ipc/sys/ipc.h (renamed from components/libc/compilers/common/sys/termios.h)7
-rw-r--r--components/libc/posix/ipc/sys/msg.h (renamed from components/libc/compilers/common/termios.h)10
-rw-r--r--components/libc/posix/ipc/sys/sem.h15
-rw-r--r--components/libc/posix/ipc/sys/shm.h15
-rw-r--r--components/libc/posix/src/SConscript16
-rw-r--r--components/libc/posix/termios/SConscript11
25 files changed, 154 insertions, 63 deletions
diff --git a/components/libc/compilers/common/sys/ioctl.h b/components/libc/compilers/common/sys/ioctl.h
index 29ed3a8b84..a1642199b1 100644
--- a/components/libc/compilers/common/sys/ioctl.h
+++ b/components/libc/compilers/common/sys/ioctl.h
@@ -7,8 +7,8 @@
* Date Author Notes
* 2020-09-01 Meco Man First Version
*/
-#ifndef _SYS_IOCTL_H
-#define _SYS_IOCTL_H
+#ifndef __SYS_IOCTL_H__
+#define __SYS_IOCTL_H__
#include <rtconfig.h>
#include <dfs_posix.h>
diff --git a/components/libc/posix/Kconfig b/components/libc/posix/Kconfig
index 0afff161ff..4534da7118 100644
--- a/components/libc/posix/Kconfig
+++ b/components/libc/posix/Kconfig
@@ -1,7 +1,7 @@
menu "POSIX (Portable Operating System Interface) layer"
config RT_USING_POSIX_FS
- bool "Enable POSIX file system, open()/read()/write()/close() etc"
+ bool "Enable POSIX file system and I/O"
select RT_USING_DFS
select DFS_USING_POSIX
default n
@@ -13,13 +13,26 @@ if RT_USING_POSIX_FS
default n
config RT_USING_POSIX_POLL
- bool "Enable poll()"
+ bool "Enable I/O Multiplexing poll() <poll.h>"
default n
config RT_USING_POSIX_SELECT
- bool "Enable select()"
+ bool "Enable I/O Multiplexing select() <sys/select.h>"
select RT_USING_POSIX_POLL
default n
+
+ config RT_USING_POSIX_TERMIOS
+ bool "Enable Terminal I/O <termios.h>"
+ select RT_USING_POSIX_DEVIO
+ default n
+
+ config RT_USING_POSIX_AIO
+ bool "Enable Asynchronous I/O <aio.h>"
+ default n
+
+ config RT_USING_POSIX_MMAN
+ bool "Enable Memory-Mapped I/O <sys/mman.h>"
+ default n
endif
config RT_USING_POSIX_DELAY
@@ -32,19 +45,6 @@ config RT_USING_POSIX_GETLINE
select RT_LIBC_USING_FILEIO
default n
-config RT_USING_POSIX_MMAP
- bool "Enable mmap()"
- select RT_USING_POSIX_FS
- default n
-
-config RT_USING_POSIX_TERMIOS
- bool "Enable termios APIs"
- default n
-
-config RT_USING_POSIX_AIO
- bool "Enable AIO APIs"
- default n
-
config RT_USING_PTHREADS
bool "Enable pthreads APIs"
default n
@@ -55,4 +55,6 @@ if RT_USING_PTHREADS
default 8
endif
+source "$RTT_DIR/components/libc/posix/ipc/Kconfig"
+
endmenu
diff --git a/components/libc/posix/io/SConscript b/components/libc/posix/io/SConscript
new file mode 100644
index 0000000000..32654674e8
--- /dev/null
+++ b/components/libc/posix/io/SConscript
@@ -0,0 +1,30 @@
+# RT-Thread building script for component
+
+import os
+from building import *
+
+src = []
+cwd = GetCurrentDir()
+CPPPATH = [cwd]
+group = []
+
+flag = False
+
+if GetDepend('RT_USING_POSIX_DEVIO'):
+ src += ['libc.c']
+ flag = True
+
+if GetDepend('RT_USING_POSIX_SELECT'):
+ src += ['select.c']
+ flag = True
+
+if flag == True:
+ group = DefineGroup('POSIX', src, depend = [], CPPPATH = CPPPATH)
+
+list = os.listdir(cwd)
+for d in list:
+ path = os.path.join(cwd, d)
+ if os.path.isfile(os.path.join(path, 'SConscript')):
+ group = group + SConscript(os.path.join(d, 'SConscript'))
+
+Return('group')
diff --git a/components/libc/posix/aio/SConscript b/components/libc/posix/io/aio/SConscript
index 139bc45749..6d4014311c 100644
--- a/components/libc/posix/aio/SConscript
+++ b/components/libc/posix/io/aio/SConscript
@@ -3,7 +3,7 @@
from building import *
cwd = GetCurrentDir()
-src = Glob('*.c')
+src = ['aio.c']
CPPPATH = [cwd]
group = DefineGroup('POSIX', src, depend = ['RT_USING_POSIX_AIO'], CPPPATH = CPPPATH)
diff --git a/components/libc/posix/aio/posix_aio.c b/components/libc/posix/io/aio/aio.c
index 66cced8687..08ef4c634a 100644
--- a/components/libc/posix/aio/posix_aio.c
+++ b/components/libc/posix/io/aio/aio.c
@@ -11,7 +11,7 @@
#include <stdint.h>
#include <rthw.h>
#include <dfs_posix.h>
-#include "posix_aio.h"
+#include "aio.h"
struct rt_workqueue* aio_queue = NULL;
diff --git a/components/libc/posix/aio/posix_aio.h b/components/libc/posix/io/aio/aio.h
index 4e25e1d15b..35a5c194db 100644
--- a/components/libc/posix/aio/posix_aio.h
+++ b/components/libc/posix/io/aio/aio.h
@@ -8,8 +8,8 @@
* 2017/12/30 Bernard The first version.
*/
-#ifndef POSIX_AIO_H__
-#define POSIX_AIO_H__
+#ifndef __AIO_H__
+#define __AIO_H__
#include <stdio.h>
#include <sys/signal.h>
diff --git a/components/libc/posix/src/libc.c b/components/libc/posix/io/libc.c
index c324d84ef8..c324d84ef8 100644
--- a/components/libc/posix/src/libc.c
+++ b/components/libc/posix/io/libc.c
diff --git a/components/libc/posix/src/libc.h b/components/libc/posix/io/libc.h
index b019267926..b019267926 100644
--- a/components/libc/posix/src/libc.h
+++ b/components/libc/posix/io/libc.h
diff --git a/components/libc/posix/io/mman/SConscript b/components/libc/posix/io/mman/SConscript
new file mode 100644
index 0000000000..7dd096c998
--- /dev/null
+++ b/components/libc/posix/io/mman/SConscript
@@ -0,0 +1,11 @@
+# RT-Thread building script for component
+
+from building import *
+
+cwd = GetCurrentDir()
+src = ['mman.c']
+CPPPATH = [cwd]
+
+group = DefineGroup('POSIX', src, depend = ['RT_USING_POSIX_MMAN'], CPPPATH = CPPPATH)
+
+Return('group')
diff --git a/components/libc/posix/src/mmap.c b/components/libc/posix/io/mman/mman.c
index e68b82e640..827f2cbb14 100644
--- a/components/libc/posix/src/mmap.c
+++ b/components/libc/posix/io/mman/mman.c
@@ -14,7 +14,7 @@
#include <rtthread.h>
#include <dfs_posix.h>
-#include <sys/mman.h>
+#include "sys/mman.h"
void *mmap(void *addr, size_t length, int prot, int flags,
int fd, off_t offset)
diff --git a/components/libc/compilers/common/sys/mman.h b/components/libc/posix/io/mman/sys/mman.h
index 2da2ddf716..a730f33b6b 100644
--- a/components/libc/compilers/common/sys/mman.h
+++ b/components/libc/posix/io/mman/sys/mman.h
@@ -8,8 +8,8 @@
* 2017/11/30 Bernard The first version.
*/
-#ifndef _SYS_MMAN_H
-#define _SYS_MMAN_H
+#ifndef __SYS_MMAN_H__
+#define __SYS_MMAN_H__
#ifdef __cplusplus
extern "C" {
diff --git a/components/libc/posix/io/poll/SConscript b/components/libc/posix/io/poll/SConscript
new file mode 100644
index 0000000000..7d82ade035
--- /dev/null
+++ b/components/libc/posix/io/poll/SConscript
@@ -0,0 +1,14 @@
+# RT-Thread building script for component
+
+from building import *
+
+cwd = GetCurrentDir()
+src = []
+CPPPATH = [cwd]
+
+if GetDepend('RT_USING_POSIX_POLL'):
+ src += ['poll.c']
+
+group = DefineGroup('POSIX', src, depend = [], CPPPATH = CPPPATH)
+
+Return('group')
diff --git a/components/libc/posix/src/poll.c b/components/libc/posix/io/poll/poll.c
index 0c773b306c..a1500ba109 100644
--- a/components/libc/posix/src/poll.c
+++ b/components/libc/posix/io/poll/poll.c
@@ -12,7 +12,7 @@
#include <rthw.h>
#include <rtthread.h>
#include <dfs_file.h>
-#include <poll.h>
+#include "poll.h"
struct rt_poll_node;
diff --git a/components/libc/compilers/common/poll.h b/components/libc/posix/io/poll/poll.h
index aea73d6eaf..aea73d6eaf 100644
--- a/components/libc/compilers/common/poll.h
+++ b/components/libc/posix/io/poll/poll.h
diff --git a/components/libc/posix/src/select.c b/components/libc/posix/io/select.c
index 55d320e921..55d320e921 100644
--- a/components/libc/posix/src/select.c
+++ b/components/libc/posix/io/select.c
diff --git a/components/libc/posix/io/termios/SConscript b/components/libc/posix/io/termios/SConscript
new file mode 100644
index 0000000000..68bd9d81c9
--- /dev/null
+++ b/components/libc/posix/io/termios/SConscript
@@ -0,0 +1,11 @@
+# RT-Thread building script for component
+
+from building import *
+
+cwd = GetCurrentDir()
+src = ['termios.c']
+CPPPATH = [cwd]
+
+group = DefineGroup('POSIX', src, depend = ['RT_USING_POSIX_TERMIOS'], CPPPATH = CPPPATH)
+
+Return('group')
diff --git a/components/libc/posix/termios/posix_termios.c b/components/libc/posix/io/termios/termios.c
index 9f33c857e6..d7d869d67f 100644
--- a/components/libc/posix/termios/posix_termios.c
+++ b/components/libc/posix/io/termios/termios.c
@@ -11,7 +11,7 @@
#include <string.h>
#include <dfs_posix.h>
#include <sys/errno.h>
-#include <termios.h>
+#include "termios.h"
int tcgetattr(int fd, struct termios *tio)
{
diff --git a/components/libc/posix/termios/posix_termios.h b/components/libc/posix/io/termios/termios.h
index 6dc5531955..b647fa0728 100644
--- a/components/libc/posix/termios/posix_termios.h
+++ b/components/libc/posix/io/termios/termios.h
@@ -7,8 +7,8 @@
* Date Author Notes
* 2017/08/30 Bernard The first version
*/
-#ifndef TERMIOS_H__
-#define TERMIOS_H__
+#ifndef __TERMIOS_H__
+#define __TERMIOS_H__
#include <sys/types.h>
#include <sys/ioctl.h>
diff --git a/components/libc/posix/ipc/Kconfig b/components/libc/posix/ipc/Kconfig
new file mode 100644
index 0000000000..f5ec6ad040
--- /dev/null
+++ b/components/libc/posix/ipc/Kconfig
@@ -0,0 +1,17 @@
+menu "Interprocess Communication (IPC)"
+
+config RT_USING_POSIX_PIPE
+ bool "Enable pipe and FIFO"
+ select RT_USING_POSIX_FS
+ select RT_USING_POSIX_DEVIO
+ select RT_USING_POSIX_POLL
+ default n
+
+config RT_USING_POSIX_PIPE_SIZE
+ int "Set pipe buffer size"
+ depends on RT_USING_POSIX_PIPE
+ default 512
+
+comment "Socket is in the 'Network' category"
+
+endmenu
diff --git a/components/libc/compilers/common/sys/termios.h b/components/libc/posix/ipc/sys/ipc.h
index c4b42083c4..03b5458d51 100644
--- a/components/libc/compilers/common/sys/termios.h
+++ b/components/libc/posix/ipc/sys/ipc.h
@@ -5,4 +5,11 @@
*
* Change Logs:
* Date Author Notes
+ * 2021-12-07 Meco Man First version
*/
+#ifndef __SYS_IPC_H__
+#define __SYS_IPC_H__
+
+
+
+#endif
diff --git a/components/libc/compilers/common/termios.h b/components/libc/posix/ipc/sys/msg.h
index 2960d52c58..c030c9e8cb 100644
--- a/components/libc/compilers/common/termios.h
+++ b/components/libc/posix/ipc/sys/msg.h
@@ -5,15 +5,11 @@
*
* Change Logs:
* Date Author Notes
+ * 2021-12-07 Meco Man First version
*/
-#ifndef _TERMIOS_H__
-#define _TERMIOS_H__
+#ifndef __SYS_MSG_H__
+#define __SYS_MSG_H__
-#include <rtconfig.h>
-#ifdef RT_USING_POSIX_TERMIOS
-#include <sys/types.h>
-#include <posix_termios.h>
-#endif
#endif
diff --git a/components/libc/posix/ipc/sys/sem.h b/components/libc/posix/ipc/sys/sem.h
new file mode 100644
index 0000000000..b849bd687d
--- /dev/null
+++ b/components/libc/posix/ipc/sys/sem.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2021-12-07 Meco Man First version
+ */
+#ifndef __SYS_SEM_H__
+#define __SYS_SEM_H__
+
+
+
+#endif
diff --git a/components/libc/posix/ipc/sys/shm.h b/components/libc/posix/ipc/sys/shm.h
new file mode 100644
index 0000000000..762d68891a
--- /dev/null
+++ b/components/libc/posix/ipc/sys/shm.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2006-2021, RT-Thread Development Team
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Change Logs:
+ * Date Author Notes
+ * 2021-12-07 Meco Man First version
+ */
+#ifndef __SYS_SHM_H__
+#define __SYS_SHM_H__
+
+
+
+#endif
diff --git a/components/libc/posix/src/SConscript b/components/libc/posix/src/SConscript
index 4be5ac83cc..87be6b6a06 100644
--- a/components/libc/posix/src/SConscript
+++ b/components/libc/posix/src/SConscript
@@ -10,26 +10,10 @@ group = []
flag = False
src += ['unistd.c'] #TODO
-if GetDepend('RT_USING_POSIX_DEVIO'):
- src += ['libc.c']
- flag = True
-
if GetDepend('RT_USING_POSIX_DELAY'):
src += ['delay.c']
flag = True
-if GetDepend('RT_USING_POSIX_POLL'):
- src += ['poll.c']
- flag = True
-
-if GetDepend('RT_USING_POSIX_SELECT'):
- src += ['select.c']
- flag = True
-
-if GetDepend('RT_USING_POSIX_MMAP'):
- src += ['mmap.c']
- flag = True
-
if flag == True:
group = DefineGroup('POSIX', src, depend = [], CPPPATH = CPPPATH)
diff --git a/components/libc/posix/termios/SConscript b/components/libc/posix/termios/SConscript
deleted file mode 100644
index 3615926251..0000000000
--- a/components/libc/posix/termios/SConscript
+++ /dev/null
@@ -1,11 +0,0 @@
-# RT-Thread building script for component
-
-from building import *
-
-cwd = GetCurrentDir()
-src = Glob('*.c') + Glob('*.cpp')
-CPPPATH = [cwd]
-
-group = DefineGroup('POSIX', src, depend = ['RT_USING_LIBC', 'RT_USING_POSIX_TERMIOS'], CPPPATH = CPPPATH)
-
-Return('group')