/* Write some dummy data to the control pipe and
* wait for the thread to exit */
- r = usbi_write(netlink_control_pipe[1], &dummy, sizeof(dummy));
+ r = write(netlink_control_pipe[1], &dummy, sizeof(dummy));
if (r <= 0)
usbi_warn(NULL, "netlink control pipe signal failed");
static void *linux_netlink_event_thread_main(void *arg)
{
char dummy;
- ssize_t r;
+ int r;
+ ssize_t nb;
struct pollfd fds[] = {
{ .fd = netlink_control_pipe[0],
.events = POLLIN },
usbi_dbg("netlink event thread entering");
- while (poll(fds, 2, -1) >= 0) {
+ while ((r = poll(fds, 2, -1)) >= 0 || errno == EINTR) {
+ if (r < 0) {
+ /* temporary failure */
+ continue;
+ }
if (fds[0].revents & POLLIN) {
/* activity on control pipe, read the byte and exit */
- r = usbi_read(netlink_control_pipe[0], &dummy, sizeof(dummy));
- if (r <= 0)
+ nb = read(netlink_control_pipe[0], &dummy, sizeof(dummy));
+ if (nb <= 0)
usbi_warn(NULL, "netlink control pipe read failed");
break;
}
/* Write some dummy data to the control pipe and
* wait for the thread to exit */
- r = usbi_write(udev_control_pipe[1], &dummy, sizeof(dummy));
+ r = write(udev_control_pipe[1], &dummy, sizeof(dummy));
if (r <= 0) {
usbi_warn(NULL, "udev control pipe signal failed");
}
{
char dummy;
int r;
+ ssize_t nb;
struct udev_device* udev_dev;
struct pollfd fds[] = {
{.fd = udev_control_pipe[0],
}
if (fds[0].revents & POLLIN) {
/* activity on control pipe, read the byte and exit */
- r = usbi_read(udev_control_pipe[0], &dummy, sizeof(dummy));
- if (r <= 0) {
+ nb = read(udev_control_pipe[0], &dummy, sizeof(dummy));
+ if (nb <= 0) {
usbi_warn(NULL, "udev control pipe read failed");
}
break;