Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.development.apps > #84

Re: posix_spawnp never fails

From Rainer Weikusat <rweikusat@mssgmbh.com>
Newsgroups comp.os.linux.development.apps
Subject Re: posix_spawnp never fails
Date 2011-04-21 18:12 +0100
Message-ID <87sjtby1d3.fsf@sapphire.mobileactivedefense.com> (permalink)
References <8cabb561-1598-4449-a821-6384386f36d5@z7g2000prh.googlegroups.com> <b6bd3c86-7703-4307-b530-8025f17ac186@d26g2000prn.googlegroups.com> <39f75515-532d-4350-8c02-bc999b4d1c39@f31g2000pri.googlegroups.com>

Show all headers | View raw


Peter <excessphase@gmail.com> writes:
> On Apr 20, 3:37 pm, David Schwartz <dav...@webmaster.com> wrote:

[...]

>> > But posix_spawnp seems to always succeed.
>>
>> That's correct, because it has spawned a process and doesn't implement
>> any way to communicate a "late failure" back to the parent.
>
> Correct in a sense that this is a fact?  Or correct in a sense that
> it should be like that?  I really do not see any use of returning
> success in case of "no such file or directory".

This is an error which occurs in the newly created process and it
doesn't transfer to the old one by magic. Provided the implementation
of posix_spawn behaves in this way, you can wait (using a wait system
call) for the child to terminate and examine the exit status, just as
for any other process.

[...]

>> >  cannot use the mess of pipe/fork/exec/write(errno),
>> > since this seems to be not supported as I was told recently --
>> > "there is nothing supported which can be done in the cloned child
>> > process
>> > than execvp() or _exit()"
>> > especiallly in multithreaded environments.
>>
>> I know of no platform on which that sequence of calls won't work.
>> Other than execp and _exit, all you need are 'write' and 'close'. It
>> is routine practice to make those calls in the child after a 'fork'.
>> There is no other way to set up the child's stdin/stdout/stderr.
>
> http://www.google.com/search?q=fork+exec+multithreading&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

Is this supposed to communicate anything beyond that a lot of rubbish
can be found on the web?

Back to comp.os.linux.development.apps | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

posix_spawnp never fails Peter <excessphase@gmail.com> - 2011-04-20 07:38 -0700
  Re: posix_spawnp never fails Rainer Weikusat <rweikusat@mssgmbh.com> - 2011-04-20 16:17 +0100
  Re: posix_spawnp never fails David Schwartz <davids@webmaster.com> - 2011-04-20 15:37 -0700
    Re: posix_spawnp never fails Peter <excessphase@gmail.com> - 2011-04-21 09:15 -0700
      Re: posix_spawnp never fails Rainer Weikusat <rweikusat@mssgmbh.com> - 2011-04-21 18:12 +0100
        Re: posix_spawnp never fails Peter <excessphase@gmail.com> - 2011-04-21 11:25 -0700
          Re: posix_spawnp never fails Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2011-04-21 12:33 -0600
            Re: posix_spawnp never fails Peter <excessphase@gmail.com> - 2011-04-21 12:49 -0700
              Re: posix_spawnp never fails Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2011-04-21 14:57 -0600
                Re: posix_spawnp never fails Peter <excessphase@gmail.com> - 2011-04-21 14:09 -0700
                Re: posix_spawnp never fails Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2011-04-21 16:31 -0600
                Re: posix_spawnp never fails Richard Kettlewell <rjk@greenend.org.uk> - 2011-04-22 11:25 +0100
                Re: posix_spawnp never fails Rainer Weikusat <rweikusat@mssgmbh.com> - 2011-04-22 18:02 +0100
              Re: posix_spawnp never fails Rainer Weikusat <rweikusat@mssgmbh.com> - 2011-04-22 17:58 +0100
      Re: posix_spawnp never fails Peter <excessphase@gmail.com> - 2011-04-21 10:25 -0700
      Re: posix_spawnp never fails David Schwartz <davids@webmaster.com> - 2011-04-25 16:57 -0700

csiph-web