- VDBG (0, "sending app attach");
- rv = vppcom_app_attach ();
- if (rv)
- {
- VERR ("vppcom_app_attach() failed!");
- return rv;
- }
+ vcm->main_cpu = pthread_self ();
+ vcm->main_pid = getpid ();
+ vcm->app_name = format (0, "%s", app_name);
+ vppcom_init_error_string_table ();
+ svm_fifo_segment_main_init (vcl_cfg->segment_baseva,
+ 20 /* timeout in secs */ );
+ pool_alloc (vcm->workers, vcl_cfg->max_workers);
+ clib_spinlock_init (&vcm->workers_lock);
+ clib_rwlock_init (&vcm->segment_table_lock);
+ pthread_atfork (NULL, vcl_app_fork_parent_handler,
+ vcl_app_fork_child_handler);
+
+ /* Allocate default worker */
+ vcl_worker_alloc_and_init ();
+
+ /* API hookup and connect to VPP */
+ vppcom_api_hookup ();
+ vcl_elog_init (vcm);
+ vcm->app_state = STATE_APP_START;
+ rv = vppcom_connect_to_vpp (app_name);
+ if (rv)
+ {
+ VERR ("couldn't connect to VPP!");
+ return rv;
+ }
+ VDBG (0, "sending session enable");
+ rv = vppcom_app_session_enable ();
+ if (rv)
+ {
+ VERR ("vppcom_app_session_enable() failed!");
+ return rv;
+ }