int wskbd_do_ioctl_sc(struct wskbd_softc *sc, u_long cmd, caddr_t data, int flag, struct proc *p) { int error; /* * Try the generic ioctls that the wskbd interface supports. */ switch (cmd) { case FIONBIO: /* we will remove this someday (soon???) */ return (0); case FIOASYNC: if (sc->sc_base.me_evp == NULL) return (EINVAL); sc->sc_base.me_evp->async = *(int *)data != 0; return (0); case FIOSETOWN: if (sc->sc_base.me_evp == NULL) return (EINVAL); if (-*(int *)data != sc->sc_base.me_evp->io->ps_pgid && *(int *)data != sc->sc_base.me_evp->io->ps_pid) return (EPERM); return (0); case TIOCSPGRP: if (sc->sc_base.me_evp == NULL) return (EINVAL); if (*(int *)data != sc->sc_base.me_evp->io->ps_pgid) return (EPERM); return (0); } /* * Try the keyboard driver for WSKBDIO ioctls. It returns -1 * if it didn't recognize the request. */ error = wskbd_displayioctl(&sc->sc_base.me_dv, cmd, data, flag, p); return (error != -1 ? error : ENOTTY); }
int wskbd_do_ioctl_sc(struct wskbd_softc *sc, u_long cmd, void *data, int flag, struct lwp *l) { /* * Try the generic ioctls that the wskbd interface supports. */ switch (cmd) { case FIONBIO: /* we will remove this someday (soon???) */ return (0); case FIOASYNC: if (sc->sc_base.me_evp == NULL) return (EINVAL); sc->sc_base.me_evp->async = *(int *)data != 0; return (0); case FIOSETOWN: if (sc->sc_base.me_evp == NULL) return (EINVAL); if (-*(int *)data != sc->sc_base.me_evp->io->p_pgid && *(int *)data != sc->sc_base.me_evp->io->p_pid) return (EPERM); return (0); case TIOCSPGRP: if (sc->sc_base.me_evp == NULL) return (EINVAL); if (*(int *)data != sc->sc_base.me_evp->io->p_pgid) return (EPERM); return (0); } /* * Try the keyboard driver for WSKBDIO ioctls. It returns EPASSTHROUGH * if it didn't recognize the request. */ return (wskbd_displayioctl(sc->sc_base.me_dv, cmd, data, flag, l)); }