device driver, threads and signal

Pascal A. Dupuis (dupuis@lei.ucl.ac.be)
Wed, 28 Jul 1999 12:26:00 +0200 (CEST)


Hello,

I'm developping an acquisition program, coupled to a National Instruments
Lab-PC card. I made a substancial number of changes to a driver found on
the LLP home page, and added support for RT-Linux (2.0.36). The
acquisition program is using threads, and the driver read() routine looks
like :
STATIC int dev_read ( struct inode *inode, struct file *file,
char *buffer, int count )
{
1) Verify params and writability to *buffer
2) Verify that an acquisition is running, otherwise start one
while (count > 0) {
send all available datas to user space, count-= n
sleeps until there are more datas
}
The sleeping part is
current->timeout = jiffies + dev->timeout;
interruptible_sleep_on( &(sync->wait) );
timeout = current->timeout;
current->timeout = 0;
if (signal_pending( current )) {
printk( KERN_ERR "%s:%s interrupted, signal 0x%lx ,blocked 0x%lx\n",
__FILE__, __FUNCTION__, current->signal,
current->blocked );
/* Try to restart automagically. The only problem is that
we may loose the semaphore */
return -(ERESTARTNOINTR);
}
if (0 == timeout) {
printk( KERN_ERR "Lab-PC+ %s:%s timeout at %ld jiffies, xtime %d\n",
__FILE__, __FUNCTION__, jiffies, xtime.tv_sec );
print_board_state();
suspend_acquisition();
return -(ERESTARTSYS);
}

The printed trace of the problem is always

"Interrupted, signal = 0x800, blocked = 0x200"

According to linux/include/asm/signal.h, the first one is SIG_USR2, the
second one is SIG_USR1. The driver exits, and the acquisition program
restarts it, and, well, I got nothing usefull.

The main driver contains two such routines, associated with different
parts of the card. The problem only occurs when accessing more than one
part simultaneously. Is it possible, in the driver, to defer processing of
the SIG_USR2 signal ? Would adding it dynamically to current->blocked upon
entry and removing it be OK (races or others nasty things) ?

Thanks in advance

Pascal A. Dupuis

-- 
«J'ai installe le package contenant m4 afin de configurer mon
 sendmail.cf.. et depuis, lorsque je demarre, je me retrouve avec un:
 Kernel Panic: VFS: unable to mount root fs on 08:01 !!! kesaco?!»
-+- LA in Guide du linuxien pervers : "Alors ça c'est pas de chance !" -+-

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/