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/" CLIB_TARGET_TRIPLET
"/vpp_plugins:" 61 "%s/lib/vpp_plugins", path, path);
65 s =
format (0,
"%s/lib/" CLIB_TARGET_TRIPLET
"/vpp_api_test_plugins:" 66 "%s/lib/vpp_api_test_plugins", path, path);
68 vat_plugin_path = (
char *) s;
99 main (
int argc,
char *argv[])
104 uword main_heap_size = (1ULL << 30);
112 =
"ERROR: This binary requires CPU with %s extensions.\n";
114 if (!clib_cpu_supports_ ## a ()) \ 116 fprintf(stderr, msg, b); \ 144 if ((argc == 3) && !strncmp (argv[1],
"-c", 2))
153 fp = fopen (argv[2],
"r");
156 fprintf (stderr,
"open configuration file '%s' failed\n", argv[2]);
159 argv_ = calloc (1,
sizeof (
char *));
165 arg = strndup (argv[0], 1024);
176 if (fgets (inbuf, 4096, fp) == 0)
178 p = strtok (inbuf,
" \t\n");
184 char **tmp = realloc (argv_, argc_ *
sizeof (
char *));
188 arg = strndup (p, 1024);
191 argv_[argc_ - 1] = arg;
192 p = strtok (
NULL,
" \t\n");
198 char **tmp = realloc (argv_, (argc_ + 1) *
sizeof (
char *));
215 for (i = 1; i < (argc - 1); i++)
217 if (!strncmp (argv[i],
"plugin_path", 11))
222 else if (!strncmp (argv[i],
"heapsize", 8))
224 sizep = (
u8 *) argv[i + 1];
226 while (*sizep >=
'0' && *sizep <=
'9')
229 size += *sizep++ -
'0';
235 "warning: heapsize parse error '%s', use default %lld\n",
236 argv[i], (
long long int) main_heap_size);
240 main_heap_size =
size;
242 if (*sizep ==
'g' || *sizep ==
'G')
243 main_heap_size <<= 30;
244 else if (*sizep ==
'm' || *sizep ==
'M')
245 main_heap_size <<= 20;
247 else if (!strncmp (argv[i],
"main-core", 9))
252 unsigned long x = strtol (argv[++i], 0, 0);
263 CPU_SET (main_core, &cpuset);
264 pthread_setaffinity_np (pthread_self (),
sizeof (cpu_set_t), &cpuset);
279 int rv __attribute__ ((unused)) =
280 write (2,
"Main heap allocation failure!\r\n", 31);
347 static int recursion_block;
364 #ifdef BARRIER_TRACING 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
const char * barrier_context
#define VLIB_CONFIG_FUNCTION(x, n,...)
void elog_post_mortem_dump(void)
uword * init_functions_called
#define vec_free(V)
Free vector's memory (no header).
#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 * clib_mem_init_thread_safe(void *memory, uword memory_size)
void vl_msg_api_set_first_available_msg_id(u16 first_avail)