proc

package
v0.0.0-...-70d8496 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2019 License: BSD-3-Clause, MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Oom *oom_t = &oom_t{halp: oommsg.OomCh}
View Source
var Ptable = ptable_t{
	// contains filtered or unexported fields
}

Functions

func KillableWait

func KillableWait(cond *sync.Cond) defs.Err_t

returns non-zero if this calling process has been killed and the caller should finish the system call.

func Oom_init

func Oom_init(evict func() (int, int))

func Proc_del

func Proc_del(pid int)

func Tid_del

func Tid_del()

Types

type Cons_i

type Cons_i interface {
	Cons_poll(pm fdops.Pollmsg_t) (fdops.Ready_t, defs.Err_t)
	Cons_read(ub fdops.Userio_i, offset int) (int, defs.Err_t)
	Cons_write(src fdops.Userio_i, off int) (int, defs.Err_t)
}

type Proc_t

type Proc_t struct {
	Pid int

	Name ustr.Ustr

	// waitinfo for my child processes
	Mywait Wait_t
	// waitinfo of my parent
	Pwait *Wait_t

	// thread tids of this process
	Threadi tinfo.Threadinfo_t

	// Address space
	Vm vm.Vm_t

	// mmap next virtual address hint
	Mmapi int

	Fds []*fd.Fd_t

	// fds, fdstart, nfds protected by fdl
	Fdl sync.Mutex

	Cwd *fd.Cwd_t

	Ulim Ulimit_t

	// this proc's rusage
	Atime accnt.Accnt_t
	// total child rusage
	Catime accnt.Accnt_t

	// no thread can read/write Oomlink except the OOM killer
	Oomlink *Proc_t
	// contains filtered or unexported fields
}

func CurrentProc

func CurrentProc() *Proc_t

func Proc_check

func Proc_check(pid int) (*Proc_t, bool)

func Proc_new

func Proc_new(name ustr.Ustr, cwd *fd.Cwd_t, fds []*fd.Fd_t, sys Syscall_i) (*Proc_t, bool)

returns the new proc and success; can fail if the system-wide limit of procs/threads has been reached. the parent's fdtable must be locked.

func (*Proc_t) Doomall

func (p *Proc_t) Doomall()

func (*Proc_t) Doomed

func (p *Proc_t) Doomed() bool

func (*Proc_t) Fd_del

func (p *Proc_t) Fd_del(fdn int) (*fd.Fd_t, bool)

fdn is not guaranteed to be a sane fd

func (*Proc_t) Fd_dup

func (p *Proc_t) Fd_dup(ofdn, nfdn int) (*fd.Fd_t, bool, defs.Err_t)

fdn is not guaranteed to be a sane fd. returns the the fd replaced by ofdn and whether it exists and needs to be closed, and success.

func (*Proc_t) Fd_get

func (p *Proc_t) Fd_get(fdn int) (*fd.Fd_t, bool)

func (*Proc_t) Fd_get_inner

func (p *Proc_t) Fd_get_inner(fdn int) (*fd.Fd_t, bool)

fdn is not guaranteed to be a sane fd

func (*Proc_t) Fd_insert

func (p *Proc_t) Fd_insert(f *fd.Fd_t, perms int) (int, bool)

an fd table invariant: every fd must have its file field set. thus the caller cannot set an fd's file field without holding fdl. otherwise you will race with a forking thread when it copies the fd table.

func (*Proc_t) Fd_insert2

func (p *Proc_t) Fd_insert2(f1 *fd.Fd_t, perms1 int,
	f2 *fd.Fd_t, perms2 int) (int, int, bool)

returns the fd numbers and success

func (*Proc_t) Reap_doomed

func (p *Proc_t) Reap_doomed(tid defs.Tid_t)

func (*Proc_t) Sched_add

func (p *Proc_t) Sched_add(tf *[defs.TFSIZE]uintptr, tid defs.Tid_t)

func (*Proc_t) Start_proc

func (p *Proc_t) Start_proc(pid int) bool

returns false if the number of running threads or unreaped child statuses is larger than noproc.

func (*Proc_t) Start_thread

func (p *Proc_t) Start_thread(t defs.Tid_t) bool

returns false if the number of running threads or unreaped child statuses is larger than noproc.

func (*Proc_t) Thread_count

func (p *Proc_t) Thread_count() int

func (*Proc_t) Thread_dead

func (p *Proc_t) Thread_dead(tid defs.Tid_t, status int, usestatus bool)

terminate a single thread

func (*Proc_t) Thread_new

func (p *Proc_t) Thread_new() (defs.Tid_t, bool)

func (*Proc_t) Thread_undo

func (p *Proc_t) Thread_undo(t defs.Tid_t)

undo thread_new(); sched_add() must not have been called on t.

func (*Proc_t) Tid0

func (p *Proc_t) Tid0() defs.Tid_t

func (*Proc_t) Tlbflush

func (p *Proc_t) Tlbflush()

flush TLB on all CPUs that may have this processes' pmap loaded

func (*Proc_t) Userargs

func (p *Proc_t) Userargs(uva int) ([]ustr.Ustr, defs.Err_t)

func (*Proc_t) Vm_fork

func (parent *Proc_t) Vm_fork(child *Proc_t, rsp uintptr) (bool, bool)

returns whether the parent's TLB should be flushed and whether the we successfully copied the parent's address space.

type Syscall_i

type Syscall_i interface {
	Syscall(p *Proc_t, tid defs.Tid_t, tf *[defs.TFSIZE]uintptr) int
	Sys_close(proc *Proc_t, fdn int) int
	Sys_exit(Proc *Proc_t, tid defs.Tid_t, status int)
}

XXX add all syscalls so that we easily can do syscall interposition. currently no use.

type Ulimit_t

type Ulimit_t struct {
	Pages  int
	Nofile uint
	Novma  uint
	Noproc uint
}

per-process limits

type Wait_t

type Wait_t struct {
	sync.Mutex

	Pid int
	// contains filtered or unexported fields
}

func (*Wait_t) Len

func (w *Wait_t) Len() int

returns the number of nodes in the linked list

func (*Wait_t) Reappid

func (w *Wait_t) Reappid(pid int, noblk bool) (Waitst_t, defs.Err_t)

func (*Wait_t) Reaptid

func (w *Wait_t) Reaptid(tid int, noblk bool) (Waitst_t, defs.Err_t)

func (*Wait_t) Wait_init

func (w *Wait_t) Wait_init(mypid int)

type Waitst_t

type Waitst_t struct {
	Pid    int
	Status int
	Atime  accnt.Accnt_t
	// true iff the exit status is valid
	Valid bool
}

requirements for wait* syscalls (used for processes and threads): - wait for a pid that is not my child must fail - only one wait for a specific pid may succeed; others must fail - wait when there are no children must fail - wait for a process should not return thread info and vice versa

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL