int snd_async_signo = SIGIO;
#endif
-static struct list_head snd_async_handlers;
+static LIST_HEAD(snd_async_handlers);
static void snd_async_handler(int signo ATTRIBUTE_UNUSED, siginfo_t *siginfo, void *context ATTRIBUTE_UNUSED)
{
fd = siginfo->si_fd;
list_for_each(i, &snd_async_handlers) {
snd_async_handler_t *h = list_entry(i, snd_async_handler_t, glist);
- if (h->fd == fd) {
+ if (h->fd == fd && h->callback)
h->callback(h);
- // break;
- }
}
}
if (was_empty) {
int err;
struct sigaction act;
+ memset(&act, 0, sizeof(act));
act.sa_flags = SA_RESTART | SA_SIGINFO;
act.sa_sigaction = snd_async_handler;
sigemptyset(&act.sa_mask);
list_del(&handler->glist);
if (list_empty(&snd_async_handlers)) {
struct sigaction act;
+ memset(&act, 0, sizeof(act));
act.sa_flags = 0;
act.sa_handler = SIG_DFL;
err = sigaction(snd_async_signo, &act, NULL);
}
if (sig < 0)
return 0;
- if (fcntl(fd, F_SETSIG, sig) < 0) {
+ if (fcntl(fd, F_SETSIG, (long)sig) < 0) {
SYSERR("F_SETSIG failed");
return -errno;
}
- if (fcntl(fd, F_SETOWN, pid) < 0) {
+ if (fcntl(fd, F_SETOWN, (long)pid) < 0) {
SYSERR("F_SETOWN failed");
return -errno;
}
was_empty = list_empty(&pcm->async_handlers);
list_add_tail(&h->hlist, &pcm->async_handlers);
if (was_empty) {
- err = snd_pcm_async(pcm, getpid(), snd_async_signo);
+ err = snd_pcm_async(pcm, snd_async_signo, getpid());
if (err < 0) {
snd_async_del_handler(h);
return err;
}
if (sig < 0)
return 0;
- if (fcntl(fd, F_SETSIG, sig) < 0) {
+ if (fcntl(fd, F_SETSIG, (long)sig) < 0) {
SYSERR("F_SETSIG failed");
return -errno;
}
- if (fcntl(fd, F_SETOWN, pid) < 0) {
+ if (fcntl(fd, F_SETOWN, (long)pid) < 0) {
SYSERR("F_SETOWN failed");
return -errno;
}