|
AquilaOS documentation
How it works, and its code
|
Loading a program into a process, for execve(). More...
Go to the source code of this file.
Macros | |
| #define | NR_BINFMT ((sizeof(binfmt_list)/sizeof(binfmt_list[0]))) |
Functions | |
| static int | binfmt_fmt_load (struct proc *proc, const char *path, struct vnode *vnode, struct binfmt *binfmt, struct proc **ref) |
| Replaces a process's memory with a program, loaded by a format: the process's other threads end, its old address space goes, and the program, a heap, a stack and the signal code page are mapped. | |
| int | binfmt_load (struct proc *proc, const char *path, struct proc **ref) |
| Loads a program into a process, for execve(). | |
Variables | |
| static struct binfmt | binfmt_list [] |
Loading a program into a process, for execve().
The program's file is looked up and checked, then each executable format the kernel knows (only ELF) is asked whether the file is one of its own; the first that says yes loads it. Then the process gets its heap, its stack and the signal code page.
Definition in file binfmt.c.
| #define NR_BINFMT ((sizeof(binfmt_list)/sizeof(binfmt_list[0]))) |
Definition at line 19 of file binfmt.c.
Referenced by binfmt_load().
|
static |
Replaces a process's memory with a program, loaded by a format: the process's other threads end, its old address space goes, and the program, a heap, a stack and the signal code page are mapped.
Returns 0 or a negative errno; on failure the address space is left empty, and the caller has to kill the process.
Definition at line 28 of file binfmt.c.
References arch_sigcode_map(), vm_entry::base, binfmt_fmt_load(), vm_entry::flags, queue::head, proc::heap, proc::heap_start, proc::heap_vm, kfree(), kmalloc(), binfmt::load, M_ZERO, proc::name, NULL, PAGE_ROUND, proc_threads_exec(), vm_entry::qnode, vm_entry::size, thread::stack_base, thread::stack_size, proc::stack_vm, proc::threads, USER_STACK_BASE, USER_STACK_SIZE, qnode::value, vm_space::vm_entries, vm_entry::vm_object, proc::vm_space, vm_space_destroy(), and VM_URW.
Referenced by binfmt_fmt_load(), and binfmt_load().
Loads a program into a process, for execve().
The file must be a regular file that the process may execute, in a format the kernel knows.
| proc | the process, whose memory the program replaces |
| path | the program's path |
| ref | not used |
Definition at line 124 of file binfmt.c.
References binfmt_fmt_load(), binfmt_list, binfmt_load(), memset(), vnode::mode, NR_BINFMT, NULL, PROC_UIO, vfs_access(), vfs_close(), vfs_lookup(), and VFS_X.
Referenced by binfmt_load(), kmain(), and proc_execve().
|
static |
Definition at line 15 of file binfmt.c.
Referenced by binfmt_load().