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.
This commit is contained in:
parent
09a759d347
commit
1855be730c
@ -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:
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user