View of xos/kernel/proc_struct.h


XOS | Parent Directory | View | Download

/* Copyright (C) 2008  Emmanuel Varoquaux
 
   This file is part of XOS.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
 
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
#ifndef PROC_STRUCT_H
#define PROC_STRUCT_H
 
#include <alarm_struct.h>
#include <vm_struct.h>
#include <string_table_struct.h>
#include <condition_struct.h>
#include <system_structs.h>
#include <config.h>
 
/* processus */
struct proc_struct {
  /* tache */
  void *kernel_stack;
  unsigned long *page_directory;
  struct tss_struct tss;
  unsigned short tss_sel;
 
  /* table des processus */
  int id;                               /* identifiant */
  struct proc_struct *proc_table_next;
 
  /* liste */
  struct proc_struct *proc_list_previous;
  struct proc_struct *proc_list_next;
 
  /* genealogie */
  struct proc_struct *parent;
  struct proc_struct *next_sibling;
  struct proc_struct *first_child;
 
  /* groupe */
  struct proc_group_struct *group;
  struct proc_struct *group_next;
 
  int state;                            /* etat */
  union {
    /* processus s'executant en mode utilisateur */
    struct {
      unsigned did_exec : 1;
 
      /* changements d'etat */
      unsigned status_available : 1;
      int status;
      struct condition_struct child_status_available_condition;
    };
  };
  union {
    /* processus non zombie */
    struct {
      struct string_table_struct cmdline; /* ligne de commande */
      union {
        /* processus s'executant en mode utilisateur */
        struct {
          struct file_struct *wd;       /* repertoire de travail */
 
          /* programme */
          struct vm_struct vm;          /* memoire virtuelle */
          unsigned long brk;            /* adresse virtuelle de la fin du segment de donnees */
 
          /* descripteurs de fichiers ouverts */
          struct file_descr_struct *file_descr_table[OPEN_MAX];
 
          /* signaux */
          unsigned system : 1;          /* processus systeme : ne peut recevoir de signaux */
          unsigned long signal;
 
          /* alarme */
          struct alarm_struct alarm;
 
          /* file */
          struct proc_struct *queue_previous;
          struct proc_struct *queue_next;
 
          union {
            /* processus en cours d'execution */
            unsigned interrupted : 1;   /* reprise apres une attente */
            unsigned long unslept;      /* reprise apres un sommeil */
 
            /* processus en attente */
            struct condition_struct *condition;
          };
        };
      };
    };
  };
};
 
/* groupe de processus */
struct proc_group_struct {
  /* table des groupes processus */
  int id;
  struct proc_group_struct *proc_group_table_next;
 
  /* membres */
  struct proc_struct *first_proc; /* jamais nul */
};
 
#endif