Desktop/xinu_mips-1.0.2.tar/xinu_mips-1.0.2/include/proc.h File Reference

#include <kernel.h>
#include <semaphore.h>

Include dependency graph for proc.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  pentry

Defines

#define NPROC   50
#define STACKMAGIC   0x0A0AAAA9
#define PRCURR   1
#define PRFREE   2
#define PRREADY   3
#define PRRECV   4
#define PRSLEEP   5
#define PRSUSP   6
#define PRWAIT   7
#define PNMLEN   16
#define NULLPROC   0
#define BADPID   (-1)
#define isbadpid(x)   ((x)>=NPROC || PRFREE == proctab[(x)].state)
#define INITSTK   65536
#define INITPRIO   20
#define INITRET   userret
#define MINSTK   4096
#define NULLSTK   MINSTK
#define BLOCK   1
#define NOBLOCK   0

Typedefs

typedef struct pentry pcb

Functions

syscall send (ushort pid, long msg, bool block)
syscall receive (bool block)

Variables

struct pentry proctab []
ushort numproc
ushort currpid


Detailed Description

isbadpid

Id
proc.h 446 2008-04-30 18:49:43Z mschul

Definition in file proc.h.


Define Documentation

#define BADPID   (-1)

used when invalid pid needed

Definition at line 39 of file proc.h.

#define BLOCK   1

Definition at line 72 of file proc.h.

Referenced by kill(), receive(), and send().

#define INITPRIO   20

initial process priority

Definition at line 66 of file proc.h.

Referenced by main(), and nulluser().

#define INITRET   userret

processes return address

Definition at line 67 of file proc.h.

Referenced by create().

#define INITSTK   65536

#define isbadpid (  )     ((x)>=NPROC || PRFREE == proctab[(x)].state)

Check for invalid process ids. Note that interrupts must be disabled for the condition to hold true between statements.

Definition at line 45 of file proc.h.

Referenced by enqueue(), insert(), insertd(), kill(), ready(), remove(), and send().

#define MINSTK   4096

minimum process stack size

Definition at line 68 of file proc.h.

Referenced by create().

#define NOBLOCK   0

Definition at line 73 of file proc.h.

#define NPROC   50

set the number of processes

Definition at line 18 of file proc.h.

#define NULLPROC   0

id of the null process

Definition at line 38 of file proc.h.

Referenced by sysinit(), and xsh_kill().

#define NULLSTK   MINSTK

null process stack size

Definition at line 69 of file proc.h.

#define PNMLEN   16

length of process "name"

Definition at line 36 of file proc.h.

Referenced by create().

#define PRCURR   1

process is currently running

Definition at line 26 of file proc.h.

Referenced by kill(), resched(), and sysinit().

#define PRFREE   2

process slot is free

Definition at line 27 of file proc.h.

Referenced by kill(), newpid(), send(), sysinit(), test_semaphore(), test_semaphore2(), test_semaphore3(), test_semaphore4(), xsh_memstat(), and xsh_ps().

#define PRREADY   3

process is on ready queue

Definition at line 28 of file proc.h.

Referenced by kill(), ready(), and resched().

#define PRRECV   4

process waiting for message

Definition at line 29 of file proc.h.

Referenced by receive(), and send().

#define PRSLEEP   5

process is sleeping

Definition at line 30 of file proc.h.

Referenced by kill(), and sleep().

#define PRSUSP   6

process is suspended

Definition at line 31 of file proc.h.

Referenced by create().

#define PRWAIT   7

process is on semaphore queue

Definition at line 32 of file proc.h.

Referenced by kill(), test_semaphore(), test_semaphore2(), test_semaphore3(), test_semaphore4(), and wait().

#define STACKMAGIC   0x0A0AAAA9

Definition at line 22 of file proc.h.

Referenced by create().


Typedef Documentation

typedef struct pentry pcb


Function Documentation

syscall receive ( bool  block  ) 

receive - request a message from mailbox

Parameters:
block wait for message if BLOCK, return NULL if NOBLOCK and no message available
Returns:
message if available, NULL if no message in mailbox

Definition at line 19 of file receive.c.

References BLOCK, currpid, disable(), FALSE, pentry::hasmsg, pentry::msg, NULL, proctab, PRRECV, resched(), restore(), and pentry::state.

Referenced by shell().

syscall send ( ushort  pid,
long  msg,
bool  block 
)

send - pass a message to another process mailbox

Parameters:
pid process id of recipient
msg contents of message
block reschedule if BLOCK, return to call function if NOBLOCK
Returns:
OK on success, SYSERR on failure

Definition at line 19 of file send.c.

References BLOCK, disable(), FALSE, pentry::hasmsg, isbadpid, pentry::msg, OK, PRFREE, proctab, PRRECV, ready(), resched(), RESCHED_NO, restore(), pentry::state, SYSERR, and TRUE.

Referenced by kill().


Variable Documentation

currently executing process

Definition at line 46 of file initialize.c.

Referenced by getpid(), receive(), resched(), sleep(), sysinit(), t4(), t5(), and wait().

currently active processes

Definition at line 45 of file initialize.c.

Referenced by create(), kill(), nulluser(), and sysinit().

struct pentry proctab[]


Generated on Thu Oct 9 22:34:37 2008 for xinu by  doxygen 1.5.5