diff options
| author | Meco Man <[email protected]> | 2021-11-28 22:30:35 -0500 |
|---|---|---|
| committer | Meco Man <[email protected]> | 2021-11-29 00:53:46 -0500 |
| commit | 7973ede5a8cacd3a7d4593ae7e76d6fb0dff8e1d (patch) | |
| tree | 523b091e5f1fc312c0c07c8fef9fc2de4e628f8f /components/libc | |
| parent | 4e9744c0acd093efd6fb1da1216d918521d14015 (diff) | |
增加RT_USING_POSIX_FS
Diffstat (limited to 'components/libc')
| -rw-r--r-- | components/libc/Kconfig | 51 | ||||
| -rw-r--r-- | components/libc/compilers/common/sys/time.h | 3 | ||||
| -rw-r--r-- | components/libc/compilers/common/time.c | 5 | ||||
| -rw-r--r-- | components/libc/posix/getline/SConscript | 6 | ||||
| -rw-r--r-- | components/libc/posix/getline/posix_getline.c | 1 | ||||
| -rw-r--r-- | components/libc/posix/src/SConscript | 14 |
6 files changed, 40 insertions, 40 deletions
diff --git a/components/libc/Kconfig b/components/libc/Kconfig index a616754904..dfbe73aa14 100644 --- a/components/libc/Kconfig +++ b/components/libc/Kconfig @@ -2,7 +2,6 @@ menu "POSIX layer and C standard library" config RT_USING_LIBC bool "Enable libc APIs from toolchain" - select RT_USING_HEAP default n if RT_USING_LIBC @@ -10,8 +9,8 @@ if RT_USING_LIBC default y config RT_LIBC_USING_FILEIO - bool "Enable libc with file operation, eg.fopen/fwrite/fread/getchar" - select RT_USING_POSIX + bool "Enable libc with file operation, eg.fopen/fwrite/fread/getchar/STDIO" + select RT_USING_POSIX_FS select RT_USING_POSIX_DEVIO default n @@ -38,50 +37,50 @@ config RT_LIBC_DEFAULT_TIMEZONE range -12 12 default 8 -config RT_USING_POSIX - bool "Enable basic POSIX layer, open()/read()/write()/close() etc" +config RT_USING_POSIX_FS + bool "Enable POSIX file system, open()/read()/write()/close() etc" select RT_USING_DFS + select DFS_USING_POSIX default n -if RT_USING_POSIX +if RT_USING_POSIX_FS config RT_USING_POSIX_DEVIO bool "Enable devices as file descriptors" - select RT_USING_DFS select RT_USING_DFS_DEVFS default n config RT_USING_POSIX_POLL bool "Enable poll()" - select RT_USING_DFS default n config RT_USING_POSIX_SELECT bool "Enable select()" - select RT_USING_DFS select RT_USING_POSIX_POLL default n +endif - config RT_USING_POSIX_DELAY - bool "Enable delay APIs, sleep()/usleep()/msleep() etc" - default n +config RT_USING_POSIX_DELAY + bool "Enable delay APIs, sleep()/usleep()/msleep() etc" + default n - config RT_USING_POSIX_GETLINE - bool "Enable getline()/getdelim()" - default n +config RT_USING_POSIX_GETLINE + bool "Enable getline()/getdelim()" + select RT_USING_LIBC + select RT_LIBC_USING_FILEIO + default n - config RT_USING_POSIX_MMAP - bool "Enable mmap()" - select RT_USING_DFS - 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_TERMIOS + bool "Enable termios APIs" + default n - config RT_USING_POSIX_AIO - bool "Enable AIO APIs" - default n -endif +config RT_USING_POSIX_AIO + bool "Enable AIO APIs" + default n config RT_USING_PTHREADS bool "Enable pthreads APIs" diff --git a/components/libc/compilers/common/sys/time.h b/components/libc/compilers/common/sys/time.h index d14905ebfb..93e3bb7ba4 100644 --- a/components/libc/compilers/common/sys/time.h +++ b/components/libc/compilers/common/sys/time.h @@ -72,7 +72,6 @@ int settimeofday(const struct timeval *tv, const struct timezone *tz); struct tm *gmtime_r(const time_t *timep, struct tm *r); #endif -#ifdef RT_USING_POSIX /* POSIX clock and timer */ #define MILLISECOND_PER_SECOND 1000UL #define MICROSECOND_PER_SECOND 1000000UL @@ -103,8 +102,8 @@ int clock_getres (clockid_t clockid, struct timespec *res); int clock_gettime (clockid_t clockid, struct timespec *tp); int clock_settime (clockid_t clockid, const struct timespec *tp); int rt_timespec_to_tick(const struct timespec *time); -#endif /* RT_USING_POSIX */ +/* timezone */ void tz_set(int8_t tz); int8_t tz_get(void); int8_t tz_is_dst(void); diff --git a/components/libc/compilers/common/time.c b/components/libc/compilers/common/time.c index 5bfff15914..73b6d76352 100644 --- a/components/libc/compilers/common/time.c +++ b/components/libc/compilers/common/time.c @@ -486,8 +486,6 @@ RTM_EXPORT(settimeofday); RTM_EXPORT(difftime); RTM_EXPORT(strftime); -#ifdef RT_USING_POSIX - #ifdef RT_USING_RTC static volatile struct timeval _timevalue; static int _rt_clock_time_system_init() @@ -690,9 +688,6 @@ int rt_timespec_to_tick(const struct timespec *time) } RTM_EXPORT(rt_timespec_to_tick); -#endif /* RT_USING_POSIX */ - - /* timezone */ #ifndef RT_LIBC_DEFAULT_TIMEZONE #define RT_LIBC_DEFAULT_TIMEZONE 8 diff --git a/components/libc/posix/getline/SConscript b/components/libc/posix/getline/SConscript index bb18dc04c5..a0077b0ce9 100644 --- a/components/libc/posix/getline/SConscript +++ b/components/libc/posix/getline/SConscript @@ -3,11 +3,9 @@ from building import * cwd = GetCurrentDir() -src = Glob('*.c') + Glob('*.cpp') +src = Glob('*.c') CPPPATH = [cwd] -group = DefineGroup('POSIX', src, - depend = ['RT_USING_LIBC', 'RT_USING_POSIX','RT_USING_POSIX_GETLINE'], - CPPPATH = CPPPATH) +group = DefineGroup('POSIX', src, depend = ['RT_USING_POSIX_GETLINE'], CPPPATH = CPPPATH) Return('group') diff --git a/components/libc/posix/getline/posix_getline.c b/components/libc/posix/getline/posix_getline.c index da80242ecc..63fa33ea42 100644 --- a/components/libc/posix/getline/posix_getline.c +++ b/components/libc/posix/getline/posix_getline.c @@ -75,4 +75,3 @@ ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream) { ssize_t getline(char **lineptr, size_t *n, FILE *stream) { return getdelim(lineptr, n, '\n', stream); } - diff --git a/components/libc/posix/src/SConscript b/components/libc/posix/src/SConscript index 067d598b74..4be5ac83cc 100644 --- a/components/libc/posix/src/SConscript +++ b/components/libc/posix/src/SConscript @@ -2,25 +2,35 @@ from building import * -src = ['unistd.c'] +src = [] cwd = GetCurrentDir() CPPPATH = [cwd] +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 -group = DefineGroup('POSIX', src, depend = ['RT_USING_POSIX'], CPPPATH = CPPPATH) +if flag == True: + group = DefineGroup('POSIX', src, depend = [], CPPPATH = CPPPATH) Return('group') |
