Question about process enumeration and _pinfo structure

Chris January
Tue May 28 15:47:00 GMT 2002

> >I want to add a member to the _pinfo structure which contains the command
> >line originally passed to the process. At the moment, when the Cygwin DLL
> >needs a list of the current Cygwin processes it uses winpids to enumerate
> >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 to:
> >i) make the command line an in-line array, e.g. char cmdline[1024];
> >or
> >ii) make the member a pointer to a string allocated on the cygwin heap.
> 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 space
> on something that was rarely used.  I also didn't want to have to recreate
> the command line in dll process startup.
A third alternative is to get the information from the process environment
block. However this is NT specific and doesn't handle fork'ed processes. I
don't understand why you would need to recreate the command line in dll
process startup though. So is any solution preferred or shall I just drop
the idea of /proc/<n>/cmdline ?


More information about the Cygwin-developers mailing list