httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wilfredo Sanchez <>
Subject Re: Shell?
Date Wed, 09 Feb 2000 01:54:05 GMT
|    Apache forks processes.. Thus are done via /bin/sh.  exec calls 
|    are done via sh as well.  Normal way under unix is to fork  
|    Apache is a 'process'  thingy model.  It doesn't do threads.
|    (see apache 2.00 though)

  This is false.  Simplisticly, fork() is an in-kernel procedure  
which copies a process and executes the new copy.  exec() does the  
same, but replaces the program text with some other program.  This  
does not typically involve a user-space program like sh.

  There are occasions where invoking sh is useful.  This is done  
explicitly, or by calling a function like system() which does it for  
you.  One example of why this is desired is the case where you have a  
user-provided command with arguments (perhaps obtained via  
httpd.conf in our case), and want to give the user the sort of  
flexibility and familiar handling that the shell provides when  
parsing commands.  The overhead of spawning the shell may not be a  
significant factor for one-shot or very infrequent operations such as  
starting or rotating a log file.  If you can afford to fork and  
exec, you presumably already have a fair bit of leeway.


       Wilfredo Sanchez,
Apple Computer, Inc., Core Operating Systems / BSD
          Open Source Engineering Lead
   1 Infinite Loop, 302-4K, Cupertino, CA 95014

View raw message