MOS Source Code
Loading...
Searching...
No Matches
process.cpp File Reference
Include dependency graph for process.cpp:

Go to the source code of this file.

Macros

#define do_print(fmt, name, item)
#define stat_line(fmt)

Functions

const char * get_vmap_content_str (vmap_content_t content)
const char * get_vmap_type_str (vmap_type_t type)
static pid_t new_process_id (void)
void process_destroy (Process *proc)
Processprocess_new (Process *parent, mos::string_view name, const stdio_t *ios)
std::optional< Process * > process_get (pid_t pid)
fd_t process_attach_ref_fd (Process *process, IO *file, FDFlags flags)
IOprocess_get_fd (Process *process, fd_t fd)
bool process_detach_fd (Process *process, fd_t fd)
pid_t process_wait_for_pid (pid_t pid, u32 *exit_code, u32 flags)
void process_exit (Process *&&proc, u8 exit_code, signal_t sig)
void process_dump_mmaps (const Process *proc)
bool process_register_signal_handler (Process *process, signal_t sig, const sigaction_t *sigaction)
static bool process_sysfs_process_stat (sysfs_file_t *f)
static bool process_sysfs_thread_stat (sysfs_file_t *f)
static bool process_sysfs_vmap_stat (sysfs_file_t *f)
 SYSFS_AUTOREGISTER (current, process_sysfs_items)

Variables

mos::HashMap< pid_t, Process * > ProcessTable
static sysfs_item_t process_sysfs_items []

Macro Definition Documentation

◆ do_print

#define do_print ( fmt,
name,
item )
Value:
sysfs_printf(f, "%-10s: " fmt "\n", name, item);
const char * name
Definition slab.cpp:33
ssize_t sysfs_printf(sysfs_file_t *file, const char *fmt,...)
Definition sysfs.cpp:73
#define f(_fmt)
Definition syslog.hpp:160
#define fmt(_fmt,...)
Definition syslog.hpp:161

Definition at line 402 of file process.cpp.

Referenced by process_sysfs_process_stat(), and process_sysfs_thread_stat().

◆ stat_line

#define stat_line ( fmt)
Value:
" %9s: " fmt "\n"

Referenced by process_sysfs_vmap_stat().

Function Documentation

◆ get_vmap_content_str()

const char * get_vmap_content_str ( vmap_content_t content)

Definition at line 39 of file process.cpp.

Referenced by process_dump_mmaps(), and process_sysfs_vmap_stat().

◆ get_vmap_type_str()

const char * get_vmap_type_str ( vmap_type_t type)

Definition at line 52 of file process.cpp.

Referenced by process_do_fork(), process_dump_mmaps(), and process_sysfs_vmap_stat().

◆ new_process_id()

pid_t new_process_id ( void )
static

Definition at line 62 of file process.cpp.

Referenced by Process::Process().

◆ process_destroy()

void process_destroy ( Process * proc)

Definition at line 107 of file process.cpp.

Referenced by process_new(), and process_wait_for_pid().

Here is the call graph for this function:

◆ process_new()

Process * process_new ( Process * parent,
mos::string_view name,
const stdio_t * ios )

Definition at line 141 of file process.cpp.

Referenced by elf_create_process().

Here is the call graph for this function:

◆ process_get()

std::optional< Process * > process_get ( pid_t pid)

Definition at line 166 of file process.cpp.

Referenced by mmstat_sysfs_pagetable_show(), mmstat_sysfs_vmaps_show(), MOS_STATIC_ASSERT(), and process_wait_for_pid().

Here is the call graph for this function:

◆ process_attach_ref_fd()

fd_t process_attach_ref_fd ( Process * process,
IO * file,
FDFlags flags )

Definition at line 177 of file process.cpp.

Referenced by fd_manipulate(), io_dup(), ipc_accept(), ipc_connect(), ipc_create(), memfd_create(), MOS_STATIC_ASSERT(), MOS_STATIC_ASSERT(), process_new(), and vfs_ipc_file_read().

Here is the call graph for this function:

◆ process_get_fd()

IO * process_get_fd ( Process * process,
fd_t fd )

Definition at line 198 of file process.cpp.

Referenced by dentry_from_fd(), io_dup(), io_pread(), io_read(), io_readv(), io_seek(), io_tell(), io_write(), ipc_accept(), mmap_file(), MOS_STATIC_ASSERT(), MOS_STATIC_ASSERT(), and vfs_fstatat().

Here is the call graph for this function:

◆ process_detach_fd()

bool process_detach_fd ( Process * process,
fd_t fd )

Definition at line 206 of file process.cpp.

Referenced by io_close(), io_dup2(), and process_do_execveat().

Here is the call graph for this function:

◆ process_wait_for_pid()

pid_t process_wait_for_pid ( pid_t pid,
u32 * exit_code,
u32 flags )

Definition at line 221 of file process.cpp.

Referenced by MOS_STATIC_ASSERT().

Here is the call graph for this function:

◆ process_exit()

void process_exit ( Process *&& proc,
u8 exit_code,
signal_t sig )

Definition at line 289 of file process.cpp.

Referenced by elf_create_process(), exit(), process_do_execveat(), signal_do_coredump(), and signal_do_terminate().

Here is the call graph for this function:

◆ process_dump_mmaps()

void process_dump_mmaps ( const Process * proc)

Definition at line 373 of file process.cpp.

Referenced by dump_process(), and invalid_page_fault().

Here is the call graph for this function:

◆ process_register_signal_handler()

bool process_register_signal_handler ( Process * process,
signal_t sig,
const sigaction_t * sigaction )

Definition at line 388 of file process.cpp.

Referenced by MOS_STATIC_ASSERT().

◆ process_sysfs_process_stat()

bool process_sysfs_process_stat ( sysfs_file_t * f)
static

Definition at line 404 of file process.cpp.

◆ process_sysfs_thread_stat()

bool process_sysfs_thread_stat ( sysfs_file_t * f)
static

Definition at line 418 of file process.cpp.

◆ process_sysfs_vmap_stat()

bool process_sysfs_vmap_stat ( sysfs_file_t * f)
static

Definition at line 425 of file process.cpp.

Here is the call graph for this function:

◆ SYSFS_AUTOREGISTER()

SYSFS_AUTOREGISTER ( current ,
process_sysfs_items  )

Variable Documentation

◆ ProcessTable

◆ process_sysfs_items

sysfs_item_t process_sysfs_items[]
static
Initial value:
= {
}
static bool process_sysfs_thread_stat(sysfs_file_t *f)
Definition process.cpp:418
static bool process_sysfs_process_stat(sysfs_file_t *f)
Definition process.cpp:404
static bool process_sysfs_vmap_stat(sysfs_file_t *f)
Definition process.cpp:425
#define SYSFS_RO_ITEM(_name, _show_fn)
Definition sysfs.hpp:42

Definition at line 454 of file process.cpp.

Referenced by SYSFS_AUTOREGISTER().