diff options
| author | bernard <[email protected]> | 2026-08-23 10:13:24 +0800 |
|---|---|---|
| committer | Rbb666 <[email protected]> | 2026-08-30 20:49:24 +0800 |
| commit | 5dcbc0dec92259ce8ab87a16fce39d9ce5d15ec8 (patch) | |
| tree | 7fa0ec2186ce1d3f669eff5bd071b2e26853ddd6 /components/lwp | |
| parent | 04b19b35e30308ba5dcbe72919fdf0a97f7ba61f (diff) | |
[dfs][procfs] Fix Linux-compatible procfs fields
Grow maps without a 256 VMA cap, skip RSS walks for maps, report
matching status text, real RSS/statm, MemAvailable after page-pool
free pages, load averages plus last PID, cumulative processes, RV32
cpuinfo, and per-character mount escaping.
Diffstat (limited to 'components/lwp')
| -rw-r--r-- | components/lwp/lwp_pid.c | 24 | ||||
| -rw-r--r-- | components/lwp/lwp_pid.h | 2 |
2 files changed, 26 insertions, 0 deletions
diff --git a/components/lwp/lwp_pid.c b/components/lwp/lwp_pid.c index 12a4dde86f..1f0e09ae9c 100644 --- a/components/lwp/lwp_pid.c +++ b/components/lwp/lwp_pid.c @@ -68,6 +68,7 @@ static struct lwp_avl_struct *lwp_pid_free_head = RT_NULL; static int lwp_pid_ary_alloced = 0; static struct lwp_avl_struct *lwp_pid_root = RT_NULL; static pid_t current_pid = 0; +static unsigned long lwp_create_count = 0; static struct rt_mutex pid_mtx; static struct rt_wqueue _pid_emptyq; @@ -166,6 +167,28 @@ static int _before_cb(struct lwp_avl_struct *node, void *data) return param->cb(pid, param->data); } +unsigned long lwp_pid_get_create_count(void) +{ + unsigned long count; + + lwp_pid_lock_take(); + count = lwp_create_count; + lwp_pid_lock_release(); + + return count; +} + +pid_t lwp_pid_get_last(void) +{ + pid_t pid; + + lwp_pid_lock_take(); + pid = current_pid; + lwp_pid_lock_release(); + + return pid; +} + /** * @brief Iterate over all process IDs * @@ -694,6 +717,7 @@ rt_lwp_t lwp_create(rt_base_t flags) { new_lwp->pid = pid; lwp_pid_set_lwp_locked(pid, new_lwp); + lwp_create_count++; } lwp_pid_lock_release(); } diff --git a/components/lwp/lwp_pid.h b/components/lwp/lwp_pid.h index 5b85b32197..a295137fbc 100644 --- a/components/lwp/lwp_pid.h +++ b/components/lwp/lwp_pid.h @@ -28,6 +28,8 @@ struct lwp_avl_struct *lwp_get_pid_ary(void); int lwp_pid_init(void); int lwp_pid_wait_for_empty(int wait_flags, rt_tick_t to); int lwp_pid_for_each(int (*cb)(pid_t pid, void *data), void *data); +unsigned long lwp_pid_get_create_count(void); +pid_t lwp_pid_get_last(void); void lwp_pid_put(struct rt_lwp *lwp); void lwp_pid_rollback(struct rt_lwp *lwp); void lwp_pid_lock_take(void); |
