[PATCH] xfree86: Use SA_SIGINFO if available for SIGIO handlers
Gabor Gombas
gombasg at sztaki.hu
Wed Nov 11 01:35:15 PST 2009
On Tue, Nov 10, 2009 at 02:53:50PM -0500, Adam Jackson wrote:
> +#else /* have SA_SIGINFO */
> +
> +/* siginfo passes the triggering fd in, no need to select() */
> +static void
> +sigio_sigaction(int sig, siginfo_t *si, void *ctx)
> +{
> + int i;
> + int save_errno = errno;
> +
> + for (i = 0; i < MAX_FUNCS; i++) {
> + if (xf86SigIOFuncs[i].f && xf86SigIOFuncs[i].fd == si->si_fd) {
> + (*xf86SigIOFuncs[i].f)(si->si_fd, xf86SigIOFuncs[i].closure);
> + break;
> + }
> + }
> +
> + errno = save_errno;
> +}
> +
> +#endif
For completeness sake you should check that si->si_code == SI_SIGIO
before using si->si_fd, according to the fcntl(2) man page. si->si_fd
may be undefined if someone does a "kill -SIGIO <pid of xserver>" for
whatever reason.
Gabor
--
---------------------------------------------------------
MTA SZTAKI Computer and Automation Research Institute
Hungarian Academy of Sciences
---------------------------------------------------------
More information about the xorg
mailing list