Choco OS  V.0.16.9.0
Join to the chocolate world
oc_process.h
Go to the documentation of this file.
1 
28 #ifndef INC_KERNEL_OC_PROCESS_H_
29 #define INC_KERNEL_OC_PROCESS_H_
30 
31 #include <stdbool.h>
32 #include <stdint.h>
33 #include <oc_thread.h>
34 #include <oc_user.h>
35 #include <oc_stream.h>
36 #include <oc_stdlib.h>
37 
43 #define _________________________________________DEFINITIONS_SECTION________________________________________________________________________
44 
47 #define oC_PROCESS_THREAD_PRIORITY_BITS 28
48 #define oC_PROCESS_PRIORITY_BITS 4
49 
50 #undef _________________________________________DEFINITIONS_SECTION________________________________________________________________________
51 
58 #define _________________________________________TYPES_SECTION______________________________________________________________________________
59 
62 typedef struct Process_t * oC_Process_t;
63 
64 typedef enum
65 {
66  oC_Process_Priority_IdleProcess = 0 << oC_PROCESS_THREAD_PRIORITY_BITS,
67  oC_Process_Priority_UserSpaceProcess = 1 << oC_PROCESS_THREAD_PRIORITY_BITS,
68  oC_Process_Priority_UserSpaceDaemon = 2 << oC_PROCESS_THREAD_PRIORITY_BITS,
69  oC_Process_Priority_CoreSpaceProcess = 4 << oC_PROCESS_THREAD_PRIORITY_BITS,
70  oC_Process_Priority_CoreSpaceDaemon = 5 << oC_PROCESS_THREAD_PRIORITY_BITS,
71  oC_Process_Priority_SystemHelperProcess = 6 << oC_PROCESS_THREAD_PRIORITY_BITS,
72  oC_Process_Priority_SystemHelperDeamon = 7 << oC_PROCESS_THREAD_PRIORITY_BITS,
73  oC_Process_Priority_DefaultProcess = 8 << oC_PROCESS_THREAD_PRIORITY_BITS,
74  oC_Process_Priority_NetworkHandlerProcess = 8 << oC_PROCESS_THREAD_PRIORITY_BITS,
75  oC_Process_Priority_SystemHandlerProcess = 8 << oC_PROCESS_THREAD_PRIORITY_BITS,
76  oC_Process_Priority_SystemHandlerDeamon = 9 << oC_PROCESS_THREAD_PRIORITY_BITS,
77  oC_Process_Priority_SystemSecurityProcess = 10 << oC_PROCESS_THREAD_PRIORITY_BITS,
78  oC_Process_Priority_SystemSecurityDeamon = 11 << oC_PROCESS_THREAD_PRIORITY_BITS,
79 }oC_Process_Priority_t;
80 
81 typedef enum
82 {
83  oC_Process_State_Invalid ,
84  oC_Process_State_Initialized ,
85  oC_Process_State_Run ,
86  oC_Process_State_Asleep ,
87  oC_Process_State_Zombie ,
88  oC_Process_State_Killed
89 } oC_Process_State_t;
90 
91 #undef _________________________________________TYPES_SECTION______________________________________________________________________________
92 
99 #define _________________________________________FUNCTIONS_SECTION__________________________________________________________________________
100 
103 extern oC_Process_t oC_Process_New ( oC_Process_Priority_t Priority , const char * Name , oC_User_t User , oC_UInt_t HeapMapSize , oC_Stream_t InputStream , oC_Stream_t OutputStream , oC_Stream_t ErrorStream );
104 extern bool oC_Process_Delete ( oC_Process_t * Process );
105 extern bool oC_Process_IsCorrect ( oC_Process_t Process );
106 extern bool oC_Process_IsKilled ( oC_Process_t Process );
107 extern bool oC_Process_ContainsThread ( oC_Process_t Process , oC_Thread_t Thread );
108 extern const char * oC_Process_GetName ( oC_Process_t Process );
109 extern oC_Process_State_t oC_Process_GetState ( oC_Process_t Process );
110 extern oC_User_t oC_Process_GetUser ( oC_Process_t Process );
111 extern oC_Stream_t oC_Process_GetInputStream ( oC_Process_t Process );
112 extern oC_Stream_t oC_Process_GetOutputStream ( oC_Process_t Process );
113 extern oC_Stream_t oC_Process_GetErrorStream ( oC_Process_t Process );
114 extern oC_ErrorCode_t oC_Process_SetInputStream ( oC_Process_t Process , oC_Stream_t Stream );
115 extern oC_ErrorCode_t oC_Process_SetOutputStream ( oC_Process_t Process , oC_Stream_t Stream );
116 extern oC_ErrorCode_t oC_Process_SetErrorStream ( oC_Process_t Process , oC_Stream_t Stream );
117 extern oC_ErrorCode_t oC_Process_SetPriority ( oC_Process_t Process , oC_Process_Priority_t Priority );
118 extern oC_Process_Priority_t oC_Process_GetPriority ( oC_Process_t Process );
119 extern oC_ErrorCode_t oC_Process_LockStdioBuffer ( oC_Process_t Process , char ** outStdioBuffer , oC_Time_t Timeout );
120 extern oC_ErrorCode_t oC_Process_UnlockStdioBuffer( oC_Process_t Process );
121 extern bool oC_Process_IsActive ( oC_Process_t Process );
122 extern bool oC_Process_Kill ( oC_Process_t Process );
123 extern Allocator_t oC_Process_GetAllocator ( oC_Process_t Process );
124 extern oC_HeapMap_t oC_Process_GetHeapMap ( oC_Process_t Process );
125 extern oC_ErrorCode_t oC_Process_Sleep ( oC_Process_t Process , oC_Time_t Timeout );
126 extern oC_UInt_t oC_Process_GetHeapMapSize ( oC_Process_t Process );
127 extern oC_UInt_t oC_Process_GetFreeHeapMapSize(oC_Process_t Process );
128 extern oC_UInt_t oC_Process_GetThreadsStackSize(oC_Process_t Process );
129 extern oC_Int_t oC_Process_GetFreeThreadsStackSize(oC_Process_t Process , bool Current );
130 extern oC_Time_t oC_Process_GetExecutionTime ( oC_Process_t Process );
131 extern oC_UInt_t oC_Process_GetUsedRamSize ( oC_Process_t Process );
132 extern oC_IoFlags_t oC_Process_GetIoFlags ( oC_Process_t Process );
133 extern oC_ErrorCode_t oC_Process_SetIoFlags ( oC_Process_t Process , oC_IoFlags_t IoFlags );
134 extern oC_ErrorCode_t oC_Process_WaitForFinish ( oC_Process_t Process , oC_Time_t CheckPeriod, oC_Time_t Timeout );
135 extern char * oC_Process_GetPwd ( oC_Process_t Process );
136 extern oC_ErrorCode_t oC_Process_SetPwd ( oC_Process_t Process , const char * Pwd );
137 extern oC_UInt_t oC_Process_GetPid ( oC_Process_t Process );
138 extern bool oC_Process_SetAllocationLimit( oC_Process_t Process , oC_MemorySize_t Limit );
139 extern bool oC_Process_SetAllocationTracking( oC_Process_t Process, bool Enabled );
140 
141 #undef _________________________________________FUNCTIONS_SECTION__________________________________________________________________________
142 
144 #endif /* INC_KERNEL_OC_PROCESS_H_ */
The file with interface for stream.
The file with interface for thread managing.
identifier for allocations
Definition: oc_stdlib.h:159
Definition: oc_user.c:43
The file with interface for user system.