rv = clib_mem_alloc (nbytes);
rv->q = 0;
+ rv->gc_mark_timestamp = 0;
svm_pop_heap (oldheap);
pthread_mutex_unlock (&am->vlib_rp->mutex);
svm_map_region_args_t _a, *a = &_a;
svm_region_t *vlib_rp, *root_rp;
api_main_t *am = &api_main;
- int i, rv;
+ int i;
struct timespec ts, tsrem;
char *vpe_api_region_suffix = "-vpe-api";
if (is_vlib == 0)
{
- rv = svm_region_init_chroot (am->root_path);
- if (rv)
- return rv;
+ int tfd;
+ u8 *api_name;
+ /*
+ * Clients wait for vpp to set up the root / API regioins
+ */
+ if (am->root_path)
+ api_name = format (0, "/dev/shm/%s-%s%c", am->root_path,
+ region_name + 1, 0);
+ else
+ api_name = format (0, "/dev/shm%s%c", region_name, 0);
+
+ /* Wait up to 100 seconds... */
+ for (i = 0; i < 10000; i++)
+ {
+ ts.tv_sec = 0;
+ ts.tv_nsec = 10000 * 1000; /* 10 ms */
+ while (nanosleep (&ts, &tsrem) < 0)
+ ts = tsrem;
+ tfd = open ((char *) api_name, O_RDWR);
+ if (tfd >= 0)
+ break;
+ }
+ vec_free (api_name);
+ if (tfd < 0)
+ {
+ clib_warning ("region init fail");
+ return -2;
+ }
+ close (tfd);
+ svm_region_init_chroot_uid_gid (am->root_path, getuid (), getgid ());
}
if (a->root_path != NULL)
if (am->tx_trace && am->tx_trace->enabled)
vl_msg_api_trace (am, am->tx_trace, (void *) trace[0]);
+ /*
+ * Announce a probable binary API client bug:
+ * some client's input queue is stuffed.
+ * The situation may be recoverable, or not.
+ */
+ if (PREDICT_FALSE
+ (am->vl_clients /* vpp side */ && (q->cursize == q->maxsize)))
+ clib_warning ("WARNING: client input queue at %llx is stuffed...", q);
(void) svm_queue_add (q, elem, 0 /* nowait */ );
}