sane-project-website/old-archive/1999-02/0222.html

116 wiersze
4.1 KiB
HTML
Czysty Zwykły widok Historia

<!-- received="Sun Feb 28 08:21:13 1999 PST" -->
<!-- sent="Sun, 28 Feb 1999 18:21:32 +0200" -->
<!-- name="Milon Firikis" -->
<!-- email="milonf@ariadne-t.gr" -->
<!-- subject="Re: Porting SANE backends" -->
<!-- id="" -->
<!-- inreplyto="Porting SANE backends" -->
<title>sane-devel: Re: Porting SANE backends</title>
<h1>Re: Porting SANE backends</h1>
<b>Milon Firikis</b> (<a href="mailto:milonf@ariadne-t.gr"><i>milonf@ariadne-t.gr</i></a>)<br>
<i>Sun, 28 Feb 1999 18:21:32 +0200</i>
<p>
<ul>
<li> <b>Messages sorted by:</b> <a href="date.html#222">[ date ]</a><a href="index.html#222">[ thread ]</a><a href="subject.html#222">[ subject ]</a><a href="author.html#222">[ author ]</a>
<!-- next="start" -->
<li> <b>Next message:</b> <a href="0223.html">becka@rz.uni-duesseldorf.de: "Re: Info Peripherals' ImageReaderISA"</a>
<li> <b>Previous message:</b> <a href="0221.html">Paul Jakma: "Re: Xsane &amp; GNOME..."</a>
<li> <b>Maybe in reply to:</b> <a href="0178.html">Svend Daugaard Pedersen: "Porting SANE backends"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>
<!-- body="start" -->
Oliver Rauch wrote:<br>
<i>&gt; </i><br>
<i>&gt; But there must be a routine on other system that creates a new process.</i><br>
<i>&gt; So where is the problem to implement an own wrapper that is called via</i><br>
<i>&gt; fork() ?</i><br>
<i>&gt; </i><br>
<i>&gt; Bye</i><br>
<i>&gt; Oliver</i><br>
<i>&gt; </i><br>
<p>
Unfortunately fork() is rather not trivial to implement. Just take a<br>
look at the amount of effort being produced for the gnu-win32 tools by<br>
the cygnus guys. They implement fork() based in the CreateProcess32 all<br>
right but from what I have "heard" wasn't easy task. Also keep in mind<br>
that other systems may be more thread friendly than process friendly.<br>
<p>
Note that the objective is to hide all Unix specific functions from the<br>
backend much like the sanei_scsi_ routines do for scsi operations. It is<br>
a fact that under SANE is possible to provide an ASPI implementation of<br>
sanei_scsi_cmd* under win32 thus providing the natural bridge for<br>
porting the bulk (SCSI) of sane backends under win32. I think that<br>
somebody has already did that...<br>
<p>
Anyway since the backends using fork() only for allowing non blocking<br>
access to the frontends I had something like this in mind:<br>
<p>
DISCLAIMER: I am writing this of memory. Please don't shoot.<br>
<p>
############<br>
sane_start_scan() {<br>
<p>
Initialize and start the actual scan<br>
<p>
fd=sanei_StartDetachedReadProcess(sane_dev, TheActualSubroutine, other<br>
variables... )<br>
^^^^^<br>
provided by SANE API<br>
...}<br>
<p>
where fd is created by a pipe inside sanei_StartDetachedReadProcess<br>
<p>
######################<br>
<p>
sanei_StartDetachedReadProcess(sane_dev, TheActualSubroutine, other<br>
variables... ){<br>
<p>
#if POSIX_UNIX<br>
pipe(rw)<br>
<p>
if (!fork()) /* Child */<br>
{<br>
close(rw[0]);<br>
mysterious UNIX signal handling sigaction, sigfillset and more...<br>
_exit(TheActualReaderSubroutine(sane_dev, rw[1])) <br>
}<br>
<p>
close(rw[1]);<br>
<p>
return rw[0];<br>
<p>
// sane_read will read from the pipe and not directly from the sane_dev<br>
descriptor while<br>
// TheActualReaderSubroutine will read from sane_dev and write to rw[1]<br>
<p>
#elif OS2_THREADS<br>
<p>
// I don't have a clue for non Unix cases &amp;&amp;|| Threads<br>
<p>
#elif AMIGA_THREADS<br>
<p>
#else<br>
<p>
#endif<br>
}<br>
<p>
<p>
MF<br>
<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="0223.html">becka@rz.uni-duesseldorf.de: "Re: Info Peripherals' ImageReaderISA"</a>
<li> <b>Previous message:</b> <a href="0221.html">Paul Jakma: "Re: Xsane &amp; GNOME..."</a>
<li> <b>Maybe in reply to:</b> <a href="0178.html">Svend Daugaard Pedersen: "Porting SANE backends"</a>
<!-- nextthread="start" -->
<!-- reply="end" -->
</ul>