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
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
yinshengkai
2c95c04f4e
sched: catch task memory leak
...
Print all unreleased memory blocks when the task exits
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-10-29 11:35:27 +08:00
anjiahao
e1ca516488
use SEM_INITIALIZER inside of NXSEM_INITIALIZER
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-10-22 14:50:48 +08:00
chao an
205c8934a3
sched/msgq: add support of System V message queue
...
https://man.openbsd.org/msgget.2
Signed-off-by: chao an <anchao@xiaomi.com>
2022-10-22 12:58:11 +08:00
Xiang Xiao
9ccddde6a9
sched/spawn: Launch nxposix_spawn_proxy through nxthread_create
...
to ensure the caller environment variable always get copied
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-19 08:22:56 +09:00
Xiang Xiao
e2a18ad339
sched: Support envp argument of task_spawn and nxtask_create
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-19 08:22:56 +09: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
d247e8d1d2
sched/semaphore: fix priority boost restoration for priority inheritance
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-10-03 15:14:24 -03: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
Xiang Xiao
2a981cec95
sched: Remove the unnecessary "FAR dq_queue_t *" cast
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-08-31 08:50:57 +09:00
Huang Qi
e4e3208180
Replace all strncpy with strlcpy for safety
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-08-25 13:38:36 +08:00
Huang Qi
1ba443aab2
prctl: Replace strncpy with strlcpy for safety
...
strlcpy ensure the destination is NUL-terminated, and also fix warning:
```c
task/task_prctl.c:138:15: warning: 'strncpy' output may be truncated copying 30 bytes from a string of length 31 [-Wstringop-truncation]
138 | strncpy(name, tcb->name, CONFIG_TASK_NAME_SIZE - 1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-08-24 01:54:53 +08:00
chao.an
7032739efe
sched/Makefile: move task_reparent.c to appropriate Makefile
...
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-07-27 23:22:37 +08:00
ligd
db08f3a723
sched: handle nxtask_setup_arguments return values
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-22 10:54:07 +08:00
Nathan Hartman
1867bc2210
Fix compiler warnings (-Wunused-parameter) in various functions
...
Fixes the -Wunused-parameter warning in:
* group/group_signal.c: group_signal()
* irq/irq_unexpectedisr.c: irq_unexpected_isr()
* task/task_spawn.c: nxtask_spawn_proxy()
* timer/timer_getoverrun.c: timer_getoverrun()
* misc/dev_null.c: devnull_read(), devnull_write(), devnull_poll()
* misc/dev_zero.c: devzero_read(), devzero_write(), devzero_poll()
* syslog/syslog_channel.c: syslog_default_write()
* syslog/syslog_device.c: syslog_dev_flush()
* grp/lib_initgroups.c: initgroups()
* misc/lib_mknod.c: mknod()
* misc/lib_glob.c: ignore_err()
* pthread/pthread_barrierinit.c: pthread_barrier_init()
* pthread/pthread_atfork.c: pthread_atfork()
* semaphore/sem_init.c: nxsem_init()
* stream/lib_nullinstream.c: nullinstream_getc()
* stream/lib_nulloutstream.c: nulloutstream_putc()
* stream/lib_libnoflush.c: lib_noflush()
* stream/lib_libsnoflush.c: lib_snoflush()
* string/lib_strerror.c: strerror()
* time/lib_gettimeofday.c: gettimeofday()
* time/lib_settimeofday.c: settimeofday()
* unistd/lib_pathconf.c: fpathconf(), pathconf()
* unistd/lib_getrusage.c: getrusage()
* unistd/lib_setrlimit.c: setrlimit()
* unistd/lib_getrlimit.c: getrlimit()
* unistd/lib_setpriority.c: setpriority()
2022-07-12 11:42:34 +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
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
Xiang Xiao
3e32b605fe
libc/tls: Make tls_get_info as the pulibc function instead up_tls_info
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-06-03 23:56:50 +03:00
Xiang Xiao
33a6aa2f48
sched/tls: Don't compensate the tls size to the stack size
...
it isn't good to change the stack size passed by caller
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-06-03 23:56:50 +03:00
Xiang Xiao
3b136771ff
sched: Move the call of pthread_mutex_inconsistent to nxtask_recover
...
to avoid it spread around all possible exit path
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-27 09:39:09 +03:00
Ville Juven
a54c3d13f9
sched: Remove SCHED_ATEXIT / SCHED_ONEXIT
...
Remove the kernel side implementations altogether. These will be
replaced by user land implementations.
2022-05-25 15:28:43 +08:00
Ville Juven
622677d4a1
libc: Implement exit, atexit, on_exit and cxa_exit on the user side
...
For CONFIG_BUILD_KERNEL using the sched/task/task_exithook implementation
will just not work. It calls user code with kernel privileges which is
a bit of a security issue.
2022-05-25 15:28:43 +08:00
Ville Juven
5bcd1dbb64
sched: Remove task_restart in case of CONFIG_BUILD_KERNEL
...
Same treatment as task_delete, this is not usable in kernel build
either.
2022-05-12 22:08:19 +08:00
Ville Juven
b1d92159fa
sched: Remove task_delete in case of CONFIG_BUILD_KERNEL
...
Deleting a task from another task's context will not do, so shut
this gate down for BUILD_KERNEL. In this case if a task wants another
task to terminate, it must ask the other task to politely kill itself.
Note: kthreads still need this, also, the kernel can delete a task
without asking.
2022-05-12 03:27:25 +08:00
Petro Karashchenko
1b4d8b3734
sched: remove DEBUGASSERT from nx_waitpid
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-04-22 15:06:26 -03:00
Xiang Xiao
55b5561fdb
sched/task: Implement execle and execve
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-22 10:40:31 +03:00
Xiang Xiao
76803f4a07
sched/environ: Replace get_environ_ptr with environ
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-21 22:55:47 +03:00
Xiang Xiao
ce49c80976
sched/task: Correct the comment about environment variable
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-21 22:55:47 +03:00
Ville Juven
4c1b66246d
env_dup: Fix copying of env between address environments
...
If address environments are in use, it is not possible to simply
memcpy from from one process to another. The current implementation
of env_dup does precisely this and thus, it fails at once when it is
attempted between two user processes.
The solution is to use the kernel's heap as an intermediate buffer.
This is a simple, effective and common way to do a fork().
Obviously this is not needed for kernel processes.
2022-04-21 18:38:37 +08:00
ligd
e9f17947b7
task: don't set default signal in kernal thread
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-03-30 10:53:14 +09:00
Petro Karashchenko
68902d8732
pid_t: unify usage of special task IDs
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-03-22 21:22:32 +08:00
Petro Karashchenko
6472a698b6
style/typo: fix few style and typo issues
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-03-18 17:05:10 +01:00
Xiang Xiao
a50d87d5b7
sched/group: Simplify the allocation and deallocation logic
...
1.Move tg_membe allocation to group_alloc
2.Merge group_deallocate to group_release
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-03-04 12:11:24 +09:00
Huang Qi
e516c6247e
sched: Implement task local storage
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-02-23 22:05:02 +08:00
Huang Qi
c0a0de97ce
Revert "libc: Call pthread_exit in user-space by up_pthread_exit"
...
This reverts commit f4a0b7aedd
.
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-02-09 21:21:43 +08:00
Huang Qi
6814b1416f
Revert "pthread: Avoid recursive pthread_exit call"
...
This reverts commit a2941532bd
.
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-02-09 21:21:43 +08:00
Xiang Xiao
0000e61da6
task: Always implement posix_spawnp as macro
...
Since there is no benefit to implement it as
function when CONFIG_LIBC_ENVPATH equals y
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-09 20:09:11 +08:00
Xiang Xiao
d48946063a
Revert "sched: Don't duplicate caller file handler when creating kernel thread"
...
This reverts commit 512676cb06
.
2022-02-01 08:22:45 +09:00
Xiang Xiao
512676cb06
sched: Don't duplicate caller file handler when creating kernel thread
...
kernel thread should have only the starndard file i/o just like idle thread
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-01-31 14:44:29 +01:00
Petro Karashchenko
c0881feca9
boards/arm/samv7/same70-qmtech: fix description in README.txt
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-01-23 20:08:10 -03:00
Xiang Xiao
1af8cd4de8
sched: Move argv from tcb_s to task_info_s
...
argv is allocated from stack and then belong to userspace,
so task_info_s is a best location to hold this information.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-11 10:08:53 -06:00
Huang Qi
58e0781e2e
arch/arm: Implement TLS support
...
Signed-off-by: Huang Qi <no1wudi@qq.com>
2021-12-07 23:31:41 -06:00
Xiang Xiao
b1879d5d24
sched/vfork: allocate tls_info_s instead task_info_s from stack
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-11-01 20:53:07 -03:00
Xiang Xiao
8b67944c75
sched: Remove pidhash_s and move ticks to tcb_s
...
simplify the code logic and reduce memory a little bit
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-10-16 06:19:17 -03:00
Jiuzhu Dong
35b3898ce1
task_spawn: release g_spawn_parmsem and sched_unlock at the ending
...
Change-Id: Ifcb5b9921e82fc495c4457fdb5f0607f40b07fc0
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-08-19 20:43:54 -07:00
Xiang Xiao
5025fbef8d
Rename LIB_ to LIBC_ for all libc Kconfig
...
follow other libc component naming convention
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-08-05 19:45:24 +02:00
SPRESENSE
5db4d2a83b
sched/task: Fix wrong return value from nxspawn_open()
...
nxspawn_open() is expected to return "OK" when it success, but
it doesn't return it in case of executing dup2.
Because of this, the "Command as parameter" couldn't work with
Builtin Apps.
2021-07-20 09:26:01 -03:00
Jiuzhu Dong
9b1f554429
sched: Dynamically extend the pid hash table
...
Change-Id: I3a719bc575cd408cd530a39efa203f507b44fa9c
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-11 19:42:30 -07:00