vfork use waitpid hang father process,
but waitpid release child processs information by default.
So when user call wait, it return errno 10.
Signed-off-by: yangyalei <yangyalei@xiaomi.com>
If scheduling occurs in file_fsync,
fl_lock may be released, and an error may
occur when calling nxmutex_unlock
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
To determine whether a signal is real-time signal or standard signal, the POSIX standard https://www.man7.org/linux/man-pages/man7/signal.7.html defines a real-time signal between SIGRTMIN and SIGRTMAX , which can store multiple copies, otherwise only one can be retained.
Signed-off-by: xinhaiteng <xinhaiteng@xiaomi.com>
If we are running on a single CPU architecture, then we know interrupts
are disabled and there is no need to explicitly call enter_critical_section().
However, in the SMP case, enter_critical_section() is required prevent
multiple cpu to enter timer_start.
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
core0 may write the data used by other cpu, this will cause cache inconsistency.
so need fulsh dcache before start other cpus.
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
The memory allocated with strdup and asprintf is done via lib_malloc
so we need to use lib_free to deallocate memory otherwise the assertion
"Free memory from the wrong heap" is hit with flat mode and user separated
heap enabled mode.
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
We can use the driver in nuttx to download
files with debugger
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: chao an <anchao@xiaomi.com>
reproduce:
static void *pthread(void *arg)
{
system(arg);
}
void test (int argc, char *argv[])
{
pthread_create(&pthread0, &attr, pthread, argv[1]);
pthread_create(&pthread1, &attr, pthread, argv[2]);
}
only one pthread system() returnd, othres hanged
rootcause:
As we known, system() will create a new task called:
system -c XX
The example:
parent group child groups
pthread0 -> waitpid() -> system -c ps -> exit() -> nxtask_signalparent()
pthread1 -> waitpid() -> system -c ls -> exit() -> nxtask_signalparent()
Each child group exit with function nxtask_signalparent(),
As we expect:
system -c ps will signal pthread0
system -c ls will signal pthread1
But actually:
system -c ps will signal pthread0/1
system -c ls will signal pthread0/1
As the spec, we know, this behavior is normal:
https://man7.org/linux/man-pages/man2/sigwaitinfo.2.html
So for this situation, when the signo is SIGCHLD, we broadcast.
Signed-off-by: ligd <liguiding1@xiaomi.com>
Standard POSIX specification in URL “https://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_timedsend.html” requires that "EBADF" be returned when message queue not opened for writing.So i update the related descriptions in this file, no function changed.
Signed-off-by: yangjiao <yangjiao@xiaomi.com>
Standard POSIX specification in URL “https://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_send.html” requires that "EBADF" be returned when mqdes is not open for writing. And message priorities range from 0 to {MQ_PRIO_MAX}-1. In this change, i update them to follow POSIX spec.
Signed-off-by: yangjiao <yangjiao@xiaomi.com>
In POSIX testcase "open_posix_testsuite/conformance/interfaces/mq_receive/11-2.c", it will return "EPERM" when message queue is not opened for reading, but the standard POSIX specification in URL “https://pubs.opengroup.org/onlinepubs/9699919799/functions/mq_receive.html” requires that "EBADF" be returned.So in this change, i update it.
Signed-off-by: yangjiao <yangjiao@xiaomi.com>
When supporting high-priority interrupts, updating the
g_running_tasks within a high-priority interrupt may be
cause problems. The g_running_tasks should only be updated
when it is determined that a task context switch has occurred.
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
fix ltp pthread_cond_wait_1 test question, child should inherit parent
priority by default.
nsh> ltp_pthread_cond_wait_1
Error: the policy or priority not correct
Signed-off-by: yangyalei <yangyalei@xiaomi.com>
The nxspawn_dup2 function will return a value greater than 0,
so the loop should only exit if ret is less than 0.
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>