summaryrefslogtreecommitdiff
path: root/components/lwp/lwp.c
AgeCommit message (Collapse)Author
2026-05-26lwp: fix pid leak on exec failure before task startupyang.zhang
When msh tries to execute a non-ELF path, lwp_execve() may allocate a PID before lwp_load() fails. The old error path only dropped the LWP reference, leaving the PID tree entry pointing to a freed LWP. In an init-less boot flow, this can poison pid 1 after a failed command from msh. A later LWP launch may then treat the stale pid 1 entry as a valid parent LWP, resulting in invalid pgrp/session state and a job-control assertion during process exit. Add lwp_pid_rollback() for exec/spawn failures before the process becomes runnable. Unlike lwp_pid_put(), it always releases the PID lock and does not enter the "no more pid allocation" state when the PID tree becomes empty. Use the rollback helper in lwp_execve() failure paths after PID allocation. Signed-off-by: zhangyang <[email protected]>
2025-10-20[components/lwp]add doxygen comment for lwp.c with lwp.h.ligr
2025-01-08fix: add \n for addr2line hintMeco Man
2025-01-06feat: add universal process runtime serviceShell
This change introduces the `lwp_runtime.c` component, which provides the necessary runtime environment for the init process, including boot scripts, shutdown, and poweroff functionalities. The initialization logic has been moved from `lwp.c` to this new file, enhancing modularity and flexibility in handling LWP runtime tasks. Changes: - Moved the `lwp_startup` function from `lwp.c` to `lwp_runtime.c` to handle system initialization and runtime environment setup. - Added `lwp_teardown` placeholder for system shutdown and cleanup tasks in the future (though not yet implemented). - Introduced the `LWP_USING_RUNTIME` configuration option in `Kconfig` to conditionally enable the runtime environment. - Updated the `SConscript` to conditionally include `lwp_runtime.c` based on the `LWP_USING_RUNTIME` configuration. - Removed the old `lwp_startup` code from `lwp.c`, simplifying the file. Signed-off-by: Shell <[email protected]>
2024-12-20kernel: cleanup debug APIsChen Wang
- `dbg_log` is a “NOT RECOMMENDED API”, convert the calling of this API to LOG_x and remove this API. - `dbg_here`/`dbg_enter`/`dbg_exit`: no one use these APIs, remove them directly. Signed-off-by: Chen Wang <[email protected]>
2024-06-04[smart] add CPU/thread usage tracing config (#8947)Shell
* [smart] add CPU usage tracing config This patch introduces following features: - Added CPU usage tracing functionality, enabled by default, for applications like 'top' - update time as smart independent Signed-off-by: Shell <[email protected]> * fixup: add ump idle thread --------- Signed-off-by: Shell <[email protected]>
2024-05-31[smart] fixup of script execution (#9009)Shell
This patch fixup the script execution capabilities on argv passing and adds support for arguments larger than 4k. According to POSIX, the script parameter is quiet different from the current implementation. Especially on the way it inserts the path of executables. At the end, when you execute a script from `$PATH`, it always fails. For the script, interpreter will be invoked with the following arguments: `{interpreter [optional-arg] pathname arg...}` where pathname is the pathname of the file specified as the first argument of execve(), and arg... is the series of words pointed to by the argv argument of execve(), starting at argv[1]. Note that there is no way to get the argv[0] that was passed to the execve() call. The changes include: - Separating argument, environment variable, and auxiliary vector processing into a new lwp_args.c file. - Fixing bugs in script argument processing and supporting arguments larger than 4k. - Updating lwp_execve to use the new argscopy function and removing the old lwp_argscopy function. - Making various modifications to lwp_load and elf_aux_fill to work with the new argument processing. - Removing unnecessary code related to dynamic loading and interpreter scripts. Signed-off-by: Shell <[email protected]>
2024-05-17[smart] select console device dynamically (#8949)Shell
* [smart] select console device dynamically - Fixed compiler warning on terminal subsystem for `components/lwp/terminal/terminal.h` - Updated default console setup to dynamically select an appropriate tty device based on the configured console device name. Signed-off-by: Shell <[email protected]> * fixup: remove useless codes --------- Signed-off-by: Shell <[email protected]>
2024-04-15[smart] fixup devfs porting layer of terminal (#8797)Shell
Signed-off-by: Shell <[email protected]>
2024-04-09[drivers/serial] Introduce hooker for TTY (#8733)Shell
In this patch, a hook list has been introduced to address the concerns regarding coupling issues arising from modifications to the serial code for integrating TTY logic. Signed-off-by: Shell <[email protected]>
2024-03-28sync smart & dfs (#8672)Shell
Signed-off-by: xqyjlj <[email protected]> Signed-off-by: Shell <[email protected]> Co-authored-by: xqyjlj <[email protected]>
2023-12-16dfsv2 code tidy. (#8374)geniusgogo
2023-11-10fix rt_channel lock. (#8244)geniusgogo
2023-11-02[smart] fixup of lwp recycling and mm varea (#8206)Shell
Signed-off-by: shell <[email protected]> Signed-off-by: Shell <[email protected]> Co-authored-by: xqyjlj <[email protected]>
2023-10-25🎈 perf: perf rt_hw_interrupt_disable/enable (#8042)xqyjlj
Signed-off-by: Shell <[email protected]> Co-authored-by: Shell <[email protected]>
2023-10-21[kservice] improve backtrace service in kernel (#8144)Shell
Signed-off-by: Shell <[email protected]>
2023-10-17Sync dfs lwp (#8123)geniusgogo
2023-10-14[smart] Replace irq disable/enable codes in futex (#7941)Shell
Signed-off-by: Shell <[email protected]>
2023-10-11[smart] split out part of lwp_new() to lwp_create()Shell
Prev implementation of lwp_new() including the create of lwp object and the pid allocation. But not every lwp object need a pid. So this patch split out the business of lwp_new() to improve the maintainability. Signed-off-by: Shell <[email protected]>
2023-09-15[smart] fix rt_memcpy to lwp_memcpy in smart source (#8033)Shell
2023-08-16[components/mm] add unmap page API (#7834)Shell
Signed-off-by: Shell <[email protected]>
2023-08-07update components & lwp. (#7888)geniusgogo
2023-07-20[component/lwp] support more feature of signal from IEEE Std 1003.1-2017 (#7828)Shell
Signed-off-by: Shell <[email protected]>
2023-07-03execute elf add executable permissions check. (#7769)geniusgogo
2023-06-28[components/tty] fix bug on foreground app switch (#7726)Shell
2023-04-22[components/mm] support for scalable memory management (#7277)Shell
* [mm/page] multi-list page manager [mm/page] page debugger [libcpu/aarch64] hugepage support * [quality] remove void-arith * [format] remove kasan codes
2023-04-08[DFS] prepare for dfs_v2.0 (#7200)Bernard Xiong
* [DFS] prepare for dfs_v2. dfs_fd -> dfs_file; dfs_fnode -> dfs_vnode. * [BSP] fix code analysis warning * [smart] fix the pointer overflow. * code format * [smart] fix the lwp->lwp_obj checking.
2023-04-04[kernel] 将rt_thread结构体改为显式继承rt_object (#7131)Shicheng Chu
2023-03-31✨ feat(components/lwp/lwp.c): add OS env to default environxqyjlj
2023-02-21[fixup] add cache maintenance ops;wangxiaoyao
fix bugs on cache maintenance when starting user app
2023-01-13[rt-smart][fix/lwp] don't restore terminal for background lwp (#6847)Shell
* [fix/lwp] don't restore term for background lwp
2023-01-08[rt-smart] kernel virtual memory management layer (#6809)Shell
synchronize virtual memory system works. adding kernel virtual memory management layer for page-based MMU enabled architecture porting libcpu MMU codes porting lwp memory related codes
2022-12-16[rt-smart] 弱化 RT_USING_LWP,使用 RT_USING_SMART 作为宏配置 (#6740)guo
* [dfs] sync cromfs * [rt-smart]Weaken RT_USING_LWP, use RT_USING_SMART as macro configuration * [format] fix some format issue.
2022-12-11[rtdef] use lower-case to define attributes (#6728)Man, Jianting (Meco)
* [rtdef] rename RT_WEAK attribute as rt_weak * [rtdef] rename RT_USED attribute as rt_used * [rtdef] rename RT_SECTION attribute as rt_section * [rtdef] rename ALIGN attribute as rt_align * [legacy] add RT_USED ALIGN RT_SECTION RT_WEAK as legacy support
2022-12-10[smart][risc-v/libcpu] port rv64 cpu code (#6704)Shell
* [risc-v/libcpu] porting Smart & RTOS * [fix] rv64 plic * [risc-v/rv64] remove macro in rtdef
2022-12-03sync branch rt-smart. (#6641)guo
* Synchronize the code of the rt mart branch to the master branch. * TTY device * Add lwP code from rt-smart * Add vnode in DFS, but DFS will be re-write for rt-smart * There are three libcpu for rt-smart: * arm/cortex-a, arm/aarch64 * riscv64 Co-authored-by: Rbb666 <[email protected]> Co-authored-by: zhkag <[email protected]>
2022-01-14[update] move dfs_posix.h to legacy/dfs/dfs_posix.hliukangcc
2021-03-08[compoenets] auto & manual formattedMeco Man
2019-04-12Update all of debug log definition to DBG_TAG and DBG_LVL.armink
2019-03-06Remove the DBG_COLOR and DBG_ENABLE definition.armink
2018-12-10修改许可协议shaojinchun
修改cpu目录名及相关修改
2018-12-10add lwp supportshaojinchun
2018-09-01[components] Remove lwP from v3.1.0Bernard Xiong
2018-07-30[lwp]给thread添加lwp成员heyuanjie
2018-07-11[rtdbg] Change all DBG_SECTION_NAME to new format.armink
2018-06-29同步heyuanjie
2018-06-29给lwp传递参数heyuanjie
2018-06-11去除lwp msh命令heyuanjie
2018-06-10[lwP] Add light weight process component.Bernard Xiong