diff options
author | nectar <nectar@FreeBSD.org> | 2003-08-26 16:57:24 +0000 |
---|---|---|
committer | nectar <nectar@FreeBSD.org> | 2003-08-26 16:57:24 +0000 |
commit | 446bd260763fd9ee3710e07af88622edb59ffe8d (patch) | |
tree | 6c9cbb82fd2629bf45e321a40d34235ffbdf39da /sys | |
parent | d39b66a2b90c1a9e76975c37a12c4df5f8316891 (diff) | |
download | FreeBSD-src-446bd260763fd9ee3710e07af88622edb59ffe8d.zip FreeBSD-src-446bd260763fd9ee3710e07af88622edb59ffe8d.tar.gz |
Revision 1.126 broke the interface of the bktr driver's
METEORSSIGNAL ioctl. Applications use this ioctl with the value
METEOR_SIG_MODE_MASK (0xFFFF0000, -65536) to reset signal delivery,
but revision 1.126 caused the driver to return EINVAL in this case.
Interestingly, the same METEORSSIGNAL ioctl in the meteor driver uses
0 to reset signal delivery.
This commit allows METEOR_SIG_MODE_MASK as a synonym for 0 in the
bktr driver, and restructures the code a bit so that it is otherwise
identical between the bktr and meteor drivers.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/bktr/bktr_core.c | 22 | ||||
-rw-r--r-- | sys/pci/meteor.c | 27 |
2 files changed, 26 insertions, 23 deletions
diff --git a/sys/dev/bktr/bktr_core.c b/sys/dev/bktr/bktr_core.c index 2ca72c8..19795a2 100644 --- a/sys/dev/bktr/bktr_core.c +++ b/sys/dev/bktr/bktr_core.c @@ -915,10 +915,9 @@ common_bktr_intr( void *arg ) * let them know the frame is complete. */ - if (bktr->proc && !(bktr->signal & METEOR_SIG_MODE_MASK)) { + if (bktr->proc != NULL) { PROC_LOCK(bktr->proc); - psignal( bktr->proc, - bktr->signal&(~METEOR_SIG_MODE_MASK) ); + psignal( bktr->proc, bktr->signal); PROC_UNLOCK(bktr->proc); } @@ -1299,6 +1298,7 @@ video_ioctl( bktr_ptr_t bktr, int unit, ioctl_cmd_t cmd, caddr_t arg, struct thr struct bktr_capture_area *cap_area; vm_offset_t buf; int i; + int sig; char char_temp; switch ( cmd ) { @@ -1570,12 +1570,16 @@ video_ioctl( bktr_ptr_t bktr, int unit, ioctl_cmd_t cmd, caddr_t arg, struct thr break; case METEORSSIGNAL: - if(*(int *)arg <= 0 || *(int *)arg > _SIG_MAXSIG) { - return( EINVAL ); - break; - } - bktr->signal = *(int *) arg; - bktr->proc = td->td_proc; + sig = *(int *)arg; + /* Historically, applications used METEOR_SIG_MODE_MASK + * to reset signal delivery. + */ + if (sig == METEOR_SIG_MODE_MASK) + sig = 0; + if (sig < 0 || sig > _SIG_MAXSIG) + return (EINVAL); + bktr->signal = sig; + bktr->proc = sig ? td->td_proc : NULL; break; case METEORGSIGNAL: diff --git a/sys/pci/meteor.c b/sys/pci/meteor.c index 5751b70..5c808b5 100644 --- a/sys/pci/meteor.c +++ b/sys/pci/meteor.c @@ -640,9 +640,9 @@ meteor_intr(void *arg) * If the user requested to be notified via signal, * let them know the field is complete. */ - if(mtr->proc && (mtr->signal & METEOR_SIG_MODE_MASK)) { + if(mtr->proc != NULL) { PROC_LOCK(mtr->proc); - psignal(mtr->proc, mtr->signal&(~METEOR_SIG_MODE_MASK)); + psignal(mtr->proc, mtr->signal); PROC_UNLOCK(mtr->proc); } } @@ -657,9 +657,9 @@ meteor_intr(void *arg) * If the user requested to be notified via signal, * let them know the field is complete. */ - if(mtr->proc && (mtr->signal & METEOR_SIG_MODE_MASK)) { + if(mtr->proc != NULL) { PROC_LOCK(mtr->proc); - psignal(mtr->proc, mtr->signal&(~METEOR_SIG_MODE_MASK)); + psignal(mtr->proc, mtr->signal); PROC_UNLOCK(mtr->proc); } } @@ -693,9 +693,9 @@ meteor_intr(void *arg) * If the user requested to be notified via signal, * let them know the frame is complete. */ - if(mtr->proc && !(mtr->signal & METEOR_SIG_MODE_MASK)) { + if(mtr->proc != NULL) { PROC_LOCK(mtr->proc); - psignal(mtr->proc, mtr->signal&(~METEOR_SIG_MODE_MASK)); + psignal(mtr->proc, mtr->signal); PROC_UNLOCK(mtr->proc); } /* @@ -1334,6 +1334,7 @@ meteor_ioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *td) { int error; int unit; + int sig; unsigned int temp; meteor_reg_t *mtr; struct meteor_counts *cnt; @@ -1392,14 +1393,12 @@ meteor_ioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct thread *td) *(u_short *)arg = mtr->fps; break; case METEORSSIGNAL: - if (*(int *)arg < 0 || *(int *)arg > _SIG_MAXSIG) - return EINVAL; - mtr->signal = *(int *) arg; - if (mtr->signal) { - mtr->proc = td->td_proc; - } else { - mtr->proc = (struct proc *)0; - } + sig = *(int *)arg; + /* Applications use 0 to reset signal delivery. */ + if (sig < 0 || sig > _SIG_MAXSIG) + return (EINVAL); + mtr->signal = sig; + mtr->proc = sig ? td->td_proc : NULL; break; case METEORGSIGNAL: *(int *)arg = mtr->signal; |