get_proc_info () syscall, CE procinfo command
All checks were successful
Build ISO image / build-and-deploy (push) Successful in 3m31s
Build documentation / build-and-deploy (push) Successful in 2m0s

This commit is contained in:
2026-03-26 20:21:43 +01:00
parent 9f2e6eef79
commit df730cec36
9 changed files with 131 additions and 0 deletions

View File

@@ -14,6 +14,7 @@
#include <proc/proc.h>
#include <proc/procgroup.h>
#include <proc/resource.h>
#include <proc_info.h>
#include <status.h>
#include <sync/spin_lock.h>
#include <sys/debug.h>
@@ -1055,6 +1056,26 @@ DEFINE_SYSCALL (sys_stream_read) {
return SYSRESULT (proc_stream_read (&stream_resource->u.stream, buffer, buffer_size));
}
/* int get_proc_int (struct proc_info* infos, size_t count) */
DEFINE_SYSCALL (sys_get_proc_info) {
uint64_t fp;
uintptr_t uvaddr_infos = a1;
size_t infos_count = (size_t)a2;
spin_lock (&proc->lock, &fp);
struct procgroup* procgroup = proc->procgroup;
spin_unlock (&proc->lock, fp);
struct proc_info* infos =
sys_get_user_buffer (procgroup, uvaddr_infos, infos_count * sizeof (struct proc_info));
if (infos == NULL)
return SYSRESULT (-ST_BAD_ADDRESS_SPACE);
return SYSRESULT (proc_populate_proc_infos (infos, infos_count));
}
static syscall_handler_func_t handler_table[] = {
[SYS_QUIT] = &sys_quit,
[SYS_TEST] = &sys_test,
@@ -1092,6 +1113,7 @@ static syscall_handler_func_t handler_table[] = {
[SYS_GET_SELF_PID] = &sys_get_self_pid,
[SYS_STREAM_WRITE] = &sys_stream_write,
[SYS_STREAM_READ] = &sys_stream_read,
[SYS_GET_PROC_INFO] = &sys_get_proc_info,
};
syscall_handler_func_t syscall_find_handler (int syscall_num) {