XenevaOS
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions
process.h File Reference
#include <stdint.h>
#include <Fs\vfs.h>
#include <list.h>
Include dependency graph for process.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _au_proc_
 

Macros

#define PROCESS_USER_STACK_SZ   512*1024
 
#define MAX_THREADS_PER_PROCESS   60
 
#define FILE_DESC_PER_PROCESS   60
 
#define PROCESS_STATE_NOT_READY   (1<<0)
 
#define PROCESS_STATE_READY   (1<<1)
 
#define PROCESS_STATE_SUSPENDED   (1<<2)
 
#define PROCESS_STATE_DIED   (1<<3)
 
#define PROCESS_STATE_ZOMBIE   (1<<4)
 
#define PROCESS_STATE_ORPHAN   (1<<5)
 
#define PROCESS_STATE_BUSY_WAIT   (1<<6)
 
#define PROCESS_EXIT_SUCCESS   0
 
#define PROCESS_EXIT_FAILURE   1
 
#define PROCESS_TYPE_GENERAL   (0<<1)
 
#define PROCESS_TYPE_SYSTEM   (1<<1)
 
#define PROCESS_TYPE_BACKGROUND   (1<<2)
 
#define PROCESS_TYPE_NON_KILLABLE   (1<<3)
 
#define PROCESS_BREAK_ADDRESS   0x0000003000000000
 

Typedefs

typedef void(* entry) (void *)
 
typedef struct _au_proc_ AuProcess
 

Functions

void AuAddProcess (AuProcess *parent, AuProcess *proc)
 
void AuRemoveProcess (AuProcess *parent, AuProcess *proc)
 
uint64_t CreateKernelStack (AuProcess *proc, uint64_t *cr3)
 
void KernelStackFree (AuProcess *proc, void *ptr, uint64_t *cr3)
 
AuProcessAuProcessFindPID (int pid)
 
uint64_tCreateUserStack (AuProcess *proc, uint64_t *cr3)
 
void AuStartRootProc ()
 
AuProcessAuGetRootProcess ()
 
AuProcessAuCreateProcessSlot (AuProcess *parent, char *name)
 
AuProcessAuProcessFork (AuProcess *parent)
 
void AuProcessExit (AuProcess *proc, bool schedulable)
 
int AuProcessGetFileDesc (AuProcess *proc)
 
void AuProcessWaitForTermination (AuProcess *proc, int pid)
 
int AuCreateUserthread (AuProcess *proc, void(*entry)(), char *name)
 

Macro Definition Documentation

◆ FILE_DESC_PER_PROCESS

#define FILE_DESC_PER_PROCESS   60

◆ MAX_THREADS_PER_PROCESS

#define MAX_THREADS_PER_PROCESS   60

◆ PROCESS_BREAK_ADDRESS

#define PROCESS_BREAK_ADDRESS   0x0000003000000000

◆ PROCESS_EXIT_FAILURE

#define PROCESS_EXIT_FAILURE   1

◆ PROCESS_EXIT_SUCCESS

#define PROCESS_EXIT_SUCCESS   0

◆ PROCESS_STATE_BUSY_WAIT

#define PROCESS_STATE_BUSY_WAIT   (1<<6)

◆ PROCESS_STATE_DIED

#define PROCESS_STATE_DIED   (1<<3)

◆ PROCESS_STATE_NOT_READY

#define PROCESS_STATE_NOT_READY   (1<<0)

◆ PROCESS_STATE_ORPHAN

#define PROCESS_STATE_ORPHAN   (1<<5)

◆ PROCESS_STATE_READY

#define PROCESS_STATE_READY   (1<<1)

◆ PROCESS_STATE_SUSPENDED

#define PROCESS_STATE_SUSPENDED   (1<<2)

◆ PROCESS_STATE_ZOMBIE

#define PROCESS_STATE_ZOMBIE   (1<<4)

◆ PROCESS_TYPE_BACKGROUND

#define PROCESS_TYPE_BACKGROUND   (1<<2)

◆ PROCESS_TYPE_GENERAL

#define PROCESS_TYPE_GENERAL   (0<<1)

◆ PROCESS_TYPE_NON_KILLABLE

#define PROCESS_TYPE_NON_KILLABLE   (1<<3)

◆ PROCESS_TYPE_SYSTEM

#define PROCESS_TYPE_SYSTEM   (1<<1)

◆ PROCESS_USER_STACK_SZ

#define PROCESS_USER_STACK_SZ   512*1024

BSD 2-Clause License

Copyright (c) 2022-2023, Manas Kamal Choudhury All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Typedef Documentation

◆ AuProcess

typedef struct _au_proc_ AuProcess

◆ entry

typedef void(* entry) (void *)

Function Documentation

◆ AuAddProcess()

void AuAddProcess ( AuProcess parent,
AuProcess proc 
)
extern

◆ AuCreateProcessSlot()

AuProcess * AuCreateProcessSlot ( AuProcess parent,
char *  name 
)
extern

◆ AuCreateUserthread()

int AuCreateUserthread ( AuProcess proc,
void(*)()  entry,
char *  name 
)
extern

Creates a user mode thread

Parameters
entry– Entry point address
stack– Stack address
cr3– the top most page map level address
name– name of the thread
priority– (currently unused) thread's priority

◆ AuGetRootProcess()

AuProcess * AuGetRootProcess ( )
extern

◆ AuProcessExit()

void AuProcessExit ( AuProcess proc,
bool  schedulable 
)
extern

◆ AuProcessFindPID()

AuProcess * AuProcessFindPID ( int  pid)
extern

◆ AuProcessFork()

AuProcess * AuProcessFork ( AuProcess parent)
extern

◆ AuProcessGetFileDesc()

int AuProcessGetFileDesc ( AuProcess proc)
extern

◆ AuProcessWaitForTermination()

void AuProcessWaitForTermination ( AuProcess proc,
int  pid 
)
extern

◆ AuRemoveProcess()

void AuRemoveProcess ( AuProcess parent,
AuProcess proc 
)
extern

◆ AuStartRootProc()

void AuStartRootProc ( )
extern

◆ CreateKernelStack()

uint64_t CreateKernelStack ( AuProcess proc,
uint64_t cr3 
)
extern

◆ CreateUserStack()

uint64_t * CreateUserStack ( AuProcess proc,
uint64_t cr3 
)
extern

◆ KernelStackFree()

void KernelStackFree ( AuProcess proc,
void *  ptr,
uint64_t cr3 
)
extern