if (ops->cmd) {
ret = ops->cmd(lum->handle, lum->cmd,
(unsigned long) bytecode,
- &args);
+ &args, sock_info);
if (ret) {
free(bytecode);
}
if (ops->cmd)
ret = ops->cmd(lum->handle, lum->cmd,
(unsigned long) &lum->u,
- &args);
+ &args, sock_info);
else
ret = -ENOSYS;
break;
* we already have a more precise error message to
* report.
*/
- if (ret > -LTTNG_UST_ERR)
- lur.ret_code = -LTTNG_UST_ERR;
- else
+ if (ret > -LTTNG_UST_ERR) {
+ /* Translate code to UST error. */
+ switch (ret) {
+ case -EEXIST:
+ lur.ret_code = -LTTNG_UST_ERR_EXIST;
+ break;
+ case -EINVAL:
+ lur.ret_code = -LTTNG_UST_ERR_INVAL;
+ break;
+ case -ENOENT:
+ lur.ret_code = -LTTNG_UST_ERR_NOENT;
+ break;
+ case -EPERM:
+ lur.ret_code = -LTTNG_UST_ERR_PERM;
+ break;
+ case -ENOSYS:
+ lur.ret_code = -LTTNG_UST_ERR_NOSYS;
+ break;
+ default:
+ lur.ret_code = -LTTNG_UST_ERR;
+ break;
+ }
+ } else {
lur.ret_code = ret;
+ }
}
if (ret >= 0) {
switch (lum->cmd) {
/*
* Create only one root handle per listener thread for the whole
- * process lifetime.
+ * process lifetime, so we ensure we get ID which is statically
+ * assigned to the root handle.
*/
if (sock_info->root_handle == -1) {
ret = lttng_abi_create_root_handle();
}
end:
+ ust_lock();
+ /* Cleanup socket handles before trying to reconnect */
+ lttng_ust_objd_table_owner_cleanup(sock_info);
+ ust_unlock();
goto restart; /* try to reconnect */
quit:
return NULL;