Commit Graph

19 Commits

Author SHA1 Message Date
Alin Jerpelea eb9030c891 sched: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-09-12 01:10:14 +08:00
xuxin19 b3f1871bc3 sched:fix windows sim build error
nuttx\sched\signal\sig_timedwait.c(253,13): error C2059: syntax error:'<parameter-list>'
nuttx\sched\signal\sig_timedwait.c(321,44): error C2182: '$S1': illegal use of type 'void'
nuttx\sched\signal\sig_timedwait.c(321,50): error C2059: syntax error:':'

nuttx\sched\tls\tls_initinfo.c(68,39): error C2036: 'void *': unknown size
nuttx\sched\sched\sched_get_tls.c(76,44): error C2036: 'void *': unkown size

Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-14 22:36:57 +08:00
Yanfeng Liu 1d169fe325 sched/tls: add nxsched_get_stackargs
Thread args have already been saved to stack after the TLS section by
nxtask_setup_stackargs. This is to retrieve it for use.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-06-23 22:24:19 +08:00
Roy Feng 2e98f29277 tls: fix build error under CONFIG_PTHREAD_ATFORK enabled 2024-05-28 13:54:30 +02:00
chao an d4d49e9645 stdio/file: unify group file list to common single queue
unify group file list to common single queue

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-18 19:32:49 +08:00
chao an 954bffcbd7 sched/tls: inline group info in flat mode to improve performance
inline group info in flat mode to improve the task create/destroy performance

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-01 17:27:26 +08:00
Michal Lenc 0a107ca6d9 libc: add support for custom streams with fopencookie()
This commit adds support for custom stream via fopencookie function.
The function allows the programmer the create his own custom stream
for IO operations and hook his custom functions to it.

This is a non POSIX interface defined in Standard C library and implemented
according to it. The only difference is in usage of off_t instead of
off64_t. Programmer can use 64 bits offset if CONFIG_FS_LARGEFILE is
enabled. In that case off_t is defined as int64_t (int32_t otherwise).

Field fs_fd is removed from file_struct and fs_cookie is used instead
as a shared variable for file descriptor or user defined cookie.

The interface will be useful for future fmemopen implementation.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-10-18 21:13:01 +08:00
Xiang Xiao 62c2b1abba stdio: Initialize stdin, stdout and stderr directly
and then remove group_setupstreams

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-10-17 13:34:00 +08:00
Xiang Xiao b0d197534f stdio: Move lib_stream_[initialize|release] from libc/stdio to sched/tls
both functions aren't suitable to be put into libc,
because they call the kernel internal functions directly.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-10-17 13:34:00 +08:00
guoshichao 9d7f349664 libs/pthread/pthread_atfork: fulfill implement pthread_atfork function
1. add the pthread_atfork implementation
2. the pthread_atfork implementation are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_atfork.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-07-26 10:41:52 +02:00
chao an 6ee9ec7656 build: add initial cmake build system
1. Update all CMakeLists.txt to adapt to new layout
2. Fix cmake build break
3. Update all new file license
4. Fully compatible with current compilation environment(use configure.sh or cmake as you choose)

------------------

How to test

From within nuttx/. Configure:

cmake -B build -DBOARD_CONFIG=sim/nsh -GNinja
cmake -B build -DBOARD_CONFIG=sim:nsh -GNinja
cmake -B build -DBOARD_CONFIG=sabre-6quad/smp -GNinja
cmake -B build -DBOARD_CONFIG=lm3s6965-ek/qemu-flat -GNinja

(or full path in custom board) :
cmake -B build -DBOARD_CONFIG=$PWD/boards/sim/sim/sim/configs/nsh -GNinja

This uses ninja generator (install with sudo apt install ninja-build). To build:

$ cmake --build build

menuconfig:

$ cmake --build build -t menuconfig

--------------------------

2. cmake/build: reformat the cmake style by cmake-format

https://github.com/cheshirekow/cmake_format

$ pip install cmakelang

$ for i in `find -name CMakeLists.txt`;do cmake-format $i -o $i;done
$ for i in `find -name *\.cmake`;do cmake-format $i -o $i;done

Co-authored-by: Matias N <matias@protobits.dev>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-08 13:50:48 +08:00
chao an fdc3c44cc4 sched/group: fix task info heap-use-after-free
tg_info is still in use after task_uninit_info(), unifies
lib_stream_* with life cycle of task info to avoid this issue.

| ==1940861==ERROR: AddressSanitizer: heap-use-after-free on address 0xf47032e0 at pc 0x5676dc4f bp 0xf2f38c68 sp 0xf2f38c58
|
|#10 0xf7abec89 in __asan::__asan_report_load2 (addr=4100993760) at ../../../../src/libsanitizer/asan/asan_rtl.cpp:119
|#11 0x5677356a in nxsem_destroy (sem=0xf47032e0) at semaphore/sem_destroy.c:73
|#12 0x56773695 in sem_destroy (sem=0xf47032e0) at semaphore/sem_destroy.c:120
|#13 0x5676faa2 in nxmutex_destroy (mutex=0xf47032e0) at include/nuttx/mutex.h:126
|#14 0x567a3430 in lib_stream_release (group=0xf4901ba0) at stdio/lib_libstream.c:98
|#15 0x5676da75 in group_release (group=0xf4901ba0) at group/group_leave.c:162
|#16 0x5676e51c in group_leave (tcb=0xf5377740) at group/group_leave.c:360
|#17 0x569fe79b in nxtask_exithook (tcb=0xf5377740, status=0) at task/task_exithook.c:455
|#18 0x569f90b9 in _exit (status=0) at task/exit.c:82
|#19 0x56742680 in exit (status=0) at stdlib/lib_exit.c:61
|#20 0x56a69c78 in iperf_showusage (progname=0xf2f28838 "iperf", exitcode=0) at iperf_main.c:91
|#21 0x56a6a6ec in iperf_main (argc=1, argv=0xf2f28830) at iperf_main.c:140
|#22 0x5679c148 in nxtask_startup (entrypt=0x56a69c78 <iperf_main>, argc=1, argv=0xf2f28830) at sched/task_startup.c:70
|#23 0x56767f58 in nxtask_start () at task/task_start.c:134

Signed-off-by: chao an <anchao@xiaomi.com>
2023-01-11 01:53:59 +08: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
Nathan Hartman dd718e78f7 Fix typos 2022-08-07 23:33:19 +08:00
Xiang Xiao 11c8f3125d sched/tls: Wrap up_info_size into tls_info_size
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-06-08 19:07:33 +09:00
Xiang Xiao 01c8bebf58 sched/tls: Add task_init_info and task_uninit_info
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-06-03 23:56:50 +03:00
Xiang Xiao 47b707bbf8 sched/tls: Add tls_init_info and tls_dup_info
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-06-03 23:56:50 +03:00
Gregory Nutt 24468128de TLS: Simplify 2016-03-11 07:17:32 -06:00
Gregory Nutt 934069e422 TLS: Add logic to get/set arbitrary TLS values 2016-03-10 19:31:22 -06:00