mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-08 11:19:14 +02:00
tools/record: use a pointer to the signalfd poll entry
No functional changes, this makes the code slightly more readable, especially once we start adding more "special" fds. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
b1f8ea0a5e
commit
773287e745
1 changed files with 5 additions and 4 deletions
|
|
@ -2115,6 +2115,7 @@ mainloop(struct record_context *ctx)
|
||||||
{
|
{
|
||||||
bool autorestart = (ctx->timeout > 0);
|
bool autorestart = (ctx->timeout > 0);
|
||||||
struct pollfd fds[ctx->ndevices + 2];
|
struct pollfd fds[ctx->ndevices + 2];
|
||||||
|
struct pollfd *signal_fd = &fds[0];
|
||||||
unsigned int nfds = 0;
|
unsigned int nfds = 0;
|
||||||
struct record_device *d = NULL;
|
struct record_device *d = NULL;
|
||||||
sigset_t mask;
|
sigset_t mask;
|
||||||
|
|
@ -2135,8 +2136,8 @@ mainloop(struct record_context *ctx)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
fds[0].fd = signalfd(-1, &mask, SFD_NONBLOCK);
|
signal_fd->fd = signalfd(-1, &mask, SFD_NONBLOCK);
|
||||||
assert(fds[0].fd != -1);
|
assert(signal_fd->fd != -1);
|
||||||
nfds++;
|
nfds++;
|
||||||
|
|
||||||
if (ctx->libinput) {
|
if (ctx->libinput) {
|
||||||
|
|
@ -2218,7 +2219,7 @@ mainloop(struct record_context *ctx)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fds[0].revents != 0) { /* signal */
|
if (signal_fd->revents != 0) { /* signal */
|
||||||
autorestart = false;
|
autorestart = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -2295,7 +2296,7 @@ mainloop(struct record_context *ctx)
|
||||||
ctx->output_file = NULL;
|
ctx->output_file = NULL;
|
||||||
} while (autorestart);
|
} while (autorestart);
|
||||||
|
|
||||||
close(fds[0].fd);
|
close(signal_fd->fd);
|
||||||
|
|
||||||
sigprocmask(SIG_UNBLOCK, &mask, NULL);
|
sigprocmask(SIG_UNBLOCK, &mask, NULL);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue