From: Jaroslav Kysela Date: Thu, 18 Oct 2001 12:33:45 +0000 (+0000) Subject: Fixed typos and made some cleanups in the async stuff X-Git-Tag: v1.0.3~639 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=67cc9dbc75ab2bfcf9390629c024ce3119e89027;p=alsa-lib.git Fixed typos and made some cleanups in the async stuff --- diff --git a/src/async.c b/src/async.c index d1c9e2f9..aea46597 100644 --- a/src/async.c +++ b/src/async.c @@ -46,7 +46,7 @@ void snd_async_init(void) 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) { @@ -56,10 +56,8 @@ static void snd_async_handler(int signo ATTRIBUTE_UNUSED, siginfo_t *siginfo, vo 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; - } } } @@ -88,6 +86,7 @@ int snd_async_add_handler(snd_async_handler_t **handler, int fd, 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); @@ -111,6 +110,7 @@ int snd_async_del_handler(snd_async_handler_t *handler) 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); diff --git a/src/control/control_hw.c b/src/control/control_hw.c index c206dd2e..df364731 100644 --- a/src/control/control_hw.c +++ b/src/control/control_hw.c @@ -90,11 +90,11 @@ static int snd_ctl_hw_async(snd_ctl_t *ctl, int sig, pid_t pid) } 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; } diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c index 19471630..6ea8114a 100644 --- a/src/pcm/pcm.c +++ b/src/pcm/pcm.c @@ -993,7 +993,7 @@ int snd_async_add_pcm_handler(snd_async_handler_t **handler, snd_pcm_t *pcm, 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; diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c index a0e9a8a3..6223f77e 100644 --- a/src/pcm/pcm_hw.c +++ b/src/pcm/pcm_hw.c @@ -88,11 +88,11 @@ static int snd_pcm_hw_async(snd_pcm_t *pcm, int sig, pid_t pid) } 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; }