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 *process)
 
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_t *file, fd_flags_t flags)
 
io_tprocess_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 *&&process, u8 exit_code, signal_t signal)
 
void process_dump_mmaps (const Process *process)
 
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:35
ssize_t sysfs_printf(sysfs_file_t *file, const char *fmt,...)
Definition sysfs.cpp:74

Definition at line 397 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 38 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 51 of file process.cpp.

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

◆ new_process_id()

static pid_t new_process_id ( void )
static

Definition at line 61 of file process.cpp.

Referenced by Process::Process().

◆ process_destroy()

void process_destroy ( Process * process)

Definition at line 106 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 137 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 161 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_t * file,
fd_flags_t flags )

Definition at line 172 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_t * process_get_fd ( Process * process,
fd_t fd )

Definition at line 193 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 201 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 216 of file process.cpp.

Referenced by MOS_STATIC_ASSERT().

+ Here is the call graph for this function:

◆ process_exit()

void process_exit ( Process *&& process,
u8 exit_code,
signal_t signal )

Definition at line 284 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 * process)

Definition at line 368 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 383 of file process.cpp.

Referenced by MOS_STATIC_ASSERT().

◆ process_sysfs_process_stat()

static bool process_sysfs_process_stat ( sysfs_file_t * f)
static

Definition at line 399 of file process.cpp.

◆ process_sysfs_thread_stat()

static bool process_sysfs_thread_stat ( sysfs_file_t * f)
static

Definition at line 413 of file process.cpp.

◆ process_sysfs_vmap_stat()

static bool process_sysfs_vmap_stat ( sysfs_file_t * f)
static

Definition at line 420 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:413
static bool process_sysfs_process_stat(sysfs_file_t *f)
Definition process.cpp:399
static bool process_sysfs_vmap_stat(sysfs_file_t *f)
Definition process.cpp:420
#define SYSFS_RO_ITEM(_name, _show_fn)
Definition sysfs.hpp:42

Definition at line 450 of file process.cpp.

Referenced by SYSFS_AUTOREGISTER().