Defines the global context of the running system process. The context contains references to global services shared between system threads.
ProcessContext | Defines the global context of the running system process. |
Copyright | This program is free software. |
Files | |
C-kern/ | Header file ProcessContext. |
C-kern/ | Implementation file ProcessContext impl. |
Types | |
struct processcontext_t | Export processcontext_t. |
Functions | |
test | |
unittest_context_processcontext | Test initialization context of whole process succeeds. |
processcontext_t | Defines computing environment / context which is shared between all threads of computation. |
valuecache | Points to global read only variables. |
sysuser | Context for sysuser_t module. |
error | Data for errorcontext_t module. |
error | Shared pagecache_blockmap_t used in pagecache_impl_t. |
initcount | Counts the number of successfull initialized services/subsystems. |
constants | |
processcontext_STATICSIZE | Defines the number of bytes needed from processcontext_t. |
lifetime | |
processcontext_INIT_STATIC | Static initializer. |
init_processcontext | Initializes the current process context. |
free_processcontext | Frees resources associated with processcontext_t. |
query | |
isstatic_processcontext | Returns true if pcontext equals processcontext_INIT_STATIC. |
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 2 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.
© 2012 Jörg Seebohn
Header file ProcessContext.
Implementation file ProcessContext impl.
typedef struct processcontext_t processcontext_t
Export processcontext_t.
test | |
unittest_context_processcontext | Test initialization context of whole process succeeds. |
struct processcontext_t
Defines computing environment / context which is shared between all threads of computation. It contains e.g. services which offfer read only values or services which can be implemented with use of global locks.
valuecache | Points to global read only variables. |
sysuser | Context for sysuser_t module. |
error | Data for errorcontext_t module. |
error | Shared pagecache_blockmap_t used in pagecache_impl_t. |
initcount | Counts the number of successfull initialized services/subsystems. |
constants | |
processcontext_STATICSIZE | Defines the number of bytes needed from processcontext_t. |
lifetime | |
processcontext_INIT_STATIC | Static initializer. |
init_processcontext | Initializes the current process context. |
free_processcontext | Frees resources associated with processcontext_t. |
query | |
isstatic_processcontext | Returns true if pcontext equals processcontext_INIT_STATIC. |
struct sysuser_t * sysuser
Context for sysuser_t module.
struct { uint16_t * stroffset ; uint8_t * strdata ; } error
Data for errorcontext_t module.
Shared pagecache_blockmap_t used in pagecache_impl_t.
uint16_t initcount
Counts the number of successfull initialized services/subsystems. This number is can be higher than 1 cause there are subsystems which do not have a reference stored in processcontext_t.
#define processcontext_STATICSIZE ( sizeof(sysuser_t) + sizeof(valuecache_t) + sizeof(pagecache_blockmap_t) )
Defines the number of bytes needed from processcontext_t. Static memory is allocated in init_processcontext.
int init_processcontext( /*out*/processcontext_t * pcontext )
Initializes the current process context. There is exactly one process context for the whole process. It is shared by all threads. Function is called from maincontext_t.init_maincontext.
int free_processcontext( processcontext_t * pcontext )
Frees resources associated with processcontext_t. This function is called from maincontext_t.free_maincontext and you should never need to call it.
bool isstatic_processcontext( const processcontext_t * pcontext )
Returns true if pcontext equals processcontext_INIT_STATIC.
Export processcontext_t.
typedef struct processcontext_t processcontext_t
Defines computing environment / context which is shared between all threads of computation.
struct processcontext_t
Test initialization context of whole process succeeds.
int unittest_context_processcontext( void )
Points to global read only variables.
struct valuecache_t * valuecache
Context for sysuser_t module.
struct sysuser_t * sysuser
Data for errorcontext_t module.
struct { uint16_t * stroffset ; uint8_t * strdata ; } error
Stores description of system errors in a string table.
struct errorcontext_t
A simple shared hash map which maps an index pagecache_block_t.
struct pagecache_blockmap_t
Allocates and frees virtual memory pages and caches them.
struct pagecache_impl_t
Counts the number of successfull initialized services/subsystems.
uint16_t initcount
Defines the number of bytes needed from processcontext_t.
#define processcontext_STATICSIZE ( sizeof(sysuser_t) + sizeof(valuecache_t) + sizeof(pagecache_blockmap_t) )
Static initializer.
#define processcontext_INIT_STATIC { 0, 0, errorcontext_INIT_STATIC, 0, 0 }
Initializes the current process context.
int init_processcontext( /*out*/processcontext_t * pcontext )
Frees resources associated with processcontext_t.
int free_processcontext( processcontext_t * pcontext )
Returns true if pcontext equals processcontext_INIT_STATIC.
bool isstatic_processcontext( const processcontext_t * pcontext )
Initializes global program context.
int init_maincontext( const maincontext_e context_type, int argc, const char ** argv )
Frees global context.
int free_maincontext( void )