View of xos/kernel/current.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 CURRENT_H
#define CURRENT_H
 
#include <current.h>
 
struct proc_struct;
struct proc_group_struct;
struct registers_struct;
struct interrupted_instruction_struct;
struct file_descr_struct;
 
/* nature */
int is_idle();
 
/* attributs */
void change_set_proc_group(struct proc_group_struct *proc_group);
int change_create_proc_group();
int change_wd(const char *fs_path);
 
/* descripteurs de fichiers */
int alloc_fd(int start, struct file_descr_struct *file_descr, int *fd);
void free_fd(int fd);
struct file_descr_struct *get_file_descr(int fd);
 
/* programme */
int exec(const char *fs_filename, char *const fs_argv[], char *const fs_envp[], struct registers_struct *registers, struct interrupted_instruction_struct *interrupted_instruction, int *status);
int sbrk(int increment, unsigned long *brk);
 
/* fils */
int fork(const struct registers_struct *registers, const struct interrupted_instruction_struct *interrupted_instruction);
int is_child(const struct proc_struct *proc);
int change_set_child_proc_group(struct proc_struct *child, struct proc_group_struct *proc_group);
int change_create_child_proc_group(struct proc_struct *child);
int wait(struct proc_struct *child, int *status, int options);
int wait_group_any(struct proc_group_struct *proc_group, int *status, int options);
int wait_any(int *status, int options);
 
/* orphelins */
int is_orphaned_proc_group(const struct proc_group_struct *proc_group);
void reap_orphan_zombies();
 
/* terminaison */
void exit(int code) __attribute__ ((noreturn));
void abort(int sig) __attribute__ ((noreturn));
 
/* divers */
void *memory_map(void *addr, unsigned int len, int prot, int fd, long off);
int memory_unmap(void *addr, unsigned int len);
int memory_protect(void *addr, unsigned int len, int prot);
int handle_page_fault(int cause, int access, unsigned long stack_top, unsigned long laddr);
void yield();
 
#endif