XenevaOS
Loading...
Searching...
No Matches
Functions
_keproc.h File Reference
#include <stdint.h>
#include <_xeneva.h>
#include <sys\_kesignal.h>
Include dependency graph for _keproc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

XE_LIB int _KePauseThread ()
 _KePauseThread – pause currently running thread
 
XE_LIB uint16_t _KeGetThreadID ()
 _KeGetThreadID – get currently running thread id
 
XE_LIB int _KeGetProcessID ()
 _KeGetProcessID – get currently running process id
 
XE_LIB int _KeProcessExit ()
 _KeProcessExit – exits current process
 
XE_LIB int _KeProcessWaitForTermination (int pid)
 _KeProcessWaitForTermination – suspends currently running process until another process state changes
 
XE_LIB int _KeCreateProcess (int parent_id, char *name)
 _KeCreateProcess – create a new process slot by taking
 
XE_LIB int _KeProcessLoadExec (int proc_id, char *filename, int argc, char **argv)
 _KeProcessLoadExec – loads an executable to a process slot
 
XE_LIB uint64_t _KeGetProcessHeapMem (size_t sz)
 _KeGetProcessHeapMem – Grabs some memory from heap memory of current process slot
 
XE_LIB int _KeProcessSleep (uint64_t ms)
 _KeProcessSleep – put the current process main thread to sleep mode 1s = 10000 ms
 
XE_LIB int _KeSetSignal (int signo, XESigHandler handler)
 _KeSetSignal – register a new signal handler for this process
 
XE_LIB size_t _KeGetSystemTimerTick ()
 _KeGetSystemTimerTick – returns the current system timer tick
 
XE_LIB int _KeCreateThread (void(*entry)(), char *name)
 _KeCreateThread – creates a new thread inside current process slot
 
XE_LIB int _KeSetFileToProcess (int fileno, int dest_fidx, int proc_id)
 _KeSetFileToProcess – copies a file from one process to other
 
XE_LIB int _KeSendSignal (int pid, int signum)
 _KeSendSignal – send a signal to desired process
 
XE_LIB int _KeProcessGetFileDesc (const char *filename)
 
XE_LIB uint64_t _KeGetEnvironmentBlock ()
 _KeGetEnvironmentBlock – returns the current environment block of the process
 

Detailed Description

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.

Function Documentation

◆ _KeCreateProcess()

XE_LIB int _KeCreateProcess ( int  parent_id,
char *  name 
)

_KeCreateProcess – create a new process slot by taking

Parameters
parent_id– process parent id
name– process name
Returns
– process id of newly create process slot

◆ _KeCreateThread()

XE_LIB int _KeCreateThread ( void(*)()  entry,
char *  name 
)

_KeCreateThread – creates a new thread inside current process slot

◆ _KeGetEnvironmentBlock()

XE_LIB uint64_t _KeGetEnvironmentBlock ( )

_KeGetEnvironmentBlock – returns the current environment block of the process

◆ _KeGetProcessHeapMem()

XE_LIB uint64_t _KeGetProcessHeapMem ( size_t  sz)

_KeGetProcessHeapMem – Grabs some memory from heap memory of current process slot

Parameters
sz– size that is needed, should be page-aligned

◆ _KeGetProcessID()

XE_LIB int _KeGetProcessID ( )

_KeGetProcessID – get currently running process id

◆ _KeGetSystemTimerTick()

XE_LIB size_t _KeGetSystemTimerTick ( )

_KeGetSystemTimerTick – returns the current system timer tick

◆ _KeGetThreadID()

XE_LIB uint16_t _KeGetThreadID ( )

_KeGetThreadID – get currently running thread id

◆ _KePauseThread()

XE_LIB int _KePauseThread ( )

_KePauseThread – pause currently running thread

◆ _KeProcessExit()

XE_LIB int _KeProcessExit ( )

_KeProcessExit – exits current process

◆ _KeProcessGetFileDesc()

XE_LIB int _KeProcessGetFileDesc ( const char *  filename)

2brief _KeProcessGetFileDesc – returns file descriptor for given filename

Parameters
filename– name of the file if it's already opened

◆ _KeProcessLoadExec()

XE_LIB int _KeProcessLoadExec ( int  proc_id,
char *  filename,
int  argc,
char **  argv 
)

_KeProcessLoadExec – loads an executable to a process slot

Parameters
proc_id– process slot id
filename– filename of the process
argc– number of arguments
argv– argument array to pass

◆ _KeProcessSleep()

XE_LIB int _KeProcessSleep ( uint64_t  ms)

_KeProcessSleep – put the current process main thread to sleep mode 1s = 10000 ms

Parameters
ms– millisecond to sleep

◆ _KeProcessWaitForTermination()

XE_LIB int _KeProcessWaitForTermination ( int  pid)

_KeProcessWaitForTermination – suspends currently running process until another process state changes

Parameters
pid– process id,-1 for all

◆ _KeSendSignal()

XE_LIB int _KeSendSignal ( int  pid,
int  signum 
)

_KeSendSignal – send a signal to desired process

Parameters
pid– thread id
signum– signal number

◆ _KeSetFileToProcess()

XE_LIB int _KeSetFileToProcess ( int  fileno,
int  dest_fidx,
int  proc_id 
)

_KeSetFileToProcess – copies a file from one process to other

Parameters
fileno– file number of the current process
dest_fdidx– destination process file index
proc_id– destination process id

◆ _KeSetSignal()

XE_LIB int _KeSetSignal ( int  signo,
XESigHandler  handler 
)

_KeSetSignal – register a new signal handler for this process

Parameters
signo– signal number
handler– handler function