PatchworkOS  19e446b
A non-POSIX operating system.
Loading...
Searching...
No Matches
process.c File Reference
#include <kernel/cpu/cpu.h>
#include <kernel/cpu/gdt.h>
#include <kernel/fs/ctl.h>
#include <kernel/fs/dentry.h>
#include <kernel/fs/devfs.h>
#include <kernel/fs/file.h>
#include <kernel/fs/namespace.h>
#include <kernel/fs/path.h>
#include <kernel/fs/vfs.h>
#include <kernel/io/io.h>
#include <kernel/log/log.h>
#include <kernel/log/panic.h>
#include <kernel/mem/cache.h>
#include <kernel/mem/vmm.h>
#include <kernel/proc/group.h>
#include <kernel/proc/process.h>
#include <kernel/proc/reaper.h>
#include <kernel/sched/clock.h>
#include <kernel/sched/sched.h>
#include <kernel/sched/thread.h>
#include <kernel/sched/timer.h>
#include <kernel/sched/wait.h>
#include <kernel/sync/lock.h>
#include <kernel/sync/rcu.h>
#include <assert.h>
#include <errno.h>
#include <kernel/sync/seqlock.h>
#include <kernel/utils/map.h>
#include <kernel/utils/ref.h>
#include <stdatomic.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/fs.h>
#include <sys/list.h>
#include <sys/math.h>
#include <sys/proc.h>
Include dependency graph for process.c:

Go to the source code of this file.

Functions

static _Atomic (pid_t)
 
static void process_free (process_t *process)
 
process_tprocess_new (priority_t priority, group_member_t *group, namespace_t *ns)
 Allocates and initializes a new process.
 
process_tprocess_get (pid_t id)
 Gets a process by its ID.
 
namespace_tprocess_get_ns (process_t *process)
 Gets the namespace of a process.
 
void process_set_ns (process_t *process, namespace_t *ns)
 Sets the namespace of a process.
 
void process_kill (process_t *process, const char *status)
 Kills a process, pushing it to the reaper.
 
void process_remove (process_t *process)
 Removes a process from the system.
 
uint64_t process_set_cmdline (process_t *process, char **argv, uint64_t argc)
 Sets the command line arguments for a process.
 
bool process_has_thread (process_t *process, tid_t tid)
 Checks if a process has a thread with the specified thread ID.
 
process_tprocess_get_kernel (void)
 Gets the kernel process.
 
 SYSCALL_DEFINE (SYS_GETPID, pid_t)
 

Variables

static process_tkernelProcess = NULL
 
static cache_t cache = CACHE_CREATE(cache, "process", sizeof(process_t), CACHE_LINE, process_ctor, NULL)
 

Function Documentation

◆ _Atomic()

static _Atomic ( pid_t  )
staticnew

Definition at line 42 of file process.c.

◆ process_free()

static void process_free ( process_t process)
static

Definition at line 85 of file process.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SYSCALL_DEFINE()

SYSCALL_DEFINE ( SYS_GETPID  ,
pid_t   
)

Definition at line 396 of file process.c.

Here is the call graph for this function:

Variable Documentation

◆ kernelProcess

process_t* kernelProcess = NULL
static

Definition at line 40 of file process.c.

◆ cache

cache_t cache = CACHE_CREATE(cache, "process", sizeof(process_t), CACHE_LINE, process_ctor, NULL)
static

Definition at line 83 of file process.c.