delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/02/18/15:59:24

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Tue, 18 Feb 2003 15:31:33 -0500 (EST)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Andrew DeFaria <ADeFaria AT Salira DOT com>
cc: cygwin AT cygwin DOT com
Subject: Re: error setting up ipc-daemon
In-Reply-To: <3E528171.8040009@Salira.com>
Message-ID: <Pine.GSO.4.44.0302181519560.7773-100000@slinky.cs.nyu.edu>
Importance: Normal
MIME-Version: 1.0

On Tue, 18 Feb 2003, Andrew DeFaria wrote:

> Igor Pechtchanski wrote:
>
> > Randall,
> >
> > An excerpt from "cygrunsrv --help" below
> >
> > -e, --env <VAR=VALUE> Optional environment strings which are added
> > to the environment when service is started.
> > You can add up to 255 environment strings using
> > the `--env' option.
> > Note: /bin is always added to $PATH to allow all
> > started applications to find at least cygwin1.dll.
> >
> > shows that you shouldn't really need to add c:\cygwin\bin to your system
> > path (if one uses cygrunsrv, that is). If that is not the case, then it's
> > a bug in cygrunsrv (or an error in documentation).
> > Igor
>
> Or perhaps you're reading it wrong. I read it as cygrunsrv will stick
> these environment variables into the environment of the process that it
> starts. Of course starting of cygrunsrv will also require access to
> cygwin1.dll and if that is not in your Windows System Environment
> Variable PATH (i.e. where the services pick up their environment
> variable PATH - before you log in) then cygrunsrv will fail too.

I don't see where I could have misread it, frankly.  I was really talking
about the "Note:" section.  But, for the sake of completeness:

Cygrunsrv will setenv() all the variables specified with the -e flag, and
will also add (append) ":/bin" to the PATH before fork()/exec().
Cygrunsrv itself does not need c:\cygwin\bin in the PATH, since the
application will look in both the current directory and the directory it
resides in for the necessary DLLs, and cygrunsrv resides in /bin.  The
only reason you need it in the path, in fact, is for applications residing
in other directories, such as /usr/sbin or /sbin (e.g., in.ftpd).

> You see the way I see it cygrunsrv starts then forks the "service" you
> configured with it. Of course this now brings up the question of why
> doesn't cygrunsrv "exec" the service so that you don't see extra
> cygrunsrv processes in Task Manager. Perhaps the answer is that then it
> can't stuff the child's environment with these --env parms.

The child inherits the parent's environment.  Cygrunsrv does fork()/exec()
instead of simply exec()ing because it needs to retain control in case the
service cannot start, to reset Windows service-related data structures.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Oh, boy, virtual memory! Now I'm gonna make myself a really *big* RAMdisk!
  -- /usr/games/fortune


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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