RE: (Fwd) Re: includes inside squid.conf

From: Robert Collins <robert.collins@dont-contact.us>
Date: Wed, 3 Apr 2002 19:07:26 +1000

> -----Original Message-----
> From: Andres Kroonmaa [mailto:andre@online.ee]
> Sent: Wednesday, April 03, 2002 6:49 PM
> To: Robert Collins
> Cc: squid-dev@squid-cache.org
> Subject: RE: (Fwd) Re: includes inside squid.conf
>
>
>
> Solaris does have vfork for a pretty long time now, but
> child after vfork shares all memory with parent and should
> not muck around with it until exec. I'm not sure how much
> freedom this leaves to setup FDs properly and close unneeded
> files. As I understand it for now, we'd need to write
> forking code with special considerations for vfork. I have
> no experience on that matter. posix_spawn does not exist in sol8

The vfork+exec combination is ancient - it dates from unices without
copy-on-write fork().

If squid opens all the FD's with close-on-exec set, then to emulate
posix_spawn we can write

(roughly speaking)

squid_spawn (prog, argc, argv, fdc, fdarray);

int squid_spawn(prog, argc, argv, fdc, fdarray)
{
  // use fddup to 'backup' current fd's from 0 to fdc-1
  // use fddup to copy the fdarray contents to 0->fdc-1
  // vfork
  // in parent
    // restore fd's
  // in child
    // exec()
}

Rob
Received on Wed Apr 03 2002 - 02:07:32 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:56 MST