Commit Graph

1208 Commits

Author SHA1 Message Date
anjiahao 634bdeaa5c pthread_barrier:don't destory when barrier used
this is fix a ltp test case and update
the error code of pthread_barrierdestroy

ltptcase is : apps/testing/ltp/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_barrier_destroy/2-1.c
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-11-11 08:56:48 +08:00
ligd a9c647d418 semaphore: move param check to sem_xx level
for the speed improve

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-11-10 22:36:21 +08:00
Xiang Xiao 36abcda0d2 lib/netdb: Rename dns_sem[take|give] with dns_[lock|unlock]
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-09 21:38:10 +01:00
Xiang Xiao 898093a822 libc/stdio: Remove the one line mutex wrapper
and call nxmutex api directly

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-09 21:38:10 +01:00
chao an 80a2d058b8 lib/atexit: correct return value of exitfunc lock
Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-07 18:14:30 +08:00
yinshengkai 85f727f232 tools: replace INCDIR to Makefile variable
In the past, header file paths were generated by the incdir command
Now they are generated by concatenating environment variables

In this way, when executing makefile, no shell command will be executed,
it will improve the speed of executing makfile
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-11-03 19:59:55 +08:00
yinshengkai 95d9abcf58 tools: replace DEFINE script to Makefile variable
In the past, predefined macros were generated by define.sh scripts
Now they are generated by concatenating environment variables

In this way, when executing makefile, no shell command will be executed,
it will improve the speed of executing makfile

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-11-03 19:59:55 +08:00
Xiang Xiao 9e72fe9fab libc/spawn: Always build lib_psa_[get|set]stacksize.c
instead of lib_psa_[get|set]stackaddr.c since the later doesn't exist in kernel mode
regression by:
commit b9b032af72
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
Date:   Thu Oct 20 03:10:23 2022 +0800

    sched/spawn: Support task_spawnattr_[set|get]stacksize in kernel mode

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-01 21:03:52 +01:00
Xiang Xiao 28947517ca sched/spawn: Rename task_spawnattr_[get|set]stack[size|addr] to posix_spawnattr_[get|set]stack[size|addr]
since they can be not only used in task_spawn but also in posix_spawn

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-01 09:51:18 +09:00
chao an 1550747400 sched/getprioritymax: handle invaild policy as posix style
modify the return value according to posix standard
------------
SCHED_GET_PRIORITY_MAX(2)

NAME
       sched_get_priority_max, sched_get_priority_min  - get static priority range

RETURN VALUE
       On success, sched_get_priority_max() and sched_get_priority_min() return the
                   maximum/minimum priority value for the named scheduling policy.
       On error, -1 is returned, and errno is set appropriately.

ERRORS
       EINVAL The argument policy does not identify a defined scheduling policy.

Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-01 03:33:58 +08:00
Xiang Xiao 3e3364d1a9 Fix the format string mismatch warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-31 11:20:56 +01:00
Xiang Xiao 64e7833cbc sched/spawn: Support task_spawnattr_[set|get]stackaddr
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-31 12:46:58 +09:00
Xiang Xiao b9b032af72 sched/spawn: Support task_spawnattr_[set|get]stacksize in kernel mode
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: chao an <anchao@xiaomi.com>
2022-10-31 12:46:58 +09:00
Xiang Xiao f8d97aea9e libnx: Remove the unnecessary invocation of _SEM_SETPROTOCOL
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-29 21:12:40 +02:00
Petro Karashchenko 6908b6823c libs/libc/time: fix regression in clock_calendar2utc
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-10-28 10:21:05 +08:00
Xiang Xiao 19bded4738 fs: Remove the unused nx_pipe to prefer file_pipe for kernel
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-27 23:14:25 +02:00
Minh Nguyen 153060d34d Update errno to match asm-generic
Modify some comment.
2022-10-28 02:19:26 +08:00
Petro Karashchenko fdff92fd19 libs/libc/time: mktime normalize struct tm
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-10-27 21:22:08 +08:00
Karel Kočí 61b1791584 libs/libc: add obstack 2022-10-26 09:11:52 +08:00
Xavier Del Campo 8684814e09 strftime: Add support for the %T specifier 2022-10-26 00:54:59 +08:00
Xavier Del Campo 097faac22f strftime: Add support for the %R specifier 2022-10-26 00:54:59 +08:00
Miguel Herranz 819ebe7356 libc/stdio: Add stdio file locking functions
Add flockfile(), ftrylockfile() and funlockfile() functions [1].

[1] POSIX.1-2008 / System Interfaces / flockfile
    https://pubs.opengroup.org/onlinepubs/9699919799.2008edition/functions/flockfile.html

Signed-off-by: Miguel Herranz <miguel@midokura.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-22 23:34:45 +08:00
anjiahao 577e550698 libc/semaphore:sem_init change defult protocol
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-10-22 14:50:48 +08:00
YAMAMOTO Takashi f100a4bb92 Implement fdopendir 2022-10-19 21:20:35 +08:00
Fotis Panagiotopoulos ec93385dfa strftime: Added support for the %w format specifier. 2022-10-19 12:43:28 +08:00
Fotis Panagiotopoulos f9fd53cda1 gmtimer: Fixed range of tm_yday. 2022-10-19 12:39:04 +08:00
dongjiuzhu1 55106685fa libc/localtime: Update to consistent with mainline
https://github.com/eggert/tz

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-10-19 10:27:52 +08:00
dongjiuzhu1 7b2371f0ed libc/localtime: fix timegm return error when tz with isdst
testcase:
set TZ CEST
time_t t = time(NULL);
struct tm *ts = localtime(&t);
t = timegm(ts);
t will return (time_t)-1;

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-10-19 10:27:52 +08:00
Jiuzhu Dong 1b9ed5725b libc/time: Return failed when lock is already held to avoid deadlock
when enable LIBC_LOCALTIME and SYSLOG_TIMESTAMP_LOCALTIME
and zoneinfo/posixrulesi isn't exist

[ EMERG] [ap] backtrace:
[ EMERG] [ap] [20] [<0xc1cc3c4>] arm_switchcontext+0xc/0x10
[ EMERG] [ap] [20] [<0xc1ac67a>] sem_wait+0x5a/0xc0
[ EMERG] [ap] [20] [<0xc1c4588>] tzset.part.0+0x8/0x160
[ EMERG] [ap] [20] [<0xc1c58de>] localtime_r+0xc6/0x114
[ EMERG] [ap] [20] [<0xc1a910a>] clock_gettime+0x16/0xa8
[ EMERG] [ap] [20] [<0xc1b7622>] nx_vsyslog+0x9e/0xc0
[ EMERG] [ap] [20] [<0xc4ba7e0>] romfs_stat+0xa4/0xf4
[ EMERG] [ap] [20] [<0xc4b47bc>] inode_semtake+0x24/0x5c
[ EMERG] [ap] [20] [<0xc1c0102>] bsearch+0x26/0x6c
[ EMERG] [ap] [20] [<0xc1c265a>] vsyslog+0x16/0x24
[ EMERG] [ap] [20] [<0xc1c2676>] syslog+0xe/0x1c
[ EMERG] [ap] [20] [<0xc4bae12>] romfs_open+0xee/0x178  <--- err log
[ EMERG] [ap] [20] [<0xc4b68ae>] file_vopen+0x116/0x144
[ EMERG] [ap] [20] [<0xc4b6ac8>] open+0x20/0x60
[ EMERG] [ap] [20] [<0xc1c3df4>] tzload+0x84/0x810
[ EMERG] [ap] [20] [<0xc1c6ef4>] mm_zalloc+0x10/0x18
[ EMERG] [ap] [20] [<0xc4bb426>] romfs_checkmount+0x22/0x58
[ EMERG] [ap] [20] [<0xc4bad74>] romfs_open+0x50/0x178
[ EMERG] [ap] [20] [<0xc1c392c>] tzparse+0x2c/0x470
[ EMERG] [ap] [20] [<0xc1ac5da>] nxsem_wait_uninterruptible+0x8a/0xd0
[ EMERG] [ap] [20] [<0xc1ac690>] sem_wait+0x70/0xc0
[ EMERG] [ap] [20] [<0xc4b47bc>] inode_semtake+0x24/0x5c
[ EMERG] [ap] [20] [<0xc4b481c>] inode_semgive+0x28/0x58
[ EMERG] [ap] [20] [<0xc4b58b4>] file_close+0x18/0x44
[ EMERG] [ap] [20] [<0xc4b4690>] close+0x80/0xb4
[ EMERG] [ap] [20] [<0xc1c43f4>] tzload+0x684/0x810
[ EMERG] [ap] [20] [<0xc1c4616>] tzset.part.0+0x96/0x160
[ EMERG] [ap] [20] [<0xc1c58de>] localtime_r+0xc6/0x114
[ EMERG] [ap] [20] [<0xc1a910a>] clock_gettime+0x16/0xa8
[ EMERG] [ap] [20] [<0xc1ea692>] cmd_date+0x276/0x37c

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-10-19 10:27:52 +08:00
wangbowen6 8b84d19771 lib_localtime: gmtime_r should get right time in OS init process
Enable CONFIG_LIBC_LOCALTIME,CONFIG_RTC and CONFIG_SCHED_TICKLESS
In os clock init process, clock_initialize() --> ... -->
sim_rtc_rdtime() --> gmtime_r() --> gmtsub() --> return NULL
get the error rtctime.

Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-10-19 10:27:52 +08:00
Jiuzhu Dong 0bff62e3e8 libc/time: don't take semaphore in idle task
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-10-19 10:27:52 +08:00
Fotis Panagiotopoulos ca9aeeec1f freopen: Added flush of the read buffers. 2022-10-18 23:29:55 +08:00
Fotis Panagiotopoulos 10d6de46e6 libfread: Fixed error flag when reading a write-only file. 2022-10-18 21:29:14 +08:00
Xiang Xiao 6b31918b42 Remove the unnecessary cast for main_t, NULL and argv
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-18 08:51:45 +02:00
anjiahao d1d46335df Replace nxsem API when used as a lock with nxmutex API
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-17 15:59:46 +09:00
Petro Karashchenko ec4a615f6c libs/libc/stdio: fix ungetc operation
Do not modify errno in case of failure
Return EOF if the value of c equals to EOF

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-10-14 23:29:38 +08:00
chao an 36039c8526 newlib/impure: declare thread specific file only if __NEWLIB__ is defined.
Signed-off-by: chao an <anchao@xiaomi.com>
2022-10-12 17:22:24 +08:00
chao an 83a3fd9780 newlib/impure: sync with newlib(4.2.0) reent update
arm-none-eabi-ld: nuttx/staging/libc.a(lib_impure.o):(.data.impure_data+0x4): undefined reference to `__sf'
arm-none-eabi-ld: nuttx/staging/libc.a(lib_impure.o):(.data.impure_data+0x8): undefined reference to `__sf'
arm-none-eabi-ld: nuttx/staging/libc.a(lib_impure.o):(.data.impure_data+0xc): undefined reference to `__sf'

Toolchain:
  Version: GNU Arm Embedded Toolchain to Version 11.3.Rel1(August 8, 2022)
  Tar:     arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-eabi.tar.xz

Break change:
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=b0cb9f85ca3626e0e68fd451c3090d253ceb4300

Signed-off-by: chao an <anchao@xiaomi.com>
2022-10-11 18:38:14 +08:00
Xiang Xiao 8c80b3d908 sched: Guard backtrace related code correctly
1.Don't include unwind.h when arch specific backtrace is enable
2.Built arch specific backtrace wrapper only when enable

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-11 00:01:35 +02:00
raiden00pl 00aa822546 libs/libc/netdb/Kconfig: allow to enable LIBC_NETDB directly from menuconfig 2022-10-02 22:29:41 +08:00
Xiang Xiao e38248ee08 Return -EINVAL for the internal API
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-30 17:54:56 +02:00
Xiang Xiao bdeaea3742 Remove the unnessary empty line after label
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-30 17:54:56 +02:00
zhangyuan21 838309313e sched: semaphore wait list optimize 2022-09-28 18:08:37 +08:00
Xiang Xiao 40ef5bc6db libc: Move queue.h from include to include/nuttx
to avoid the conflict with libuv's queue.h

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-26 08:04:58 +02:00
chao an 09c006b9c8 libs: fix visual studio Compiler Error C2124
D:\code\incubator-nuttx\libs\libc\stdlib\lib_strtod.c: error C2124: divide or mod by zero

Windows MSVC restrictions, MSVC doesn't allow division through a
zero literal, but allows it through non-const variable set to zero

Reference:
https://docs.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2124?view=msvc-170

Signed-off-by: chao an <anchao@xiaomi.com>
2022-09-26 04:40:09 +08:00
Xiang Xiao 70290b6e38 arch: Change the linker generated symbols from uint32_t to uint8_t *
and remove the duplicated declaration

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-24 21:26:56 +02:00
chao an a3a4e89efc libs/libc/arm: use builtin routines instead of aliases of __aeabi_mem*
Signed-off-by: chao an <anchao@xiaomi.com>
2022-09-24 00:10:36 +08:00
Xiang Xiao 8565882bb5 libc/stdio: Let STDIO_DISABLE_BUFFERING depends on FILE_STREAM
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-22 17:41:05 +02:00
Xiang Xiao bdcd232c98 libc/netdb: Let LIBC_GAISTRERROR/NETDB_BUFSIZE/NETDB_MAX_IPADDR depends on LIBC_NETDB
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-22 17:41:05 +02:00
Xiang Xiao 4c44c6f709 arch.h: Make _sinit/_einit as an offical interface
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-22 08:29:24 +08:00