Question about process enumeration and _pinfo structure
Wed May 29 18:35:00 GMT 2002
> >> >I want to add a member to the _pinfo structure which contains the
> >> >line originally passed to the process. At the moment, when the Cygwin
> >> >needs a list of the current Cygwin processes it uses winpids to
> >> >the processes and the _pinfo structures for each Cygwin process are
> >> >from a named file mapping. So to store the command line I either need
> >> >i) make the command line an in-line array, e.g. char cmdline;
> >> >or
> >> >ii) make the member a pointer to a string allocated on the cygwin
> >> I'm not wild about either idea. The reason there is no command line in
> >> the pinfo structure is because I didn't want to waste shared memory
> >> on something that was rarely used. I also didn't want to have to
> >> the command line in dll process startup.
> >A third alternative is to get the information from the process
> >block. However this is NT specific and doesn't handle fork'ed processes.
> >don't understand why you would need to recreate the command line in dll
> >process startup though.
> The command line is not always passed to the process. It can get just an
> argv list.
> >So is any solution preferred or shall I just drop the idea of
> >/proc/<n>/cmdline ?
> How about a "get_argv" option to cygwin_internal?
> I'll see if I can come up with something.
While you'll looking at this, there are some other things that I need to be
able to get information about too:
i) the current directory of a process. Presently, this is stored in the
cygheap structure, which AFAIK is inaccessible outside of that process. I
have some code which uses some undocumented NT internal structures that gets
the current directory of a Win32 process, but this doesn't allow for
symlinks and virtual paths (a la /proc).
ii) the environment of a process. This can be got with just NT internal
calls, but I'd prefer to have something that works on Win 9x too.
iii) a processes' fd table. Again, this is stored in the cygheap structure.
iv) the current root of the process (cf chroot). Again, this is stored in
the cygheap structure.
More information about the Cygwin-developers