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);
64 s =
format (0,
"%s/lib/vpp_api_test_plugins", path);
66 vat_plugin_path = (
char *) s;
97 main (
int argc,
char *argv[])
102 uword main_heap_size = (1ULL << 30);
110 =
"ERROR: This binary requires CPU with %s extensions.\n";
112 if (!clib_cpu_supports_ ## a ()) \ 114 fprintf(stderr, msg, b); \ 142 if ((argc == 3) && !strncmp (argv[1],
"-c", 2))
151 fp = fopen (argv[2],
"r");
154 fprintf (stderr,
"open configuration file '%s' failed\n", argv[2]);
157 argv_ = calloc (1,
sizeof (
char *));
163 arg = strndup (argv[0], 1024);
174 if (fgets (inbuf, 4096, fp) == 0)
176 p = strtok (inbuf,
" \t\n");
182 char **tmp = realloc (argv_, argc_ *
sizeof (
char *));
186 arg = strndup (p, 1024);
189 argv_[argc_ - 1] = arg;
190 p = strtok (
NULL,
" \t\n");
196 char **tmp = realloc (argv_, (argc_ + 1) *
sizeof (
char *));
213 for (i = 1; i < (argc - 1); i++)
215 if (!strncmp (argv[i],
"plugin_path", 11))
220 else if (!strncmp (argv[i],
"heapsize", 8))
222 sizep = (
u8 *) argv[i + 1];
224 while (*sizep >=
'0' && *sizep <=
'9')
227 size += *sizep++ -
'0';
233 "warning: heapsize parse error '%s', use default %lld\n",
234 argv[i], (
long long int) main_heap_size);
238 main_heap_size =
size;
240 if (*sizep ==
'g' || *sizep ==
'G')
241 main_heap_size <<= 30;
242 else if (*sizep ==
'm' || *sizep ==
'M')
243 main_heap_size <<= 20;
245 else if (!strncmp (argv[i],
"main-core", 9))
250 unsigned long x = strtol (argv[++i], 0, 0);
261 CPU_SET (main_core, &cpuset);
262 pthread_setaffinity_np (pthread_self (),
sizeof (cpu_set_t), &cpuset);
277 int rv __attribute__ ((unused)) =
278 write (2,
"Main heap allocation failure!\r\n", 31);
345 static int recursion_block;
362 #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)