33 pr_emerg(
"failed to allocate process for fork");
39 pr_demph(process,
"process %d forked to %d", parent->
pid, child_p->
pid);
49 default:
mos_panic(
"unknown vmap");
break;
51 pr_dinfo2(process,
"fork vmap %d->%d: %10s, %pvm -> %pvm", parent->
pid, child_p->
pid,
vmap_type_str[vmap_p->type], (
void *) vmap_p, (
void *) child_vmap);
74 pr_dinfo2(process,
"fork: thread %d->%d", parent_thread->
tid, child_t->
tid);
85 new_sig->
signal = sig->signal;
#define MOS_PROCESS_MAX_OPEN_FILES
#define MOS_STACK_PAGES_KERNEL
vmap_t * cow_clone_vmap_locked(mm_context_t *target_mmctx, vmap_t *source_vmap)
Copy-on-write a page range.
process_t * process_do_fork(process_t *parent)
const char * vmap_type_str[]
dentry_t * dentry_ref_up_to(dentry_t *dentry, dentry_t *root)
Increment the reference count of a dentry up to a given dentry.
MOSAPI void stack_init(downwards_stack_t *stack, void *mem_region_bottom, size_t size)
MOSAPI void * hashmap_put(hashmap_t *map, uintn key, void *value)
MOSAPI char * strdup(const char *src)
MOSAPI void linked_list_init(list_node_t *head_node)
Initialise a circular double linked list.
#define list_foreach(t, v, h)
Iterate over a list.
#define list_node(element)
Get the ‘list_node’ of a list element. This is exactly the reverse of ‘list_entry’ above.
MOSAPI void list_node_prepend(list_node_t *head, list_node_t *item)
#define phyframe_va(frame)
void vmap_finalise_init(vmap_t *vmap, vmap_content_t content, vmap_type_t type)
Finalize the initialization of a vmap object.
void mm_unlock_ctx_pair(mm_context_t *ctx1, mm_context_t *ctx2)
phyframe_t * mm_get_free_pages(size_t npages)
void mm_lock_ctx_pair(mm_context_t *ctx1, mm_context_t *ctx2)
Lock and unlock a pair of mm_context_t objects.
vmap_t * mm_clone_vmap_locked(vmap_t *src_vmap, mm_context_t *dst_ctx)
Remap a block of virtual memory from one page table to another, i.e. copy the mappings.
__nodiscard bool io_valid(const io_t *io)
#define mos_panic(fmt,...)
#define pr_emerg(fmt,...)
#define pr_demph(feat, fmt,...)
#define pr_dinfo2(feat, fmt,...)
should_inline bool process_is_valid(const process_t *process)
process_t * process_allocate(process_t *parent, const char *name)
void scheduler_add_thread(thread_t *thread)
Add a thread to the scheduler, so that it can be scheduled.
#define spinlock_acquire(lock)
#define spinlock_release(lock)
waitlist_t sigchild_waitlist
the parent is waiting for a child to exit, if not empty
process_signal_info_t signal_info
signal handling info
dentry_t * working_directory
fd_type files[MOS_PROCESS_MAX_OPEN_FILES]
list_head pending
list of pending signals
sigset_t mask
pending signals mask
thread_mode mode
user-mode thread or kernel-mode
downwards_stack_t u_stack
user-mode stack
downwards_stack_t k_stack
kernel-mode stack
thread_signal_info_t signal_info
thread_t * thread_allocate(process_t *owner, thread_mode tflags)
thread_t * thread_complete_init(thread_t *thread)
__BEGIN_DECLS void waitlist_init(waitlist_t *list)