|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
44 #include <sys/ucontext.h>
46 #include <sys/types.h>
50 #include <sys/resource.h>
54 #define UNIX_CLI_DEFAULT_PAGER_LIMIT 100000
57 #define UNIX_CLI_DEFAULT_HISTORY 50
85 sa.sa_handler = SIG_DFL;
87 sigemptyset (&sa.sa_mask);
88 return sigaction (sig, &sa, 0);
111 if (signum == SIGSEGV)
123 syslog (LOG_ERR | LOG_DAEMON,
"received SIGTERM, exiting...");
127 syslog (LOG_ERR | LOG_DAEMON,
"IGNORE early SIGTERM...");
153 void __gcov_flush (
void);
163 syslog (LOG_ERR | LOG_DAEMON,
"%s",
syslog_msg);
169 for (
i = 0;
i < n_callers;
i++)
177 syslog (LOG_ERR | LOG_DAEMON,
"%s",
syslog_msg);
184 if (signum == SIGINT || signum == SIGHUP)
203 for (
i = 1;
i < 32;
i++)
207 sa.sa_flags = SA_SIGINFO;
222 sa.sa_sigaction = (
void *) SIG_IGN;
230 if (sigaction (
i, &sa, 0) < 0)
249 char save = msg[msg_len - 1];
252 msg[msg_len - 1] = 0;
254 syslog (LOG_ERR | LOG_DAEMON,
"%s", msg);
256 msg[msg_len - 1] = save;
277 save = msg[msg_len - 1];
278 msg[msg_len - 1] = 0;
280 syslog (LOG_ERR | LOG_DAEMON,
"%s", msg);
282 msg[msg_len - 1] = save;
306 fd = open (fn, O_RDONLY);
313 if (fstat (fd, &s) < 0)
321 if (!(S_ISREG (s.st_mode) || S_ISLNK (s.st_mode)))
331 n = read (fd,
buf + l, 4096);
334 _vec_len (
buf) = l + n;
344 lv =
format (lv,
"%U: ***** Startup Config *****\n%v",
349 int rv __attribute__ ((unused)) =
353 lv =
format (lv,
"%U: ***** End Startup Config *****\n",
357 int rv __attribute__ ((unused)) =
379 .name =
"startup-config-process",
380 .process_log2_n_stack_bytes = 18,
400 if (
unformat (input,
"interactive"))
402 else if (
unformat (input,
"nodaemon"))
404 else if (
unformat (input,
"nosyslog"))
406 else if (
unformat (input,
"nocolor"))
408 else if (
unformat (input,
"nobanner"))
410 else if (
unformat (input,
"cli-prompt %s", &cli_prompt))
417 else if (
unformat (input,
"cli-line-mode"))
419 else if (
unformat (input,
"cli-no-banner"))
421 else if (
unformat (input,
"cli-no-pager"))
425 else if (
unformat (input,
"cli-pager-buffer-limit %d",
431 else if (
unformat (input,
"coredump-size"))
433 uword coredump_size = 0;
436 coredump_size = RLIM_INFINITY;
442 "invalid coredump-size parameter `%U'",
445 const struct rlimit new_limit = { coredump_size, coredump_size };
446 if (0 != setrlimit (RLIMIT_CORE, &new_limit))
451 else if (
unformat (input,
"full-coredump"))
455 fd = open (
"/proc/self/coredump_filter", O_WRONLY);
458 if (write (fd,
"0x6f\n", 5) != 5)
465 else if (
unformat (input,
"startup-config %s",
473 O_CREAT | O_WRONLY | O_APPEND, 0644);
482 lv =
format (0,
"%U: ***** Start: PID %d *****\n",
487 int rv __attribute__ ((unused)) =
495 if (setegid (gid) == -1)
507 uid_t uid = geteuid ();
532 if (((pidfd = open ((
char *) um->
pidfile,
533 O_CREAT | O_WRONLY | O_TRUNC, 0644)) < 0))
541 openlog (vgm->
name, LOG_CONS | LOG_PERROR | LOG_PID, LOG_DAEMON);
552 u8 *lv =
format (0,
"%d", getpid ());
747 __os_thread_index = 0;
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
uword clib_calljmp(uword(*func)(uword func_arg), uword func_arg, void *stack)
volatile int unix_config_complete
clib_file_main_t file_main
static clib_error_t * setup_signal_handlers(unix_main_t *um)
static clib_mem_heap_t * clib_mem_get_heap(void)
#define UNIX_FLAG_NOCOLOR
uword vlib_last_faulting_address
static_always_inline void vlib_process_finish_switch_stack(vlib_main_t *vm)
clib_error_t * vlib_unix_validate_runtime_file(unix_main_t *um, const char *path, u8 **full_path)
static clib_error_t * unix_config(vlib_main_t *vm, unformat_input_t *input)
#define clib_error_return(e, args...)
#define vec_alloc(V, N)
Allocate space for N more elements (no header, unspecified alignment)
static uword startup_config_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
#define clib_error_report(e)
#define CLIB_MEM_VM_MAP_FAILED
vnet_hw_if_output_node_runtime_t * r
static clib_error_t * unix_main_init(vlib_main_t *vm)
static vlib_global_main_t * vlib_get_global_main(void)
#define clib_unix_warning(format, args...)
#define VLIB_EARLY_CONFIG_FUNCTION(x, n,...)
static clib_error_t * unix_exit(vlib_main_t *vm)
__clib_export void clib_time_init(clib_time_t *c)
#define UNIX_CLI_DEFAULT_PAGER_LIMIT
Default CLI pager limit is not configured in startup.conf.
int vlib_unix_main(int argc, char *argv[])
#define UNIX_FLAG_NOSYSLOG
clib_socket_t cli_listen_socket
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
volatile u32 main_loop_exit_now
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
u32 cli_pager_buffer_limit
u8 * vlib_thread_stack_init(uword thread_index)
int vlib_cli_input(vlib_main_t *vm, unformat_input_t *input, vlib_cli_output_function_t *function, uword function_arg)
static elog_main_t * vlib_get_elog_main()
static void unix_signal_handler(int signum, siginfo_t *si, ucontext_t *uc)
#define UNIX_CLI_DEFAULT_HISTORY
Default CLI history depth if not configured in startup.conf.
static_always_inline void vlib_process_start_switch_stack(vlib_main_t *vm, vlib_process_t *p)
static void unix_error_handler(void *arg, u8 *msg, int msg_len)
__clib_export void clib_error_register_handler(clib_error_handler_func_t func, void *arg)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
clib_error_t * vlib_unix_recursive_mkdir(char *path)
int vlib_plugin_early_init(vlib_main_t *vm)
format_function_t format_clib_elf_symbol_with_address
static vlib_node_registration_t startup_config_node
(constructor) VLIB_REGISTER_NODE (startup_config_node)
#define CLIB_CACHE_LINE_BYTES
struct _vlib_node_registration vlib_node_registration_t
static int unsetup_signal_handlers(int sig)
clib_error_t * vlib_call_all_config_functions(vlib_main_t *vm, unformat_input_t *input, int is_early)
#define vec_free(V)
Free vector's memory (no header).
u8 * startup_config_filename
description fragment has unexpected format
#define VLIB_THREAD_STACK_SIZE
static uword vlib_process_suspend(vlib_main_t *vm, f64 dt)
Suspend a vlib cooperative multi-tasking thread for a period of time.
#define VLIB_INIT_FUNCTION(x)
@ CLIB_MEM_PAGE_SZ_DEFAULT
__clib_export void clib_elf_main_init(char *exec_path)
__clib_export uword clib_backtrace(uword *callers, uword max_callers, uword n_frames_to_skip)
static vlib_main_t * vlib_get_first_main(void)
__clib_export void elog_init(elog_main_t *em, u32 n_events)
#define clib_error_return_unix(e, args...)
#define vec_resize(V, N)
Resize a vector (no header, unspecified alignment) Add N elements to end of given vector V,...
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vnet_interface_output_runtime_t * rt
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
#define UNIX_FLAG_NODAEMON
#define clib_warning(format, args...)
__clib_export void * clib_mem_vm_map_stack(uword size, clib_mem_page_sz_t log2_page_sz, char *fmt,...)
#define UNIX_FLAG_INTERACTIVE
uword * init_functions_called
int vlib_main(vlib_main_t *volatile vm, unformat_input_t *input)
#define VLIB_MAIN_LOOP_EXIT_FUNCTION(x)
#define UNIX_FLAG_NOBANNER
void vlib_unix_error_report(vlib_main_t *vm, clib_error_t *error)
#define clib_panic(format, args...)
clib_error_t * vlib_plugin_config(vlib_main_t *vm, unformat_input_t *input)
vlib_main_t ** vlib_mains
#define hash_create(elts, value_bytes)
static void elog_enable_disable(elog_main_t *em, int is_enabled)
Enable or disable event logging.
void vlib_unix_cli_set_prompt(char *prompt)
Set the CLI prompt.
u32 configured_elog_ring_size
char * vlib_default_runtime_dir
static uword thread0(uword arg)
#define VLIB_REGISTER_NODE(x,...)