[sane-devel] Signal-Handling-Question ( OS/2)

Franz Bakan Franz Bakan" <fbakan@gmx.net
Fri, 21 Nov 2003 01:43:19 +0100 (CET)


Hi,

Perhaps someone can help me with this:

When I try to stop a scan with scanimage using Ctrl+C on
OS/2 the System crashes ( TRAP D). This is probably
a fault of the driver used for SCSI-access.

I can work around this problem by encapsulating all DosDevIOCtl()
functions in  a DosEnterMustComplete()   DosExitMustComplete() pair.

But this 'solution' is not perfect. When I now 'Ctrl+C' the scanner stops,
the error-LED on the scanner (EPSON GT-9500) lights up and
scanimage tells:

scanimage.exe: received signal 2
scanimage.exe: trying to stop scanner

and _wait's_ until I SIGKILL the process (second Ctrl+C doesn't work).

- How to tell scanimage that the scanner allready has stopped?
- How do I reset the scanner so that the error-led turns off again?
  (OK I can use the RESET-button of my EPSON-Scanner, but other
   scanners probably don't have a RESET-Button)
  Probably some atexit() function but where and how to place it,
  scanimage allready has one?


In a second approach I've tried the following:

 /* Prevent the calling process from being killed */
 sigfillset(&all);
 sigprocmask(SIG_BLOCK, &all, &oldset);

  DosDevIOCtl()

 /* Now it is ok to be killed */
 sigprocmask(SIG_SETMASK, &oldset, NULL);

But this way the machine still crashes hard when entering Ctrl+C
(Perhaps I made a mistake with the syntax?)

- How do I correctly delay SIG_INT with unix-like functions?

Hoping for some enlightenment,

Franz