VSF Documented
vsf_linux.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 * *
16 ****************************************************************************/
17
18#ifndef __VSF_LINUX_INTERNAL_H__
19#define __VSF_LINUX_INTERNAL_H__
20
21/*============================ INCLUDES ======================================*/
22
23// avoid to include vsf.h, include necessary headers only
24//#include "vsf.h"
25
26#include "kernel/vsf_kernel.h"
27
28#include "./vsf_linux_cfg.h"
29
30#if VSF_USE_LINUX == ENABLED
31
32#if VSF_LINUX_CFG_RELATIVE_PATH == ENABLED
33# include "./include/signal.h"
34# include "./include/dirent.h"
35# include "./include/termios.h"
36# include "./include/sys/time.h"
37#else
38# include <signal.h>
39# include <dirent.h>
40# include <termios.h>
41# include <sys/time.h>
42#endif
43
45
46#if defined(__VSF_LINUX_CLASS_IMPLEMENT)
47# define __VSF_CLASS_IMPLEMENT__
48#elif defined(__VSF_LINUX_CLASS_INHERIT__)
49# define __VSF_CLASS_INHERIT__
50#endif
51
52#include "utilities/ooc_class.h"
53
54#ifdef __cplusplus
55extern "C" {
56#endif
57
58/*============================ MACROS ========================================*/
59
60#if VSF_KERNEL_CFG_EDA_SUPPORT_ON_TERMINATE != ENABLED
61# error VSF_KERNEL_CFG_EDA_SUPPORT_ON_TERMINATE MUST be enabled to use vsf_linux
62#endif
63
64#if VSF_USE_SIMPLE_STREAM != ENABLED
65# error VSF_USE_SIMPLE_STREAM MUST be enabled to use vsf_linux
66#endif
67
68#if VSF_USE_HEAP != ENABLED
69# error VSF_USE_HEAP MUST be enabled to use vsf_linux
70#endif
71
72#ifndef VSF_LINUX_CFG_STACKSIZE
73# if defined(VSF_KERNEL_CFG_THREAD_STACK_PAGE_SIZE) && defined(VSF_KERNEL_CFG_THREAD_STACK_GUARDIAN_SIZE)
74# if (VSF_KERNEL_CFG_THREAD_STACK_PAGE_SIZE + VSF_KERNEL_CFG_THREAD_STACK_GUARDIAN_SIZE) < 1024
75# define VSF_LINUX_CFG_STACKSIZE 1024
76# else
77# define VSF_LINUX_CFG_STACKSIZE (VSF_KERNEL_CFG_THREAD_STACK_PAGE_SIZE + VSF_KERNEL_CFG_THREAD_STACK_GUARDIAN_SIZE)
78# endif
79# else
80# define VSF_LINUX_CFG_STACKSIZE 1024
81# endif
82#endif
83#if VSF_LINUX_CFG_STACKSIZE > 0xFFFF
84# if VSF_KERNEL_CFG_THREAD_STACK_LARGE != ENABLED
85# error stacks should be 16-bit if VSF_KERNEL_CFG_THREAD_STACK_LARGE is not enabled
86# endif
87#endif
88#if (VSF_LINUX_CFG_STACKSIZE < (VSF_KERNEL_CFG_THREAD_STACK_PAGE_SIZE + VSF_KERNEL_CFG_THREAD_STACK_GUARDIAN_SIZE))\
89 || (VSF_LINUX_CFG_STACKSIZE & (VSF_KERNEL_CFG_THREAD_STACK_PAGE_SIZE - 1))
90# error invalid VSF_LINUX_CFG_STACKSIZE
91#endif
92
93/*============================ MACROFIED FUNCTIONS ===========================*/
94
95#define vsf_linux_thread_get_priv(__thread) (void *)(&(((vsf_linux_thread_t *)(__thread))[1]))
96
97/*============================ TYPES =========================================*/
98
99// linux kernel events
100
101enum {
104};
105
108
110 int argc;
111 char const **argv;
113
114typedef int (*vsf_linux_main_entry_t)(int, char **);
116
117typedef struct vsf_linux_thread_op_t {
119 void (*on_run)(vsf_thread_cb_t *cb);
122
127
128typedef struct vsf_linux_key_t {
132
133#if VSF_LINUX_CFG_PLS_NUM > 0 || VSF_LINUX_CFG_TLS_NUM > 0
134typedef struct vsf_linux_localstorage_t {
135 void *data;
136 void (*destructor)(void *data);
137} vsf_linux_localstorage_t;
138
139typedef struct vsf_linux_dynlib_mod_t {
140 int *lib_idx;
141 uint16_t mod_idx;
142 uint16_t module_num;
143 uint32_t bss_size;
144 uint32_t mod_size;
145 void (*init)(void *ctx);
146} vsf_linux_dynlib_mod_t;
147
148typedef struct vsf_linux_dynlib_t {
149 uint16_t module_num;
150 uint32_t bss_size;
151 uint32_t bss_brk;
152 int * lib_idx;
153 // just make iar happy, which does not support zla
154 void * modules[1];
155} vsf_linux_dynlib_t;
156#endif
157
159 public_member(
160 implement(vsf_trig_t)
161 )
162#if VSF_LINUX_CFG_SUPPORT_SIG == ENABLED
163 private_member(
164 vsf_dlist_node_t node;
165 vsf_linux_process_t *pending_process;
166 int sig;
167 )
168#endif
169};
170
171#if VSF_LINUX_CFG_PLS_NUM > 0
172dcl_vsf_bitmap(vsf_linux_pls_bitmap, VSF_LINUX_CFG_PLS_NUM);
173#endif
174
175#if VSF_LINUX_CFG_TLS_NUM > 0
176dcl_vsf_bitmap(vsf_linux_tls_bitmap, VSF_LINUX_CFG_TLS_NUM);
177#endif
178
180 public_member(
181 implement(vsf_thread_t)
182 implement(vsf_thread_cb_t)
183 const vsf_linux_thread_op_t *op;
184
185 int __errno;
186 // for gethostbyname, etc
187 int __h_errno;
189
190 protected_member(
191 pid_t pid_exited; // used in wait
192 int retval;
193 pid_t tid;
194 vsf_linux_thread_t *thread_pending;
195#if VSF_LINUX_CFG_SUPPORT_SIG == ENABLED
196 vsf_linux_trigger_t *trigger_pending;
197#endif
198#if VSF_LINUX_CFG_TLS_NUM > 0
199 vsf_linux_localstorage_t tls[VSF_LINUX_CFG_TLS_NUM];
200#endif
201#if VSF_ARCH_USE_THREAD_REG == ENABLED \
202 && VSF_LINUX_USE_SIMPLE_LIBC == ENABLED && VSF_LINUX_USE_SIMPLE_STDLIB == ENABLED\
203 && VSF_LINUX_APPLET_USE_LIBC_STDLIB == ENABLED && !defined(__VSF_APPLET__)
204 union {
205 // used to save compar parameter for bsearch and qsort
206 void *tmp_ptr;
207 } process_reg_backup;
208#endif
209 char name[16];
211
212 private_member(
213 vsf_linux_process_t *process;
214 vsf_dlist_node_t thread_node;
215 union {
216 struct {
217 unsigned short wantval;
218 } sem;
219 } func_priv;
221};
222
228 union {
230 void (*sigaction_handler)(int, siginfo_t *, void *);
231 };
233
239
240#if VSF_KERNEL_CFG_EDA_SUPPORT_TIMER == ENABLED
241typedef struct vsf_linux_timer_t {
243 struct sigevent evt;
248#endif
249
251
252#if VSF_LINUX_USE_SIMPLE_LIBC == ENABLED && VSF_LINUX_USE_SIMPLE_STDLIB == ENABLED\
253 && VSF_LINUX_SIMPLE_STDLIB_CFG_HEAP_MONITOR == ENABLED
254
255typedef struct vsf_liunx_heap_node_t {
257
258 void *ptr;
259 size_t size;
260
261#if VSF_LINUX_SIMPLE_STDLIB_CFG_HEAP_MONITOR_TRACE_CALLER == ENABLED
262 int line;
263 const char *file;
264 const char *func;
265#endif
267
269 size_t usage;
270# if VSF_LINUX_SIMPLE_STDLIB_HEAP_MONITOR_MAX == ENABLED
271 size_t max_usage;
272# endif
276#endif
277
279 public_member(
281
282#if VSF_LINUX_LIBC_USE_ENVIRON == ENABLED
283 char **__environ;
284#endif
285#if VSF_LINUX_USE_VFORK == ENABLED
286 jmp_buf __vfork_jmpbuf;
287#endif
289
290 protected_member(
291#if VSF_ARCH_USE_THREAD_REG == ENABLED
293#endif
294 int status;
295 int exit_status;
296 vsf_linux_process_t *shell_process;
297 // thread pending child process
298 vsf_linux_thread_t *thread_pending_child;
299 struct {
300 pid_t pid;
301 pid_t ppid;
302 pid_t gid;
303 } id;
304#if VSF_KERNEL_CFG_EDA_SUPPORT_TIMER == ENABLED
306#endif
307
308#if VSF_LINUX_USE_SIMPLE_LIBC == ENABLED && VSF_LINUX_USE_SIMPLE_STDLIB == ENABLED\
309 && VSF_LINUX_SIMPLE_STDLIB_CFG_HEAP_MONITOR == ENABLED
310 vsf_linux_heap_monitor_t heap_monitor;
311#endif
312 int fn_atexit_num;
313 void (*fn_atexit[VSF_LINUX_CFG_ATEXIT_NUM])(void);
314
315 char *working_dir;
316#define __VSF_LINUX_PROCESS_HAS_PATH (VSF_LINUX_USE_PROCFS == ENABLED || VSF_LINUX_USE_APPLET == ENABLED || VSF_LINUX_USE_SCRIPT == ENABLED)
317#if __VSF_LINUX_PROCESS_HAS_PATH
318 char path[PATH_MAX];
319#endif
320
321#if VSF_USE_LOADER == ENABLED
322 void *loader;
323#endif
324 )
325
326 private_member(
327 vsf_dlist_node_t process_node;
328 vsf_dlist_t thread_list;
329 vsf_dlist_t fd_list;
330 // thread pending this process
331 vsf_linux_thread_t *thread_pending;
332 vsf_bitmap(vsf_linux_fd_bitmap) fd_bitmap;
333
334 struct {
335 sigset_t pending;
336 sigset_t mask;
337#if VSF_LINUX_CFG_SUPPORT_SIG == ENABLED
338 vsf_dlist_t handler_list;
339 vsf_dlist_t trigger_list;
340#endif
341 } sig;
342
343 vsf_prio_t prio;
344
345 vsf_linux_thread_t *thread_pending_exit;
346 vsf_linux_process_t *parent_process;
347 vsf_dlist_t child_list;
348 vsf_dlist_node_t child_node;
349
350 vsf_heap_t *heap;
351#if VSF_LINUX_USE_VFORK == ENABLED
352 vsf_linux_process_t *vfork_child;
353 bool is_vforking;
354#endif
355#if VSF_LINUX_CFG_PLS_NUM > 0
356 struct {
357 vsf_bitmap(vsf_linux_pls_bitmap) dynlib_bitmap;
358 vsf_linux_localstorage_t storage[VSF_LINUX_CFG_PLS_NUM];
359 } pls;
360#endif
361
362#if VSF_LINUX_CFG_TLS_NUM > 0
363 struct {
364 vsf_bitmap(vsf_linux_tls_bitmap) bitmap;
365 } tls;
366#endif
368};
369
370/*============================ GLOBAL VARIABLES ==============================*/
371/*============================ LOCAL VARIABLES ===============================*/
372/*============================ PROTOTYPES ====================================*/
373
374#if VSF_LINUX_USE_APPLET == ENABLED
377
378#if VSF_LINUX_CFG_PLS_NUM > 0
379 VSF_APPLET_VPLT_ENTRY_FUNC_DEF(vsf_linux_dynlib_ctx_get);
380 VSF_APPLET_VPLT_ENTRY_FUNC_DEF(vsf_linux_dynlib_ctx_set);
381#endif
382
386# ifndef __VSF_APPLET__
388# endif
389#endif
390
391#if defined(__VSF_APPLET__) && (defined(__VSF_APPLET_LIB__) || defined(__VSF_APPLET_LINUX_FUNDMENTAL_LIB__))\
392 && VSF_APPLET_CFG_ABI_PATCH != ENABLED && VSF_LINUX_USE_APPLET == ENABLED
393
394#ifndef VSF_LINUX_APPLET_FUNDMENTAL_VPLT
395# if VSF_LINUX_USE_APPLET == ENABLED
396# define VSF_LINUX_APPLET_FUNDMENTAL_VPLT \
397 ((vsf_linux_fundmental_vplt_t *)(VSF_LINUX_APPLET_VPLT->fundmental_vplt))
398# else
399# define VSF_LINUX_APPLET_FUNDMENTAL_VPLT \
400 ((vsf_linux_fundmental_vplt_t *)vsf_vplt((void *)0))
401# endif
402#endif
403
404#define VSF_LINUX_APPLET_FUNDMENTAL_ENTRY(__NAME) \
405 VSF_APPLET_VPLT_ENTRY_FUNC_ENTRY(VSF_LINUX_APPLET_FUNDMENTAL_VPLT, __NAME)
406#define VSF_LINUX_APPLET_FUNDMENTAL_IMP(...) \
407 VSF_APPLET_VPLT_ENTRY_FUNC_IMP(VSF_LINUX_APPLET_FUNDMENTAL_VPLT, __VA_ARGS__)
408
409#if VSF_LINUX_CFG_PLS_NUM > 0
410VSF_LINUX_APPLET_FUNDMENTAL_IMP(vsf_linux_dynlib_ctx_get, void *, const vsf_linux_dynlib_mod_t *mod) {
412 return VSF_LINUX_APPLET_FUNDMENTAL_ENTRY(vsf_linux_dynlib_ctx_get)(mod);
413}
414VSF_LINUX_APPLET_FUNDMENTAL_IMP(vsf_linux_dynlib_ctx_set, int, const vsf_linux_dynlib_mod_t *mod, void *ctx) {
416 return VSF_LINUX_APPLET_FUNDMENTAL_ENTRY(vsf_linux_dynlib_ctx_set)(mod, ctx);
417}
418#endif
419
420VSF_LINUX_APPLET_FUNDMENTAL_IMP(vsf_linux_get_cur_process, vsf_linux_process_t *, void) {
422 return VSF_LINUX_APPLET_FUNDMENTAL_ENTRY(vsf_linux_get_cur_process)();
423}
424# if VSF_USE_LOADER == ENABLED
425VSF_LINUX_APPLET_FUNDMENTAL_IMP(vsf_linux_loader_keep_ram, void, void) {
427 VSF_LINUX_APPLET_FUNDMENTAL_ENTRY(vsf_linux_loader_keep_ram)();
428}
429# endif
430
431#else
432
433#if VSF_LINUX_CFG_PLS_NUM > 0
434extern void * vsf_linux_dynlib_ctx_get(const vsf_linux_dynlib_mod_t *mod);
435extern int vsf_linux_dynlib_ctx_set(const vsf_linux_dynlib_mod_t *mod, void *ctx);
436
437// for backward compatibility
438#define vsf_linux_dynlib_ctx vsf_linux_dynlib_ctx_get
439#endif
440
441// open vsf_linux_get_cur_process for process-related variables like optarg, etc
443# if VSF_USE_LOADER == ENABLED
444extern void vsf_linux_loader_keep_ram(void);
445# endif
446
447#endif
448
449// IMPORTANT: priority of stdio_stream MUST be within scheduler priorities
451
453
454// used for dynamic libraries, allocate/free memory from resources_process
456
457extern size_t vsf_linux_process_heap_size(vsf_linux_process_t *process, void *buffer);
458extern void * vsf_linux_process_heap_realloc(vsf_linux_process_t *process, void *buffer, uint_fast32_t size);
460extern void * vsf_linux_process_heap_malloc(vsf_linux_process_t *process, size_t size);
461extern void * vsf_linux_process_heap_calloc(vsf_linux_process_t *process, size_t n, size_t size);
462extern void vsf_linux_process_heap_free(vsf_linux_process_t *process, void *buffer);
463extern char * vsf_linux_process_heap_strdup(vsf_linux_process_t *process, char *str);
464
465#if VSF_LINUX_SIMPLE_STDLIB_CFG_HEAP_MONITOR == ENABLED
466extern void __free_ex(vsf_linux_process_t *process, void *ptr);
467# if VSF_LINUX_SIMPLE_STDLIB_CFG_HEAP_MONITOR_TRACE_CALLER == ENABLED
468# define __malloc_ex(__process, __size) ____malloc_ex((__process), (__size), __FILE__, __FUNCTION__, __LINE__)
469# define __calloc_ex(__process, __n, __size) ____calloc_ex((__process), (__n), (__size), __FILE__, __FUNCTION__, __LINE__)
470# define __realloc_ex(__process, __ptr, __size) ____realloc_ex((__process), (__ptr), (__size), __FILE__, __FUNCTION__, __LINE__)
471# define __strdup_ex(__process, __str) ____strdup_ex((__process), (char *)(__str), __FILE__, __FUNCTION__, __LINE__)
472# else
473# define __malloc_ex(__process, __size) ____malloc_ex((__process), (__size), NULL, NULL, 0)
474# define __calloc_ex(__process, __n, __size) ____calloc_ex((__process), (__n), (__size), NULL, NULL, 0)
475# define __realloc_ex(__process, __ptr, __size) ____realloc_ex((__process), (__ptr), (__size), NULL, NULL, 0)
476# define __strdup_ex(__process, __str) ____strdup_ex((__process), (char *)(__str), NULL, NULL, 0)
477# endif
478#else
479# define __malloc_ex(__process, __size) vsf_linux_process_heap_malloc((__process), (__size))
480# define __calloc_ex(__process, __n, __size) vsf_linux_process_heap_calloc((__process), (__n), (__size))
481# define __free_ex(__process, __ptr) vsf_linux_process_heap_free((__process), (__ptr))
482# define __realloc_ex(__process, __ptr, __size) vsf_linux_process_heap_realloc((__process), (__ptr), (__size))
483# define __strdup_ex(__process, __str) vsf_linux_process_heap_strdup((__process), (char *)(__str))
484#endif
485
487extern void * vsf_linux_malloc_res(size_t size);
488extern void vsf_linux_free_res(void *ptr);
489
490extern int vsf_linux_generate_path(char *path_out, int path_out_lenlen, char *dir, char *path_in);
491extern int vsf_linux_chdir(vsf_linux_process_t *process, char *working_dir);
492
494extern int vsf_linux_fs_bind_executable(char *path, vsf_linux_main_entry_t entry);
495
496extern int vsf_linux_expandenv(const char *str, char *output, size_t bufflen);
497
498#if VSF_LINUX_CFG_PLS_NUM > 0
499extern vsf_err_t vsf_linux_library_init(int *lib_idx, void *lib_ctx, void (*destructor)(void *));
500extern void * vsf_linux_library_ctx(int lib_idx);
501
502extern vsf_err_t vsf_linux_dynlib_init(int *lib_idx, int module_num, int bss_size);
503#endif
504
505// pls(process local storage) is open to user
506#if VSF_LINUX_CFG_PLS_NUM > 0
507extern int vsf_linux_pls_alloc(void);
508extern void vsf_linux_pls_free(int idx);
509extern vsf_linux_localstorage_t * vsf_linux_pls_get(int idx);
510#endif
511
512#if defined(__VSF_LINUX_CLASS_IMPLEMENT) || defined(__VSF_LINUX_CLASS_INHERIT__)
513# if VSF_LINUX_CFG_TLS_NUM > 0
514extern int vsf_linux_tls_alloc(void (*destructor)(void *));
515extern void vsf_linux_tls_free(int idx);
516extern vsf_linux_localstorage_t * vsf_linux_tls_get(int idx);
517# endif
518
519extern bool vsf_linux_is_inited(void);
520// will get vfork_child is current process is vforking
522
523#define __vsf_linux_start_process_internal3(__entry, __argv, __stack_size, __prio)\
524 __vsf_linux_start_process_internal((__entry), (__argv), (__stack_size), (__prio))
525#define __vsf_linux_start_process_internal2(__entry, __argv, __stack_size) \
526 __vsf_linux_start_process_internal3((__entry), (__argv), (__stack_size), VSF_LINUX_CFG_PRIO_LOWEST)
527#define __vsf_linux_start_process_internal1(__entry, __argv) \
528 __vsf_linux_start_process_internal2((__entry), (__argv), 0)
529#define __vsf_linux_start_process_internal0(__entry) \
530 __vsf_linux_start_process_internal1(__entry, NULL)
531// prototype: vsf_linux_process_t * vsf_linux_start_process_internal(vsf_linux_main_entry_t *entry,
532// char * const * argv = NULL, int stack_size = 0, vsf_prio_t prio = VSF_LINUX_CFG_PRIO_LOWEST);
533#define vsf_linux_start_process_internal(__entry, ...) \
534 __PLOOC_EVAL(__vsf_linux_start_process_internal, __VA_ARGS__)((__entry), ##__VA_ARGS__)
536 vsf_linux_main_entry_t entry, char * const * argv, int stack_size, vsf_prio_t prio);
537
538extern vsf_linux_main_entry_t * vsf_linux_fd_get_executable(int fd);
539extern int vsf_linux_fs_get_executable(const char *pathname, vsf_linux_main_entry_t *entry);
540
541// delete unstarted/existed process
542extern vsf_linux_process_t * vsf_linux_create_process(int stack_size, int heap_size, int priv_size);
545extern VSF_CAL_NO_RETURN void vsf_linux_exit_process(int status, bool _exit);
546#if VSF_ARCH_USE_THREAD_REG == ENABLED
548#endif
549
553extern int vsf_linux_wait_thread(int tid, int *retval);
554
556 const vsf_linux_thread_op_t *op,
557 int stack_size, void *stack);
558extern int vsf_linux_start_thread(vsf_linux_thread_t *thread, vsf_prio_t priority);
559
561extern vsf_linux_thread_t * vsf_linux_get_thread(pid_t pid, int tid);
563
565extern int __vsf_linux_process_parse_arg(vsf_linux_process_t *process, vsf_linux_process_arg_t *arg, char * const * argv);
566
567extern int vsf_linux_merge_env(vsf_linux_process_t *process, char **env);
568extern void vsf_linux_free_env(vsf_linux_process_t *process);
569
571// return value:
572// < 0 : triggered by signals, returns the minus signal
573// 0 : triggered normally
574// > 0 : triggered because of timeout
577#endif
578
579// open vsf_linux_get_cur_thread for thread-related variables like errno, etc
581
582extern int vsf_linux_get_errno(void);
583extern void vsf_linux_set_errno(int err);
584
585#ifdef __cplusplus
586}
587#endif
588
589#undef __VSF_LINUX_CLASS_IMPLEMENT
590#undef __VSF_LINUX_CLASS_INHERIT__
591
592#endif // VSF_USE_LINUX
593#endif // __VSF_LINUX_INTERNAL_H__
594/* EOF */
#define ENABLED
Definition __type.h:28
vsf_err_t
Definition __type.h:42
Definition vsf_eda.h:848
Definition vsf_eda.h:766
Definition vsf_heap.h:114
Definition vsf_linux.h:278
Definition vsf_linux.h:179
Definition vsf_linux.h:158
Definition vsf_simple_stream.h:254
Definition vsf_eda.h:864
uint64_t vsf_systimer_tick_t
Definition cortex_a_generic.h:73
struct ieee80211_ext_chansw_ie data
Definition ieee80211.h:80
__le16 timeout
Definition ieee80211.h:94
int pid_t
Definition types.h:85
int key_t
Definition types.h:84
#define PATH_MAX
Definition limits.h:11
unsigned short uint16_t
Definition lvgl.h:41
unsigned int uint32_t
Definition lvgl.h:43
unsigned char uint8_t
Definition lvgl.h:40
#define vsf_dcl_class
Definition ooc_class.h:46
#define vsf_class(__name)
Definition ooc_class.h:48
void(* sighandler_t)(int)
Definition signal.h:40
uint32_t uintptr_t
Definition stdint.h:38
unsigned int uint_fast32_t
Definition stdint.h:27
Definition time.h:71
Definition signal.h:57
Definition signal.h:67
Definition signal.h:131
Definition vsf_list.h:888
Definition vsf_list.h:883
Definition vsf_linux.h:375
vsf_vplt_info_t info
Definition vsf_linux.h:376
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(vsf_linux_get_cur_process)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(vsf_linux_loader_keep_ram)
Definition vsf_linux.h:268
vsf_dlist_t list
Definition vsf_linux.h:274
size_t usage
Definition vsf_linux.h:269
size_t max_usage
Definition vsf_linux.h:271
int balance
Definition vsf_linux.h:273
Definition vsf_linux.h:128
vsf_dlist_node_t node
Definition vsf_linux.h:129
key_t key
Definition vsf_linux.h:130
Definition vsf_linux.h:109
int argc
Definition vsf_linux.h:110
char const ** argv
Definition vsf_linux.h:111
Definition vsf_linux.h:123
vsf_linux_process_arg_t arg
Definition vsf_linux.h:124
vsf_linux_main_entry_t entry
Definition vsf_linux.h:125
Definition vsf_linux.h:223
void(* sigaction_handler)(int, siginfo_t *, void *)
Definition vsf_linux.h:230
vsf_dlist_node_t node
Definition vsf_linux.h:224
uint8_t sig
Definition vsf_linux.h:225
sighandler_t sighandler
Definition vsf_linux.h:229
sigset_t mask
Definition vsf_linux.h:227
uint32_t flags
Definition vsf_linux.h:226
Definition vsf_linux.h:234
vsf_stream_t * err
Definition vsf_linux.h:237
vsf_stream_t * out
Definition vsf_linux.h:236
vsf_stream_t * in
Definition vsf_linux.h:235
Definition vsf_linux.h:117
void(* on_run)(vsf_thread_cb_t *cb)
Definition vsf_linux.h:119
int priv_size
Definition vsf_linux.h:118
void(* on_terminate)(vsf_linux_thread_t *thread)
Definition vsf_linux.h:120
Definition vsf_linux.h:241
int overrun
Definition vsf_linux.h:244
struct itimerspec value
Definition vsf_linux.h:242
vsf_systimer_tick_t start
Definition vsf_linux.h:246
vsf_callback_timer_t timer
Definition vsf_linux.h:245
struct sigevent evt
Definition vsf_linux.h:243
Definition vsf_linux.h:255
const char * file
Definition vsf_linux.h:263
int line
Definition vsf_linux.h:262
size_t size
Definition vsf_linux.h:259
vsf_dlist_node_t node
Definition vsf_linux.h:256
const char * func
Definition vsf_linux.h:264
void * ptr
Definition vsf_linux.h:258
@ ITIMER_NUM
Definition time.h:39
class vsf_$ * reg
Definition vsf_cfg.h:95
#define _exit
Definition unistd.h:91
#define dcl_vsf_bitmap(__name, __bit_size)
Definition vsf_bitmap.h:98
#define vsf_bitmap(__name)
Definition vsf_bitmap.h:93
#define VSF_APPLET_VPLT_ENTRY_FUNC_DEF(__NAME)
Definition vsf_cfg.h:156
#define __VSF_VPLT_DECORATOR__
Definition vsf_cfg.h:93
#define VSF_APPLET_VPLT_ENTRY_FUNC_TRACE()
Definition vsf_cfg.h:165
@ VSF_EVT_USER
Definition vsf_eda.h:621
VSF_KERNEL_TIMEOUT_TICK_T vsf_timeout_tick_t
Definition vsf_eda.h:592
uint_fast32_t alignment
Definition vsf_heap.h:135
vsf_prio_t
Definition vsf_kernel_common.h:37
uintptr_t vsf_linux_set_process_reg(uintptr_t reg)
Definition vsf_linux.c:1577
int vsf_linux_trigger_signal(vsf_linux_trigger_t *trig, int sig)
Definition vsf_linux.c:694
int vsf_linux_start_process(vsf_linux_process_t *process)
Definition vsf_linux.c:1371
VSF_CAL_NO_RETURN void vsf_linux_exit_process(int status, bool _exit)
Definition vsf_linux.c:1455
vsf_linux_process_t * vsf_linux_create_process(int stack_size, int heap_size, int priv_size)
Definition vsf_linux.c:1341
int vsf_linux_trigger_pend(vsf_linux_trigger_t *trig, vsf_timeout_tick_t timeout)
Definition vsf_linux.c:714
void vsf_linux_cleanup_process(vsf_linux_process_t *process)
Definition vsf_linux.c:1380
void vsf_linux_thread_on_terminate(vsf_linux_thread_t *thread)
Definition vsf_linux.c:1812
vsf_linux_process_t * __vsf_linux_start_process_internal(vsf_linux_main_entry_t entry, char *const *argv, int stack_size, vsf_prio_t prio)
Definition vsf_linux.c:1583
void vsf_linux_trigger_init(vsf_linux_trigger_t *trig)
Definition vsf_linux.c:685
vsf_linux_process_t * vsf_linux_get_process(pid_t pid)
Definition vsf_linux.c:1604
int vsf_linux_wait_thread(int tid, int *retval)
Definition vsf_linux.c:1875
int vsf_linux_merge_env(vsf_linux_process_t *process, char **env)
Definition vsf_linux.c:653
bool vsf_linux_is_inited(void)
Definition vsf_linux.c:991
int __vsf_linux_process_parse_arg(vsf_linux_process_t *process, vsf_linux_process_arg_t *arg, char *const *argv)
Definition vsf_linux.c:861
void __vsf_linux_process_free_arg(vsf_linux_process_t *process)
Definition vsf_linux.c:848
void vsf_linux_free_env(vsf_linux_process_t *process)
Definition vsf_linux.c:672
vsf_linux_process_t * vsf_linux_get_real_process(vsf_linux_process_t *process)
Definition vsf_linux.c:351
vsf_linux_thread_t * vsf_linux_get_thread(pid_t pid, int tid)
Definition vsf_linux.c:1617
void vsf_linux_detach_process(vsf_linux_process_t *process)
Definition vsf_linux.c:1852
void vsf_linux_detach_thread(vsf_linux_thread_t *thread)
Definition vsf_linux.c:1863
void vsf_linux_delete_process(vsf_linux_process_t *process)
Definition vsf_linux.c:1445
int vsf_linux_fs_get_executable(const char *pathname, vsf_linux_main_entry_t *entry)
Definition vsf_linux.c:2949
int vsf_linux_start_thread(vsf_linux_thread_t *thread, vsf_prio_t priority)
Definition vsf_linux.c:1181
vsf_linux_thread_t * vsf_linux_create_thread(vsf_linux_process_t *process, const vsf_linux_thread_op_t *op, int stack_size, void *stack)
Definition vsf_linux.c:1162
int(* vsf_linux_main_entry_t)(int, char **)
Definition vsf_linux.h:114
void * vsf_linux_process_heap_malloc_aligned(vsf_linux_process_t *process, uint_fast32_t size, uint_fast32_t alignment)
Definition vsf_linux.c:1226
int(* vsf_linux_process_arg_parser_t)(vsf_linux_process_arg_t *arg)
Definition vsf_linux.h:115
void * vsf_linux_malloc_res(size_t size)
Definition vsf_linux.c:966
int vsf_linux_chdir(vsf_linux_process_t *process, char *working_dir)
Definition vsf_linux_fs.c:1596
void * vsf_linux_process_heap_malloc(vsf_linux_process_t *process, size_t size)
Definition vsf_linux.c:1236
void vsf_linux_set_errno(int err)
int vsf_linux_get_errno(void)
vsf_systimer_tick_t vsf_linux_sleep(vsf_timeout_tick_t ticks)
Definition vsf_linux.c:3014
char * vsf_linux_process_heap_strdup(vsf_linux_process_t *process, char *str)
Definition vsf_linux.c:1272
vsf_eda_t * vsf_linux_get_kernel_task(void)
Definition vsf_linux.c:918
void * vsf_linux_process_heap_realloc(vsf_linux_process_t *process, void *buffer, uint_fast32_t size)
Definition vsf_linux.c:1206
int vsf_linux_fs_bind_executable(char *path, vsf_linux_main_entry_t entry)
Definition vsf_linux.c:2978
int vsf_linux_fd_bind_executable(int fd, vsf_linux_main_entry_t entry)
Definition vsf_linux.c:2969
@ __VSF_EVT_LINUX_EVENTFD_INC
Definition vsf_linux.h:102
@ __VSF_EVT_LINUX_TERM_RX
Definition vsf_linux.h:103
void vsf_linux_free_res(void *ptr)
Definition vsf_linux.c:971
int vsf_linux_expandenv(const char *str, char *output, size_t bufflen)
Definition vsf_linux.c:4389
void vsf_linux_loader_keep_ram(void)
Definition vsf_linux.c:4499
size_t vsf_linux_process_heap_size(vsf_linux_process_t *process, void *buffer)
Definition vsf_linux.c:1196
int vsf_linux_generate_path(char *path_out, int path_out_lenlen, char *dir, char *path_in)
Definition vsf_linux.c:781
__VSF_VPLT_DECORATOR__ vsf_linux_fundmental_vplt_t vsf_linux_fundmental_vplt
Definition vsf_linux.c:4735
vsf_linux_process_t * vsf_linux_get_cur_process(void)
Definition vsf_linux.c:1655
void __free_ex(vsf_linux_process_t *process, void *ptr)
Definition vsf_linux_glibc_stdlib.c:122
void vsf_linux_process_heap_free(vsf_linux_process_t *process, void *buffer)
Definition vsf_linux.c:1259
vsf_linux_thread_t * vsf_linux_get_cur_thread(void)
Definition vsf_linux.c:1646
vsf_err_t vsf_linux_init(vsf_linux_stdio_stream_t *stdio_stream)
Definition vsf_linux.c:1004
vsf_linux_process_t * vsf_linux_resources_process(void)
Definition vsf_linux.c:960
void * vsf_linux_process_heap_calloc(vsf_linux_process_t *process, size_t n, size_t size)
Definition vsf_linux.c:1247
#define VSF_LINUX_CFG_FD_BITMAP_SIZE
Definition vsf_linux_cfg.h:38
#define VSF_LINUX_CFG_TLS_NUM
Definition vsf_linux_cfg.h:53
#define VSF_LINUX_CFG_ATEXIT_NUM
Definition vsf_linux_cfg.h:73
#define VSF_LINUX_CFG_PLS_NUM
Definition vsf_linux_cfg.h:49
uint32_t size
Definition vsf_memfs.h:50
uint8_t status
Definition vsf_tgui.h:139
int sig
Definition vsf_thread.h:421