sane-project-website/old-archive/1997-12/0027.html

133 wiersze
4.7 KiB
HTML

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

<!-- received="Thu Dec 4 14:18:12 1997 PST" -->
<!-- sent="Thu, 04 Dec 1997 17:17:46 -0500" -->
<!-- name="Michael Sweet" -->
<!-- email="mike@easysw.com" -->
<!-- subject="Running out of processes, going in SANE..." -->
<!-- id="" -->
<!-- inreplyto="" -->
<title>sane-devel: Running out of processes, going in SANE...</title>
<h1>Running out of processes, going in SANE...</h1>
<b>Michael Sweet</b> (<a href="mailto:mike@easysw.com"><i>mike@easysw.com</i></a>)<br>
<i>Thu, 04 Dec 1997 17:17:46 -0500</i>
<p>
<ul>
<li> <b>Messages sorted by:</b> <a href="date.html#27">[ date ]</a><a href="index.html#27">[ thread ]</a><a href="subject.html#27">[ subject ]</a><a href="author.html#27">[ author ]</a>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0028.html">Benedikt Eric Heinen: "Re: second SCSI controller.."</a>
<li> <b>Previous message:</b> <a href="0026.html">Helmut Koeberle: "Backend for Canon CanoScan 600"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>
<!-- body="start" -->
OK,<br>
<p>
Today I started some mass scanning of pictures (of my wedding) using<br>
SANE. After about 2 dozen I started having scanning problems, and I<br>
couldn't run simple commands like "man"...<br>
<p>
After a little investigation it turns out that the mustek, qcam, and<br>
umax backends don't have a SIGCHLD handler and don't do a wait() on<br>
the reader process all the time, so the child processes created by the<br>
backend each time a scan or preview is done stick around until<br>
(x)scanimage exits... The only time a wait() is done by the backends<br>
is if you cancel a scan...<br>
<p>
So.... here's a quick patch that fixes the problems in 0.67 (I haven't<br>
grabbed 0.68 quite yet...):<br>
<p>
--- mustek.c.orig Thu Dec 4 17:09:52 1997<br>
+++ mustek.c Thu Dec 4 17:15:22 1997<br>
@@ -2614,7 +2614,14 @@<br>
Mustek_Scanner *s = handle;<br>
<br>
if (s-&gt;reader_pid &gt; 0)<br>
+ {<br>
+ int exit_status;<br>
+<br>
kill (s-&gt;reader_pid, SIGTERM);<br>
+ while (wait (&amp;exit_status) != s-&gt;reader_pid);<br>
+ s-&gt;reader_pid = 0;<br>
+ };<br>
+<br>
s-&gt;scanning = SANE_FALSE;<br>
}<br>
<br>
--- qcam.c.orig Thu Dec 4 17:09:59 1997<br>
+++ qcam.c Thu Dec 4 17:14:26 1997<br>
@@ -1505,7 +1505,14 @@<br>
sane_cancel (handle);<br>
<br>
if (s-&gt;reader_pid &gt;= 0)<br>
+ {<br>
+ int exit_status;<br>
+<br>
kill (s-&gt;reader_pid, SIGTERM);<br>
+ while (wait (&amp;exit_status) != s-&gt;reader_pid);<br>
+ s-&gt;reader_pid = 0;<br>
+ };<br>
+<br>
if (s-&gt;to_child &gt;= 0)<br>
close (s-&gt;to_child);<br>
if (s-&gt;from_child &gt;= 0)<br>
@@ -2001,6 +2008,7 @@<br>
char buf[1024];<br>
ssize_t nread;<br>
int flags;<br>
+ int exit_status;<br>
<br>
DBG(1, "cancel: cancelling read request\n");<br>
<br>
@@ -2026,6 +2034,9 @@<br>
<br>
/* now restore non-blocking i/o flag: */<br>
fcntl (s-&gt;from_child, F_SETFL, flags &amp; O_NONBLOCK);<br>
+<br>
+ while (wait (&amp;exit_status) != s-&gt;reader_pid);<br>
+ s-&gt;reader_pid = 0;<br>
<br>
DBG(1, "cancel: cancellation completed\n");<br>
}<br>
--- umax.c.orig Thu Dec 4 17:10:07 1997<br>
+++ umax.c Thu Dec 4 17:11:44 1997<br>
@@ -2211,7 +2211,15 @@<br>
<br>
DBG(10,"sane_cancel\n");<br>
<br>
- if (scanner-&gt;reader_pid &gt; 0) { kill(scanner-&gt;reader_pid, SIGTERM); }<br>
+ if (scanner-&gt;reader_pid &gt; 0)<br>
+ {<br>
+ int exit_status;<br>
+<br>
+ /* ensure child knows it's time to stop: */<br>
+ kill (scanner-&gt;reader_pid, SIGTERM);<br>
+ while (wait (&amp;exit_status) != scanner-&gt;reader_pid);<br>
+ scanner-&gt;reader_pid = 0;<br>
+ }<br>
scanner-&gt;scanning = SANE_FALSE;<br>
}<br>
<br>
<p>
<pre>
--
________________________________________________________________________
Mike Sweet Software for SGI and Sun Easy Software Products
(301) 373-9603 Workstations 44145 Airport View Drive
mike@easysw.com <a href="http://www.easysw.com">http://www.easysw.com</a> Hollywood, Maryland 20636
<p>
SUPPORT THE ANTI-SPAM AMENDMENT! - <a href="http://www.cauce.org">http://www.cauce.org</a>
<p>
<pre>
--
Source code, list archive, and docs: <a href="http://www.mostang.com/sane/">http://www.mostang.com/sane/</a>
To unsubscribe: echo unsubscribe sane-devel | mail <a href="mailto:majordomo@mostang.com">majordomo@mostang.com</a>
</pre>
<!-- body="end" -->
<p>
<ul>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0028.html">Benedikt Eric Heinen: "Re: second SCSI controller.."</a>
<li> <b>Previous message:</b> <a href="0026.html">Helmut Koeberle: "Backend for Canon CanoScan 600"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>