#include "types.h"#include "defs.h"#include "param.h"#include "mmu.h"#include "x86.h"#include "proc.h"#include "spinlock.h"Go to the source code of this file.
Functions | |
| void | forkret (void) |
| void | trapret (void) |
| void | pinit (void) |
| void | procdump (void) |
| void | ksegment (void) |
| void | usegment (void) |
| static struct proc * | allocproc (void) |
| void | userinit (void) |
| int | growproc (int n) |
| int | fork (void) |
| void | scheduler (void) |
| void | sched (void) |
| void | yield (void) |
| void | sleep (void *chan, struct spinlock *lk) |
| static void | wakeup1 (void *chan) |
| void | wakeup (void *chan) |
| int | kill (int pid) |
| void | exit (void) |
| int | wait (void) |
Variables | |
| struct { | |
| struct spinlock lock | |
| struct proc proc [NPROC] | |
| } | ptable |
| static struct proc * | initproc |
| int | nextpid = 1 |
| static struct proc* allocproc | ( | void | ) | [static, read] |
Definition at line 100 of file proc.c.
References acquire(), proc::context, context::eip, EMBRYO, forkret(), kalloc(), proc::kstack, KSTACKSIZE, memset(), nextpid, NPROC, proc::pid, ptable, release(), proc::state, proc::tf, trapret(), and UNUSED.
Referenced by fork(), and userinit().
| void exit | ( | void | ) |
Definition at line 395 of file proc.c.
References acquire(), fileclose(), iput(), NOFILE, NPROC, panic(), proc::parent, ptable, sched(), proc::state, wakeup1(), and ZOMBIE.
Referenced by bigdir(), bigfile(), cat(), concreate(), createdelete(), dirfile(), dirtest(), exectest(), exitwait(), forktest(), fourteen(), iref(), linktest(), main(), mem(), opentest(), pipe1(), rmdot(), rsect(), runcmd(), sharedfd(), subdir(), sys_exit(), trap(), twofiles(), unlinkread(), wc(), writetest(), writetest1(), and wsect().
| int fork | ( | void | ) |
Definition at line 194 of file proc.c.
References allocproc(), proc::cwd, trapframe::eax, filedup(), idup(), kalloc(), kfree(), proc::kstack, KSTACKSIZE, proc::mem, memmove(), NOFILE, proc::ofile, proc::parent, proc::pid, RUNNABLE, proc::state, proc::sz, proc::tf, and UNUSED.
Referenced by concreate(), createdelete(), exitwait(), fork1(), forktest(), main(), mem(), pipe1(), preempt(), sharedfd(), sys_fork(), and twofiles().
| void forkret | ( | void | ) |
| int growproc | ( | int | n | ) |
Definition at line 174 of file proc.c.
References kalloc(), kfree(), memmove(), memset(), and usegment().
Referenced by sys_sbrk().
| int kill | ( | int | pid | ) |
Definition at line 372 of file proc.c.
References acquire(), proc::killed, NPROC, proc::pid, ptable, release(), RUNNABLE, SLEEPING, and proc::state.
Referenced by main(), preempt(), and sys_kill().
| void ksegment | ( | void | ) |
| void pinit | ( | void | ) |
| void procdump | ( | void | ) |
Definition at line 30 of file proc.c.
References proc::context, cprintf(), context::ebp, EMBRYO, getcallerpcs(), proc::name, NELEM, NPROC, proc::pid, ptable, RUNNABLE, RUNNING, SLEEPING, proc::state, UNUSED, and ZOMBIE.
Referenced by consoleintr().
| void sched | ( | void | ) |
| void scheduler | ( | void | ) |
| void sleep | ( | void * | chan, | |
| struct spinlock * | lk | |||
| ) |
Definition at line 313 of file proc.c.
References acquire(), panic(), ptable, release(), sched(), and SLEEPING.
Referenced by bget(), consoleread(), iderw(), ilock(), main(), piperead(), pipewrite(), sys_sleep(), and wait().
| void trapret | ( | void | ) |
Referenced by allocproc().
| void usegment | ( | void | ) |
| void userinit | ( | void | ) |
Definition at line 142 of file proc.c.
References allocproc(), trapframe::cs, proc::cwd, DPL_USER, trapframe::ds, trapframe::eflags, trapframe::eip, trapframe::es, trapframe::esp, FL_IF, kalloc(), proc::mem, memmove(), memset(), proc::name, namei(), PAGE, RUNNABLE, safestrcpy(), SEG_UCODE, SEG_UDATA, trapframe::ss, proc::state, proc::sz, and proc::tf.
Referenced by mpmain().
| int wait | ( | void | ) |
Definition at line 437 of file proc.c.
References acquire(), kfree(), proc::killed, proc::kstack, KSTACKSIZE, proc::mem, proc::name, NPROC, proc::parent, proc::pid, ptable, release(), sleep(), proc::state, proc::sz, UNUSED, and ZOMBIE.
Referenced by concreate(), createdelete(), exitwait(), forktest(), main(), mem(), pipe1(), preempt(), runcmd(), sharedfd(), sys_wait(), and twofiles().
| void wakeup | ( | void * | chan | ) |
Definition at line 361 of file proc.c.
References acquire(), ptable, release(), and wakeup1().
Referenced by brelse(), consoleintr(), ideintr(), iput(), iunlock(), pipeclose(), piperead(), pipewrite(), and trap().
| static void wakeup1 | ( | void * | chan | ) | [static] |
Definition at line 350 of file proc.c.
References proc::chan, NPROC, ptable, RUNNABLE, SLEEPING, and proc::state.
| void yield | ( | void | ) |
| int nextpid = 1 |
| struct { ... } ptable |
Referenced by allocproc(), exit(), forkret(), kill(), pinit(), procdump(), sched(), scheduler(), sleep(), wait(), wakeup(), wakeup1(), and yield().
1.5.6