Ramsize could be bigger than size_t to match 32 bit machines with more than 4GTB of ram.
typedef uint64_t ramsize_t
Reads size bytes from file referenced by fileobj into buffer.
int read_file( file_t fileobj, size_t size, /*out*/void * buffer/*[size]*/, size_t * bytes_read )
Reads size bytes from the data stream referenced by ioc into buffer.
int read_iochannel( iochannel_t ioc, size_t size, /*out*/void * buffer/*[size]*/, /*out*/size_t * bytes_read )
Reads bytes from read queue at max maxdata_len bytes.
int read_ipsocket( ipsocket_t * ipsock, size_t maxdata_len, /*out*/uint8_t data[maxdata_len], /*out*/size_t * bytes_read )
Acquires the next buffer from filereader_t if isnext_utf8scanner returns false.
int readbuffer_utf8scanner( utf8scanner_t * scan, struct filereader_t * frd )
Points to last entry in list of waiting readers.
struct { struct slist_node_t * last ; } readers
Same as read_ipsocket but for unconnected (UDP) sockets.
int readfrom_ipsocket( ipsocket_t * ipsock, struct ipaddr_t * remoteaddr, size_t maxdata_len, /*out*/uint8_t data[maxdata_len], /*out*/size_t * bytes_read )
Implements windowconfig_t.readmaxsize_windowconfig.
#define readmaxsize_windowconfig( winconf, attrindex, width, height ) readsize_windowconfig(winconf, attrindex, width, height)
Reads a maxsize attribute value at attrindex in array winconf.
void readmaxsize_windowconfig( const windowconfig_t * winconf, uint_fast8_t * attrindex, /*out*/uint32_t * width, /*out*/uint32_t * height )
Implements windowconfig_t.readminsize_windowconfig.
#define readminsize_windowconfig( winconf, attrindex, width, height ) readsize_windowconfig(winconf, attrindex, width, height)
Reads a minsize attribute value at attrindex in array winconf.
void readminsize_windowconfig( const windowconfig_t * winconf, uint_fast8_t * attrindex, /*out*/uint32_t * width, /*out*/uint32_t * height )
Returns buffer containing the next block of input data.
int readnext_filereader( filereader_t * frd, /*out*/struct stringstream_t * buffer )
Same as read_ipsocket excepts returns additional OOB index.
int readoob_ipsocket( ipsocket_t * ipsock, size_t maxdata_len, /*out*/uint8_t data[maxdata_len], /*out*/size_t * bytes_read, /*out*/size_t * oob_offset )
Implements windowconfig_t.readpos_windowconfig.
#define readpos_windowconfig( winconf, attrindex, x, y ) { *(x) = winconf[(*(attrindex))++].i32; *(y) = winconf[(*(attrindex))++].i32; }
Reads a position attribute value at attrindex in array winconf.
void readpos_windowconfig( const windowconfig_t * winconf, uint_fast8_t * attrindex, /*out*/int32_t * x, /*out*/int32_t * y )
Implements windowconfig_t.readsize_windowconfig.
#define readsize_windowconfig( winconf, attrindex, width, height ) { *(width) = winconf[(*(attrindex))++].u16; *(height) = winconf[(*(attrindex))++].u16; }
Reads a size attribute value at attrindex in array winconf.
void readsize_windowconfig( const windowconfig_t * winconf, uint_fast8_t * attrindex, /*out*/uint32_t * width, /*out*/uint32_t * height )
Implements windowconfig_t.readtitle_windowconfig.
#define readtitle_windowconfig( winconf, attrindex ) (winconf[(*(attrindex))++].str)
Reads a title attribute value at attrindex in array winconf.
const char * readtitle_windowconfig( const windowconfig_t * winconf, uint_fast8_t * attrindex )
Implements windowconfig_t.readtransparency_windowconfig.
#define readtransparency_windowconfig( winconf, attrindex ) (winconf[(*(attrindex))++].u8)
Reads an alpha value at attrindex in array winconf.
uint8_t readtransparency_windowconfig( const windowconfig_t * winconf, uint_fast8_t * attrindex )
Implements windowconfig_t.readtype_windowconfig.
#define readtype_windowconfig( winconf, attrindex ) ((windowconfig_e) winconf[(*(attrindex))++].i32)
Reads the attribute type windowconfig_e at attrindex in array winconf.
windowconfig_e readtype_windowconfig( const windowconfig_t * winconf, uint_fast8_t * attrindex )
Implement sysuser_t.real_sysuser.
#define real_sysuser( sysusr ) ((sysusr)->realuser)
Returns sysuser_id_t of the user which started the process.
sysuser_id_t real_sysuser( sysuser_t * sysusr )
Contains user which started the process.
sysuser_id_t realuser
Searches for a node X with key ‘key’ and makes it the new root of the tree.
static splaytree_node_t * recursivesplay_splaytree( splaytree_t * tree, splaytree_node_t * root, const void * key, uint16_t nodeoffset, typeadapt_t * typeadp )
Static initializer.
#define redblacktree_FREE redblacktree_INIT( 0, typeadapt_member_FREE )
Implements redblacktree_t.redblacktree_IMPLEMENT.
#define redblacktree_IMPLEMENT( _fsuffix, object_t, key_t, nodename ) typedef redblacktree_iterator_t iteratortype##_fsuffix ; typedef object_t * iteratedtype##_fsuffix ; static inline int initfirst##_fsuffix##iterator(redblacktree_iterator_t * iter, redblacktree_t * tree) __attribute__ ((always_inline)) ; static inline int initlast##_fsuffix##iterator(redblacktree_iterator_t * iter, redblacktree_t * tree) __attribute__ ((always_inline)) ; static inline int free##_fsuffix##iterator(redblacktree_iterator_t * iter) __attribute__ ((always_inline)) ; static inline bool next##_fsuffix##iterator(redblacktree_iterator_t * iter, object_t ** node) __attribute__ ((always_inline)) ; static inline bool prev##_fsuffix##iterator(redblacktree_iterator_t * iter, object_t ** node) __attribute__ ((always_inline)) ; static inline void init##_fsuffix(/*out*/redblacktree_t * tree, const typeadapt_member_t * nodeadp) __attribute__ ((always_inline)) ; static inline int free##_fsuffix(redblacktree_t * tree) __attribute__ ((always_inline)) ; static inline void getinistate##_fsuffix(const redblacktree_t * tree, /*out*/object_t ** root, /*out*/typeadapt_member_t * nodeadp) __attribute__ ((always_inline)) ; static inline bool isempty##_fsuffix(const redblacktree_t * tree) __attribute__ ((always_inline)) ; static inline int find##_fsuffix(redblacktree_t * tree, const key_t key, /*out*/object_t ** found_node) __attribute__ ((always_inline)) ; static inline int insert##_fsuffix(redblacktree_t * tree, object_t * new_node) __attribute__ ((always_inline)) ; static inline int remove##_fsuffix(redblacktree_t * tree, object_t * node) __attribute__ ((always_inline)) ; static inline int removenodes##_fsuffix(redblacktree_t * tree) __attribute__ ((always_inline)) ; static inline int invariant##_fsuffix(redblacktree_t * tree) __attribute__ ((always_inline)) ; static inline redblacktree_node_t * asnode##_fsuffix(object_t * object) { static_assert(&((object_t*)0)->nodename == (redblacktree_node_t*)offsetof(object_t, nodename), "correct type") ; return (redblacktree_node_t *) ((uintptr_t)object + offsetof(object_t, nodename)) ; } static inline object_t * asobject##_fsuffix(redblacktree_node_t * node) { return (object_t *) ((uintptr_t)node - offsetof(object_t, nodename)) ; } static inline object_t * asobjectnull##_fsuffix(redblacktree_node_t * node) { return node ? (object_t *) ((uintptr_t)node - offsetof(object_t, nodename)) : 0 ; } static inline void init##_fsuffix(/*out*/redblacktree_t * tree, const typeadapt_member_t * nodeadp) { init_redblacktree(tree, nodeadp) ; } static inline int free##_fsuffix(redblacktree_t * tree) { return free_redblacktree(tree) ; } static inline void getinistate##_fsuffix(const redblacktree_t * tree, /*out*/object_t ** root, /*out*/typeadapt_member_t * nodeadp) { redblacktree_node_t * rootnode ; getinistate_redblacktree(tree, &rootnode, nodeadp) ; *root = asobjectnull##_fsuffix(rootnode) ; } static inline bool isempty##_fsuffix(const redblacktree_t * tree) { return isempty_redblacktree(tree) ; } static inline int find##_fsuffix(redblacktree_t * tree, const key_t key, /*out*/object_t ** found_node) { int err = find_redblacktree(tree, (void*)key, (redblacktree_node_t**)found_node) ; if (err == 0) *found_node = asobject##_fsuffix(*(redblacktree_node_t**)found_node) ; return err ; } static inline int insert##_fsuffix(redblacktree_t * tree, object_t * new_node) { return insert_redblacktree(tree, asnode##_fsuffix(new_node)) ; } static inline int remove##_fsuffix(redblacktree_t * tree, object_t * node) { int err = remove_redblacktree(tree, asnode##_fsuffix(node)) ; return err ; } static inline int removenodes##_fsuffix(redblacktree_t * tree) { return removenodes_redblacktree(tree) ; } static inline int invariant##_fsuffix(redblacktree_t * tree) { return invariant_redblacktree(tree) ; } static inline int initfirst##_fsuffix##iterator(redblacktree_iterator_t * iter, redblacktree_t * tree) { return initfirst_redblacktreeiterator(iter, tree) ; } static inline int initlast##_fsuffix##iterator(redblacktree_iterator_t * iter, redblacktree_t * tree) { return initlast_redblacktreeiterator(iter, tree) ; } static inline int free##_fsuffix##iterator(redblacktree_iterator_t * iter) { return free_redblacktreeiterator(iter) ; } static inline bool next##_fsuffix##iterator(redblacktree_iterator_t * iter, object_t ** node) { bool isNext = next_redblacktreeiterator(iter, (redblacktree_node_t**)node) ; if (isNext) *node = asobject##_fsuffix(*(redblacktree_node_t**)node) ; return isNext ; } static inline bool prev##_fsuffix##iterator(redblacktree_iterator_t * iter, object_t ** node) { bool isNext = prev_redblacktreeiterator(iter, (redblacktree_node_t**)node) ; if (isNext) *node = asobject##_fsuffix(*(redblacktree_node_t**)node) ; return isNext ; }
Adapts interface of redblacktree_t to nodes of type object_t.
void redblacktree_IMPLEMENT( IDNAME _fsuffix, TYPENAME object_t, TYPENAME key_t, IDNAME nodename ) ;
Static initializer.
#define redblacktree_INIT( root, nodeadp ) { root, nodeadp }
Static initializer.
#define redblacktree_iterator_FREE { 0 }
Iterates over elements contained in redblacktree_t.
struct redblacktree_iterator_t
Rename lrptree_node_t into redblacktree_node_t.
typedef struct lrptree_node_t redblacktree_node_t
Object which carries all information to implement a red black tree data type.
struct redblacktree_t
Implements process_stdio_t.redirecterr_processstdio.
#define redirecterr_processstdio( stdfd, error_file ) ((void)((stdfd)->std_err = error_file))
Redirects standard error output to given file.
void redirecterr_processstdio( process_stdio_t * stdfd, sys_iochannel_t error_file )
Implements process_stdio_t.redirectin_processstdio.
#define redirectin_processstdio( stdfd, input_file ) ((void)((stdfd)->std_in = input_file))
Redirects standard input to given file.
void redirectin_processstdio( process_stdio_t * stdfd, sys_iochannel_t input_file )
Implements process_stdio_t.redirectout_processstdio.
#define redirectout_processstdio( stdfd, output_file ) ((void)((stdfd)->std_out = output_file))
Redirects standard output to given file.
void redirectout_processstdio( process_stdio_t * stdfd, sys_iochannel_t output_file )
Redirects one standard channel to read/write from/to a file.
static int redirectstdfd_processstdio2( const process_stdfd2_t * stdfd2, int stdfd, int redirectto_file )
Redirects all 3 standard io channels to read/write from/to a file.
static int redirectstdio_processstdio2( const process_stdfd2_t * stdfd2 )
Adds file descriptor to Linux epoll object.
int registerfd_iopoll( iopoll_t * iopoll, sys_iochannel_t fd, const struct ioevent_t * for_event )
Registers sys_iochannel_t fd and monitors it for ioevent_t.ioevents.
int registerfd_iopoll( iopoll_t * iopoll, sys_iochannel_t fd, const struct ioevent_t * for_event )
Releases the oldest read buffer.
void release_filereader( filereader_t * frd )
Releases previously allocated memory page.
#define RELEASE_PAGECACHE( page ) (releasepage_pagecache(pagecache_maincontext(), (page)))
Der Verbindung des Threads mit dem aktuellen Kontextes wird aufgehoben.
int releasecurrent_eglcontext( struct opengl_display_t * egldisp )
Implements gcontext_t.releasecurrent_gcontext.
#define releasecurrent_gcontext( disp ) releasecurrent_eglcontext(gl_display(disp))
Der Verbindung des Threads mit dem aktuellen Kontextes wird aufgehoben.
int releasecurrent_gcontext( struct display_t * disp )
Releases a single memory page.
int ( * releasepage ) (pagecache_t * pgcache, struct memblock_t * page)
Implements pagecache_t.releasepage_pagecache.
#define releasepage_pagecache( pgcache, page ) ((pgcache).iimpl->releasepage((pgcache).object, (page)))
Calls pgcache->iimpl->releasepage with pgcache->object as first parameter.
int releasepage_pagecache( const pagecache_t pgcache, struct memblock_t * page )
Releases a single memory page.
int releasepage_pagecacheimpl( pagecache_impl_t * pgcache, struct memblock_t * page )
Returns the remaining time until the timer expires the next time.
int remainingtime_systimer( systimer_t timer, struct timevalue_t * remaining_time )
Returns remote ip address of peer in remoteaddr.
int remoteaddr_ipsocket( const ipsocket_t * ipsock, struct ipaddr_t * remoteaddr )
Removes node at position pos.
int remove_arraysf( arraysf_t * array, size_t pos, /*out*/struct arraysf_node_t ** removed_node )
Removes node with key keydata.
int remove_arraystf( arraystf_t * array, size_t size, const uint8_t keydata[size], /*out*/struct arraystf_node_t ** removed_node )
Removes the node from the list.
int remove_dlist( dlist_t * list, struct dlist_node_t * node )
Removes a node from the hash table.
int remove_exthash( exthash_t * htable, exthash_node_t * node )
Removes created file from filesystem.
int remove_file( const char * filepath, struct directory_t * relative_to )
Removes a node if its key equals searchkey.
int remove_patriciatrie( patriciatrie_t * tree, size_t keylength, const uint8_t searchkey[keylength], patriciatrie_node_t ** removed_node )
Removes a node from the tree.
int remove_redblacktree( redblacktree_t * tree, redblacktree_node_t * node )
Removes a node from the tree.
int remove_splaytree( splaytree_t * tree, splaytree_node_t * node, uint16_t nodeoffset, typeadapt_t * typeadp )
Implements syncqueue_t.remove_syncqueue.
#define remove_syncqueue( syncqueue, elem, initmove_elem ) ( __extension__ ({ syncqueue_t * _sq = (syncqueue) ; typeof(elem) _elem = (elem) ; typeof(elem) _lastentry = last_queue( genericcast_queue(_sq), sizeof(*_elem)) ; if (_lastentry && _lastentry != _elem) { (initmove_elem)(_elem, _lastentry) ; } int _err = removelast_queue( genericcast_queue(_sq), sizeof(*_elem)) ; _sq->nrelements -= (_err == 0) ; _err ; }))
Removes elem of type IDNAME from the queue by overwriting it with the last.
int remove_syncqueue( syncqueue_t * syncqueue, IDNAME * elem, void (*initmove_elem)(IDNAME * dest, IDNAME * src) )
Removes the first node in wlist.
int remove_syncwlist( syncwlist_t * wlist, struct syncqueue_t * queue, /*out*/struct syncevent_t * removedevent )
Implements trie_t.remove_trie.
#define remove_trie( trie, keylen, key, uservalue ) (remove2_trie((trie), (keylen), (key), (uservalue), true))
TODO: describe
int remove_trie( trie_t * trie, uint16_t keylen, const uint8_t key[keylen], /*out*/void ** uservalue )
TODO: describe
int remove2_trie( trie_t * trie, uint16_t keylen, const uint8_t key[keylen], /*out*/void ** uservalue, bool islog )
Removes the next node coming after prev_node from the list.
int removeafter_slist( slist_t * list, struct slist_node_t * prev_node, struct slist_node_t ** removed_node )
Implements dlist_t.removeall_dlist with a call to dlist_t.free_dlist.
#define removeall_dlist( list, nodeoffset, typeadp ) (free_dlist((list), (nodeoffset), (typeadp)))
Removes all nodes from the list.
int removeall_dlist( dlist_t * list, uint16_t nodeoffset, struct typeadapt_t * typeadp/*0 = >no free called*/ )
Implements slist_t.removeall_slist with help of slist_t.free_slist.
#define removeall_slist( list, nodeoffset, typeadp ) free_slist((list), (nodeoffset), (typeadp))
Removes all nodes from the list.
int removeall_slist( slist_t * list, uint16_t nodeoffset, struct typeadapt_t * typeadp/*0 = >no free called*/ )
Removes the empty directory with directory_path relative to dir.
int removedirectory_directory( directory_t * dir/*0 = > current working directory*/, const char * directory_path )
Removes the last node if its syncevent_t has not waiting thread.
int removeempty_syncwlist( syncwlist_t * wlist, struct syncqueue_t * queue )
Removes the file with file_path relative to dir.
int removefile_directory( directory_t * dir/*0 = > current working directory*/, const char * file_path )
Removes the first node from the list.
int removefirst_dlist( dlist_t * list, struct dlist_node_t ** removed_node )
Removes nodesize bytes from the first memory page.
int removefirst_queue( queue_t * queue, uint16_t nodesize )
Removes the first element from list.
int removefirst_slist( slist_t * list, struct slist_node_t ** removed_node )
Implements syncqueue_t.removefirst_syncqueue.
#define removefirst_syncqueue( syncqueue, elemsize ) ( __extension__ ({ syncqueue_t * _sq = (syncqueue) ; int _err = removefirst_queue( genericcast_queue(_sq), elemsize) ; _sq->nrelements -= (_err == 0) ; _err ; }))
Removes an element from the queue by freeing syncqueue memory.
int removefirst_syncqueue( syncqueue_t * syncqueue, uint16_t elemsize )
Removes the last node from the list.
int removelast_dlist( dlist_t * list, struct dlist_node_t ** removed_node )
Removes nodesize bytes from the last memory page.
int removelast_queue( queue_t * queue, uint16_t nodesize )
Implements syncqueue_t.removelast_syncqueue.
#define removelast_syncqueue( syncqueue, elemsize ) ( __extension__ ({ syncqueue_t * _sq = (syncqueue) ; int _err = removelast_queue( genericcast_queue(_sq), elemsize) ; _sq->nrelements -= (_err == 0) ; _err ; }))
Removes an element from the queue by freeing syncqueue memory.
int removelast_syncqueue( syncqueue_t * syncqueue, uint16_t elemsize )
Removes all nodes from the hash table.
int removenodes_exthash( exthash_t * htable )
Removes all nodes from the tree.
int removenodes_patriciatrie( patriciatrie_t * tree )
Removes all nodes from the tree.
int removenodes_redblacktree( redblacktree_t * tree )
Removes all nodes from the tree.
int removenodes_splaytree( splaytree_t * tree, uint16_t nodeoffset, typeadapt_t * typeadp )
Removes objectid and its associated pointer from the registration.
int removeobject_x11display( x11display_t * x11disp, uint32_t objectid )
Removes all trailing digits which are 0.
void removetrailingzero_bigint( bigint_t * big )
Replaces old_child of parent with new_child.
static int replacechild_suffixtree( suffixtree_t * tree, suffixtree_node_t * parent, suffixtree_node_t * const old_child, suffixtree_node_t * const new_child )
Removes oldnode from list and replaces it with newnode.
void replacenode_dlist( dlist_t * list, struct dlist_node_t * newnode, struct dlist_node_t * oldnode )
Replaces the object for an already registered objectid.
int replaceobject_x11display( x11display_t * x11disp, struct x11window_t * object, uint32_t objectid )
Sets the locale of all subsystems to default.
int reset_locale( void )
Sets the locale of system messages subsystem to default.
int resetmsg_locale( void )
Resets the the thread id.
void resetthreadid_threadcontext( void )
Allocates memory and sets size to new_size.
int resize_cstring( cstring_t * cstr, size_t new_size )
Resizes memory block with error.
#define RESIZE_ERR_MM( errtimer, newsize, mblock ) ( __extension__ ({ err = process_testerrortimer(errtimer); if (! err) err = RESIZE_MM(newsize, mblock); err ; }))
Resizes memory block.
#define RESIZE_MM( newsize, mblock ) mresize_mm(mm_maincontext(), newsize, mblock)
Implements window_t.resize_window.
#define resize_window( win, width, height ) resize_x11window(os_window(win), width, height)
Changes the size of the window.
int resize_window( window_t * win, uint32_t width, uint32_t height )
Changes the size of the window.
int resize_x11window( x11window_t * x11win, uint32_t width, uint32_t height )
Removes oldsize bytes from the last memory page and add newsize bytes.
int resizelast_queue( queue_t * queue, /*out*/void ** nodeaddr, uint16_t oldsize, uint16_t newsize )
Returns the timer resolution of the underlying clock.
int resolution_sysclock( sysclock_e clock_type, /*out*/struct timevalue_t * resolution )
Static initializer.
#define resourceusage_FREE { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
Stores the number of resources currently in use.
struct resourceusage_t
The thread which is refered by threadobj is woken up.
void resume_thread( thread_t * threadobj )
Implements syncrun_t.retcode_syncrun.
#define retcode_syncrun( srun ) ((srun)->wakeup.retcode)
Returns return code of an exited syncthread_t.
int retcode_syncrun( const syncrun_t * srun )
Either the exit number or signal number.
int returncode
Contains the return value of main_task.
int returncode
Implements thread_t.returncode_thread.
#define returncode_thread( threadobj ) ( __extension__ ({ volatile const thread_t * _thr ; _thr = (threadobj) ; _thr->returncode ; }))
Returns the returncode of the joined thread.
int returncode_thread( const thread_t * threadobj )
Reverses the bits of an integer.
unsigned reversebits_int( unsigned i )
Index into arraysf_t.root.
unsigned ri
Index into arraystf_t.root.
unsigned ri
Points to right subtree.
lrptree_node_t * right
Points to right subtree.
lrtree_node_t * right
Follow right pointer if testet bit at bit_offset is 1.
patriciatrie_node_t * right
Points to top level nodes.
union arraysf_unode_t * root[/*toplevelsize*/]
Points to top level nodes.
union arraystf_unode_t * root[/*toplevelsize*/]
Points to root memory block.
void * root
Points to the root object which has no parent.
redblacktree_node_t * root
Points to the root object which has no parent.
splaytree_node_t * root
Nr of bits to shift right before root key is used to access root.
uint32_t rootidxshift:8
Compares runtime of simple threaded TCP server write/client read versus server splice/client splice.
int run_linuxsplice_speedtest( int argc, const char ** argv )
Compares speed between reading with mmap and reading with mmap + madvise.
int run_madvise_speedtest( int argc, const char ** argv )
Calls every registered unittest of the C-kern(el) system.
int run_unittest( void * argv )
Contains a single syncthread_t and its corresponding exitevent.
struct run2queue_entry_t
Runs all syncthread_t stored in internal queues.
int runall_syncrun( syncrun_t * srun )
Stores information of the current thread and its running state.
struct { struct syncevent_t * laststarted ; struct syncthread_t * thread ; uint8_t state ; } running
Make runqueue_entry_t an alias for syncthread_t.
typedef struct runqueue_entry_t runqueue_entry_t
Static initializer.
#define rwlock_FREE { { 0 } , { 0 }, 0, 0, 0 }
Static initializer.
#define rwlock_INIT { { 0 } , { 0 }, 0, 0, 0 }
Protect a data structure from access of threads of a single process.
struct rwlock_t