while (1) {
pthread_mutex_lock (&q->mutex);
if (q->cursize == 0) {
+ vm->api_queue_nonempty = 0;
pthread_mutex_unlock (&q->mutex);
if (TRACE_VLIB_MEMORY_QUEUE)
}
headp = (i8 *) (q->data + sizeof(uword)*q->head);
- memcpy (&mp, headp, sizeof(uword));
+ clib_memcpy (&mp, headp, sizeof(uword));
q->head++;
need_broadcast = (q->cursize == q->maxsize/2);
vlib_main_t * vm = vlib_get_main();
vm->queue_signal_pending = 1;
+ vm->api_queue_nonempty = 1;
}
static void
clib_error_t *
vlibmemory_init (vlib_main_t * vm)
{
- /* Do this early, to avoid glibc malloc fubar */
- svm_region_init();
- return 0;
+ api_main_t *am = &api_main;
+ /* Normally NULL, can be set by cmd line "chroot {prefix foo}" */
+ svm_region_init_chroot (am->root_path);
+ return 0;
}
VLIB_INIT_FUNCTION (vlibmemory_init);
am->region_name = name;
}
-void vl_set_memory_root_path (char *name)
-{
- api_main_t *am = &api_main;
-
- am->root_path = name;
-}
-
static int range_compare (vl_api_msg_range_t * a0, vl_api_msg_range_t * a1)
{
int len0, len1, clen;
if (mp->need_barrier_sync)
vlib_worker_thread_barrier_sync (vm);
- fp = (void *)(mp->function);
- rv = (*fp)(mp->data);
+ fp = uword_to_pointer(mp->function, int(*)(void *));
+ rv = fp(mp->data);
if (mp->need_barrier_sync)
vlib_worker_thread_barrier_release (vm);
mp = vl_msg_api_alloc_as_if_client (sizeof (*mp) + data_length);
memset (mp, 0, sizeof (*mp));
- memcpy (mp->data, data, data_length);
+ clib_memcpy (mp->data, data, data_length);
mp->_vl_msg_id = ntohs (VL_API_RPC_CALL);
- mp->function = (u64)fp;
+ mp->function = pointer_to_uword(fp);
mp->need_barrier_sync = 1;
/* Use the "normal" control-plane mechanism for the main thread */