AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
proc Struct Reference

A process. More...

#include <proc.h>

Data Fields

pid_t pid
 the process's ID
struct pgroup * pgrp
 its process group, and its node on the group's list
struct qnode * pgrp_node
char * name
 its name: the program it runs
struct fd * fds
 its file descriptors (FDS_COUNT of them)
struct proc * parent
 its parent
struct vnode * cwd
 its current directory (a reference), or NULL for the root
mode_t mask
 its file mode creation mask (umask)
int stopped
 the signal that stopped it, or 0; and what waitpid() has to report (WAIT_*)
int wait_event
struct waitq stop_queue
 its stopped threads sleep here
uint64_t utime
 its CPU time in user mode and in the kernel (ns), and that of the children it waited for
uint64_t stime
uint64_t cutime
uint64_t cstime
uint64_t alarm_at
 its real time timer (ITIMER_REAL): SIGALRM when arch_rtime_ns() reaches alarm_at, then every alarm_interval ns (0: only once); on the scheduler's alarms list while it's armed
uint64_t alarm_interval
struct list_node alarm_link
uid_t uid
 its user and group IDs
gid_t gid
uintptr_t heap_start
 where its heap starts, and where it ends now (sbrk())
uintptr_t heap
uintptr_t entry
 its program's entry point
struct vm_space vm_space
 its address space
struct vm_entry * heap_vm
 its heap's and its stack's mappings
struct vm_entry * stack_vm
struct queue threads
 its threads
int tid_last
 the last thread ID given out (threads leave in any order, so their count can't be the next one's ID)
struct waitq thread_join
 threads waiting in thread_join() sleep here
sigset_t sig_pending
 its pending signals, a bit (1 << sig) each: a signal sent again while it's pending is delivered once (POSIX leaves this to us, and everyone does it)
sigset_t sigmask
 its blocked signals, a bit (1 << sig) each
struct waitq wait_queue
 a parent waiting for a child (waitpid()) sleeps here
struct aquila_sigaction sigaction [SIG_MAX+1]
 its signal actions
int exit
 its exit status (PROC_EXIT())
int running
 whether it's running
int zombie
 proc_kill() is done with it, so it can be reaped (that isn't as soon as it stops running: closing its files may sleep)

Detailed Description

A process.

Definition at line 75 of file proc.h.

Field Documentation

◆ alarm_at

uint64_t proc::alarm_at

its real time timer (ITIMER_REAL): SIGALRM when arch_rtime_ns() reaches alarm_at, then every alarm_interval ns (0: only once); on the scheduler's alarms list while it's armed

Definition at line 114 of file proc.h.

Referenced by sched_alarm(), sched_alarm_get(), and sched_timer_tick().

◆ alarm_interval

uint64_t proc::alarm_interval

Definition at line 114 of file proc.h.

Referenced by sched_alarm(), sched_alarm_get(), and sched_timer_tick().

◆ alarm_link

struct list_node proc::alarm_link

Definition at line 115 of file proc.h.

Referenced by sched_alarm(), sched_alarm_get(), and sched_timer_tick().

◆ cstime

uint64_t proc::cstime

Definition at line 109 of file proc.h.

Referenced by proc_reap().

◆ cutime

uint64_t proc::cutime

Definition at line 109 of file proc.h.

Referenced by proc_reap().

◆ cwd

struct vnode* proc::cwd

its current directory (a reference), or NULL for the root

Definition at line 93 of file proc.h.

Referenced by proc_fork(), proc_kill(), procfs_proc_status(), and sched_init_spawn().

◆ entry

uintptr_t proc::entry

its program's entry point

Definition at line 126 of file proc.h.

Referenced by arch_proc_init(), binfmt_elf_load_segments(), exec_stack_build(), exec_start(), and fork_proc_copy().

◆ exit

int proc::exit

its exit status (PROC_EXIT())

Definition at line 160 of file proc.h.

Referenced by proc_execve(), proc_kill(), sys_exit(), and sys_waitpid().

◆ fds

struct fd* proc::fds

its file descriptors (FDS_COUNT of them)

Definition at line 87 of file proc.h.

Referenced by copy_fds(), proc_execve(), proc_fd_close(), proc_fd_file(), proc_fd_get(), proc_fd_install(), proc_fd_release(), proc_fork(), proc_init(), and proc_kill().

◆ gid

gid_t proc::gid

Definition at line 119 of file proc.h.

Referenced by exec_stack_build(), fork_proc_copy(), and procfs_proc_status().

◆ heap

uintptr_t proc::heap

◆ heap_start

uintptr_t proc::heap_start

where its heap starts, and where it ends now (sbrk())

Definition at line 122 of file proc.h.

Referenced by binfmt_elf_load_segments(), binfmt_fmt_load(), and fork_proc_copy().

◆ heap_vm

struct vm_entry* proc::heap_vm

its heap's and its stack's mappings

Definition at line 132 of file proc.h.

Referenced by binfmt_fmt_load(), proc_fork(), and procfs_proc_maps().

◆ mask

mode_t proc::mask

its file mode creation mask (umask)

Definition at line 96 of file proc.h.

Referenced by fork_proc_copy(), procfs_proc_status(), and sched_init_spawn().

◆ name

char* proc::name

its name: the program it runs

Definition at line 84 of file proc.h.

Referenced by binfmt_fmt_load(), kproc_init(), proc_fork(), proc_reap(), procfs_finddir(), and procfs_proc_status().

◆ parent

◆ pgrp

◆ pgrp_node

struct qnode* proc::pgrp_node

Definition at line 81 of file proc.h.

Referenced by fork_proc_copy(), proc_fork(), proc_reap(), proc_setpgid(), session_new(), and sys_setsid().

◆ pid

◆ running

int proc::running

whether it's running

Definition at line 163 of file proc.h.

Referenced by kproc_init(), pgrp_orphaned_hangup(), proc_alive(), proc_kill(), proc_new(), signal_send(), signal_take(), and signal_to().

◆ sig_pending

sigset_t proc::sig_pending

its pending signals, a bit (1 << sig) each: a signal sent again while it's pending is delivered once (POSIX leaves this to us, and everyone does it)

Definition at line 148 of file proc.h.

Referenced by proc_kill(), procfs_proc_status(), signal_action_set(), signal_interrupts(), signal_take(), and signal_to().

◆ sigaction

◆ sigmask

sigset_t proc::sigmask

◆ stack_vm

struct vm_entry* proc::stack_vm

Definition at line 133 of file proc.h.

Referenced by binfmt_fmt_load(), proc_fork(), and procfs_proc_maps().

◆ stime

uint64_t proc::stime

Definition at line 108 of file proc.h.

Referenced by proc_reap().

◆ stop_queue

struct waitq proc::stop_queue

its stopped threads sleep here

Definition at line 104 of file proc.h.

Referenced by signal_stop(), and signal_to().

◆ stopped

int proc::stopped

the signal that stopped it, or 0; and what waitpid() has to report (WAIT_*)

Definition at line 100 of file proc.h.

Referenced by pgrp_orphaned_hangup(), signal_stop(), signal_to(), and sys_waitpid().

◆ thread_join

struct waitq proc::thread_join

threads waiting in thread_join() sleep here

Definition at line 143 of file proc.h.

Referenced by proc_threads_exec(), sched_thread_killed(), and sys_thread_exit().

◆ threads

◆ tid_last

int proc::tid_last

the last thread ID given out (threads leave in any order, so their count can't be the next one's ID)

Definition at line 140 of file proc.h.

Referenced by thread_new().

◆ uid

uid_t proc::uid

its user and group IDs

Definition at line 118 of file proc.h.

Referenced by exec_stack_build(), fork_proc_copy(), and procfs_proc_status().

◆ utime

uint64_t proc::utime

its CPU time in user mode and in the kernel (ns), and that of the children it waited for

Definition at line 108 of file proc.h.

Referenced by proc_reap().

◆ vm_space

◆ wait_event

int proc::wait_event

Definition at line 101 of file proc.h.

Referenced by signal_stop(), signal_to(), and sys_waitpid().

◆ wait_queue

struct waitq proc::wait_queue

a parent waiting for a child (waitpid()) sleeps here

Definition at line 154 of file proc.h.

Referenced by proc_zombie_notify(), and signal_notify_parent().

◆ zombie

int proc::zombie

proc_kill() is done with it, so it can be reaped (that isn't as soon as it stops running: closing its files may sleep)

Definition at line 167 of file proc.h.

Referenced by pgrp_orphaned(), proc_kill(), and sys_waitpid().


The documentation for this struct was generated from the following file: