support: abstract some system functions

Make a new API to hide some the implementation of eventfd, timerfd
and signalfd along with clock and read/write/ioctl/close functions.
We would like to have plugins use the abstractions so that we
can switch them to something else when needed.
This commit is contained in:
Wim Taymans 2019-06-04 17:07:34 +02:00
parent 98602f0343
commit 81c7dd4433
12 changed files with 492 additions and 50 deletions

View file

@ -1030,9 +1030,8 @@ static int collect_nodes(struct pw_node *driver)
}
quantum = SPA_MAX(quantum, MIN_QUANTUM);
if (driver->rt.position && quantum != driver->rt.position->size) {
if (driver->rt.position && quantum != driver->rt.position->size)
driver->rt.position->size = quantum;
}
return 0;
}

View file

@ -576,6 +576,7 @@ int pw_node_set_driver(struct pw_node *node, struct pw_node *driver)
return 0;
node->master = node->driver && driver == node;
pw_log_info("node %p: driver %p master:%u", node, driver, node->master);
node->driver_node = driver;
pw_node_emit_driver_changed(node, old, driver);
@ -1382,7 +1383,7 @@ static void node_activate(struct pw_node *this)
}
}
/** Set th node state
/** Set the node state
* \param node a \ref pw_node
* \param state a \ref pw_node_state
* \return 0 on success < 0 on error

View file

@ -378,8 +378,18 @@ void pw_init(int *argc, char **argv[])
SPA_SUPPORT_INIT(SPA_TYPE_INTERFACE_Log, iface);
pw_log_set(iface);
}
handle = load_handle(plugin, "system", NULL, support->n_support, support->support);
if (handle == NULL ||
(res = spa_handle_get_interface(&handle->handle,
SPA_TYPE_INTERFACE_System, &iface)) < 0) {
fprintf(stderr, "can't get System interface %d\n", res);
}
else {
support->support[support->n_support++] =
SPA_SUPPORT_INIT(SPA_TYPE_INTERFACE_System, iface);
}
handle = load_handle(plugin, "cpu", &info, support->n_support, support->support);
handle = load_handle(plugin, "cpu", NULL, support->n_support, support->support);
if (handle == NULL ||
(res = spa_handle_get_interface(&handle->handle,
SPA_TYPE_INTERFACE_CPU, &iface)) < 0) {