This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: error setting up ipc-daemon

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.
      |\      _,,,---,,_
ZZZzz /,`.-'`'    -.  ;-;;,_
     |,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:
Bug reporting:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]