To solve some compilation issues encountered during the porting of
third-party libraries, this function has been added.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
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>
1. add lib_fork api in libs/libc, we need a fork() api to implement the
fork relative method, such as pthread_atfork
2. rename the assembly fork entry function name to up_fork(), and rename
the up_fork() to arch specific name, such as
sim_fork()/arm_fork()/mips_fork() etc.
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
1. the getpgid function can help to pass the
ltp/open_posix_testsuite/killpg related testcases
2. NuttX do not support process group, so we use the process id as
process group id
3. the implementation are referred to: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpgid.html
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
sysconf add param _SC_THREAD_STACK_MIN deal
make the pthread_exit pass the ltp/open_posix_testsuite/pthread_exit/1-2.c testcase
(1) in pthread_exit/1-2.c testcase, if sysconf(_SC_THREAD_STACK_MIN) % sysconf(_SC_PAGESIZE) is not zero, will report error and test failed, so set CONFIG_PTHREAD_STACK_MIN as DEFAULT_MM_PGSIZE`s default value.
(2) in function sysconf add param _SC_THREAD_STACK_MIN deal.
Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
1. as we can use fork to implement vfork, so we rename the vfork to
fork, and use the fork method as the base to implement vfork method
2. create the vfork function as a libc function based on fork
function
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
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>
1. the getpgrp function can help to pass the ltp/open_posix_teststuite/killpg related testcases
2. Nuttx do not support process group, so we use getpid to implement this
3. the implementation are referred to: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpgrp.html
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
In the Nim language "selectors"(I/O multiplexing) module, the maximum
number of file descriptors is obtained with getrlimit() as follows.
var fdLim: RLimit
var res = int(getrlimit(RLIMIT_NOFILE, fdLim))
if res >= 0:
res = int(fdLim.rlim_cur) - 1
To be able to use the same implementation as other POSIX-based OS,
getrlimit() should return a value.
(For now, let it return 128.)
Signed-off-by: Takeyoshi Kikuchi <kikuchi@centurysys.co.jp>
NuttX kernel should not use the syscall functions, especially after
enabling CONFIG_SCHED_INSTRUMENTATION_SYSCALL, all system functions
will be traced to backend, which will impact system performance.
Signed-off-by: chao an <anchao@xiaomi.com>
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.