25 #include <vpp/app/version.h> 39 char *p, path[PATH_MAX];
44 if ((rv = readlink (
"/proc/self/exe", path, PATH_MAX - 1)) == -1)
51 if ((p = strrchr (path,
'/')) == 0)
56 if ((p = strrchr (path,
'/')) == 0)
60 s =
format (0,
"%s/lib/vpp_plugins", path);
62 s =
format (s,
":%s/lib64/vpp_plugins", path);
67 s =
format (0,
"%s/lib/vpp_api_test_plugins", path);
69 s =
format (s,
":%s/lib64/vpp_api_test_plugins", path);
72 vat_plugin_path = (
char *) s;
107 uword main_heap_size = (1ULL << 30);
115 =
"ERROR: This binary requires CPU with %s extensions.\n";
117 if (!clib_cpu_supports_ ## a ()) \ 119 fprintf(stderr, msg, b); \ 147 if ((argc == 3) && !strncmp (argv[1],
"-c", 2))
156 fp = fopen (argv[2],
"r");
159 fprintf (stderr,
"open configuration file '%s' failed\n", argv[2]);
162 argv_ = calloc (1,
sizeof (
char *));
165 arg = strndup (argv[0], 1024);
172 if (fgets (inbuf, 4096, fp) == 0)
174 p = strtok (inbuf,
" \t\n");
180 char **tmp = realloc (argv_, argc_ *
sizeof (
char *));
184 arg = strndup (p, 1024);
187 argv_[argc_ - 1] = arg;
188 p = strtok (
NULL,
" \t\n");
194 char **tmp = realloc (argv_, (argc_ + 1) *
sizeof (
char *));
211 for (i = 1; i < (argc - 1); i++)
213 if (!strncmp (argv[i],
"plugin_path", 11))
218 else if (!strncmp (argv[i],
"heapsize", 8))
220 sizep = (
u8 *) argv[i + 1];
222 while (*sizep >=
'0' && *sizep <=
'9')
225 size += *sizep++ -
'0';
231 "warning: heapsize parse error '%s', use default %lld\n",
232 argv[i], (
long long int) main_heap_size);
236 main_heap_size =
size;
238 if (*sizep ==
'g' || *sizep ==
'G')
239 main_heap_size <<= 30;
240 else if (*sizep ==
'm' || *sizep ==
'M')
241 main_heap_size <<= 20;
243 else if (!strncmp (argv[i],
"main-core", 9))
248 unsigned long x = strtol (argv[++i], 0, 0);
259 CPU_SET (main_core, &cpuset);
260 pthread_setaffinity_np (pthread_self (),
sizeof (cpu_set_t), &cpuset);
275 int rv __attribute__ ((unused)) =
276 write (2,
"Main heap allocation failure!\r\n", 31);
343 static int recursion_block;
360 #ifdef BARRIER_TRACING 400 u64 *p = (
u64 *) 0xdefec8ed;
404 .format =
"deliberate crash: touching %x",.format_args =
"i4",};
416 .path =
"test crash",
417 .short_help =
"crash the bus!",
int vlib_unix_main(int argc, char *argv[])
u32 vlib_app_num_thread_stacks_needed(void)
vlib_main_t vlib_global_main
void vl_msg_api_barrier_sync(void)
static clib_error_t * plugin_path_config(vlib_main_t *vm, unformat_input_t *input)
void vlib_unix_cli_set_prompt(char *prompt)
Set the CLI prompt.
static clib_error_t * heapsize_config(vlib_main_t *vm, unformat_input_t *input)
#define vlib_mark_init_function_complete(vm, x)
void vhost_user_unmap_all(void)
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define vl_msg_api_barrier_trace_context(X)
#define vlib_worker_thread_barrier_sync(X)
char * vlib_default_runtime_dir
#define clib_error_return(e, args...)
static clib_error_t * srp_init(vlib_main_t *vm)
void vl_msg_api_post_mortem_dump(void)
vlib_worker_thread_t * vlib_worker_threads
#define VLIB_CONFIG_FUNCTION(x, n,...)
void elog_post_mortem_dump(void)
static void elog(elog_main_t *em, elog_event_type_t *type, u32 data)
Log a single-datum event.
uword * init_functions_called
void * clib_mem_init(void *heap, uword size)
#define vec_free(V)
Free vector's memory (no header).
static clib_error_t * test_crash_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define ELOG_TYPE_DECLARE(f)
#define VLIB_CLI_COMMAND(x,...)
#define hash_create(elts, value_bytes)
void vat_plugin_hash_create(void)
void vl_msg_api_barrier_release(void)
static void vpe_main_init(vlib_main_t *vm)
static vlib_main_t * vlib_get_main(void)
static void vpp_find_plugin_path()
void vlib_worker_thread_barrier_release(vlib_main_t *vm)
int main(int argc, char *argv[])
char * vlib_plugin_app_version
void vl_msg_api_set_first_available_msg_id(u16 first_avail)