Re: Porting SANE backends

Milon Firikis (milonf@ariadne-t.gr)
Fri, 26 Feb 1999 17:06:29 +0200

Oliver Rauch wrote:
>
> Svend Daugaard Pedersen wrote:
>
> > - don't use 'alloca()'
> > this routine is not an ANSI routine and it is difficult
> > (in many cases impossible) to implement in a C system not
> > having it.
> >
>
> Thats no problem, changed it in the umax backend.
>
> > - don't use 'fork()' and related routines
> > if you feel it is necessary, do it in a way that makes it
> > easy to change the code (snapscan.c is a good example) or
> > better: make this part of the code conditional.
> >
>
> What is the problem with fork. The amiga has a multi-tasking system, soI don`t
> understand the problem.

Well win32 is also a multitasking system (sort of) but it does not have
fork(). What I want to say is that fork() is defined bu Unix and Posix
implementations but it is not a LibC or an ANSI C routine such as
malloc. The only reason that this (kernel) function is being used in
backends is to prevent the blocking of the frontend application during
the sanei_scsi_read. AFAIK fork() has already give some problems with
the OS/2 port where the fork() is very expensive.

The proper way to resolve this is to make a wrapper much like the way
sanei_scsi_* routines work. This way when somebody wants to port SANE in
a new platform he should code only the implementation around the wrapper
which is system dependent. I should say it again that the sanei_scsi*
routines are the perfect example of an analogous implementation.

MF

--
Source code, list archive, and docs: http://www.mostang.com/sane/
To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com