previous | start | next

Proc table

Here is a portion of the proc struct. The process table managed by the kernel tasks is also called proc.

It is an array of these proc structs of size NR_TASKS + NR_PROCS.

#ifndef PROC_H
#define PROC_H

/* Here is the declaration of the process table.  It contains all process
 * data, including registers, flags, scheduling priority, memory map, 
 * accounting, message passing (IPC) information, and so on. 
 *
 * Many assembly code routines reference fields in it.  The offsets to these
 * fields are defined in the assembler include file sconst.h.  When changing
 * struct proc, be sure to change sconst.h to match.
 */
#include <minix/com.h>
#include <minix/portio.h>
#include "const.h"
#include "priv.h"

struct proc {
  struct stackframe_s p_reg;    /* process' registers saved in stack frame */
  struct segframe p_seg;        /* segment descriptors */
  proc_nr_t p_nr;               /* number of this process (for fast access) */
  struct priv *p_priv;          /* system privileges structure */
  short p_rts_flags;            /* process is runnable only if zero */
  short p_misc_flags;           /* flags that do not suspend the process */

  char p_priority;              /* current scheduling priority */
  char p_max_priority;          /* maximum scheduling priority */
  char p_ticks_left;            /* number of scheduling ticks left */
  char p_quantum_size;          /* quantum size in ticks */

  struct mem_map p_memmap[NR_LOCAL_SEGS];   /* memory map (T, D, S) */
  struct pagefault p_pagefault; /* valid if PAGEFAULT in p_rts_flags set */
  struct proc *p_nextpagefault; /* next on PAGEFAULT chain */

  clock_t p_user_time;          /* user time in ticks */
  clock_t p_sys_time;           /* sys time in ticks */

  clock_t p_virt_left;          /* number of ticks left on virtual timer */
  clock_t p_prof_left;          /* number of ticks left on profile timer */

  struct proc *p_nextready;     /* pointer to next ready process */
  struct proc *p_caller_q;      /* head of list of procs wishing to send */
  struct proc *p_q_link;        /* link to next proc wishing to send */
  int p_getfrom_e;              /* from whom does process want to receive? */
  int p_sendto_e;               /* to whom does process want to send? */

  sigset_t p_pending;           /* bit map for pending kernel signals */

  char p_name[P_NAME_LEN];      /* name of the process, including \0 */

  endpoint_t p_endpoint;        /* endpoint number, generation-aware */

  message p_sendmsg;            /* Message from this process if SENDING */
  message p_delivermsg;         /* Message for this process if MF_DELIVERMSG */
  vir_bytes p_delivermsg_vir;   /* Virtual addr this proc wants message at */
  vir_bytes p_delivermsg_lin;   /* Linear addr this proc wants message at */

  /* A few more members to save state if a handler detects it has to continue later */
};


previous | start | next