delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/02/10/08:06:31

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f
Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3C6669FA.58D4C84D@phekda.freeserve.co.uk>
Date: Sun, 10 Feb 2002 12:39:22 +0000
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: posix_spawn family [Was: Re: posix_spanw family]
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1020210132950 DOT 15572G-100000 AT is>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

Eli Zaretskii wrote:
> 
> On Fri, 8 Feb 2002, Richard Dawe wrote:
[snip]
> > Since we don't support fork(), I don't see how we can support
> > posix_spawn*().
[snip]
> So posix_spawn* functions allow us to comply to Posix functionality in a
> way that makes porting the original code a snap, if compared to what you
> need to do with a program that used fork/exec.  Unlike fork, which always
> fails in DJGPP, we can make these functions work as expected, at least for
> programs that don't require the parent and the child to run concurrently.

OK, maybe I'm too idealistic and want it to be perfect. ;)

I cannot see anything in the spec for posix_spawn* that allows you to tell it
to spawn a program and then wait for it to return. Presumably a program that
wanted to wait for the program to return would posix_spawn()/posix_spawnp()
and then wait() for the child to terminate. So would posix_spawn* work
something like this for DJGPP? 

Program calls posix_spawn*
    posix_spawn* save some random pid somewhere
    posix_spawn* calls normal spawn* to handle process invocation
    Spawned process runs, terminates
    posix_spawn* save the exit code somewhere
    posix_spawn* returns the random pid

Program calls wait
    wait retrieves saved random pid and exit code, returns them to program
 
> > Why does gettext need these functions?
> 
> Because it invokes subsidiary programs to do certain jobs.

I guessed that. 8) But I meant is it vital to gettext's functionality? Or is
there an easy work-around for DJGPP? (I guess we could just use spawn*
instead, for DJGPP.)

Juan - does it wait for the child programs to terminate?

FWIW glibc 2.1.3 on Linux does not seem to have posix_spawn*. I can't believe
gettext has shipped without being tested on any RedHat Linux 6.2 boxen. There
must be some code in gettext for platforms that don't support posix_spawn
(perhaps a wrapper that uses fork & exec ;) ).

Bye, Rich =]

-- 
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019