Retrieving per-process environment block?
Corinna Vinschen
corinna-cygwin@cygwin.com
Thu Nov 17 18:11:00 GMT 2016
On Nov 17 14:30, Erik Bray wrote:
> Hi all,
>
> For a quick bit of background, I'm working on porting the highly
> useful psutil [1] Python library to Cygwin. This has proved an
> interesting exercise, as much of the functionality of psutil works on
> Cygwin through existing POSIX interfaces, and a handful of
> Linux-specific interfaces as well. But there are some bits that
> simply don't map at all.
>
> The one I'm struggling with right now is retrieving Cygwin environment
> variables for a process (under inspection--i.e. not listing a
> process's environment from within that process which is obviously
> trivial).
>
> I've looked at every route I could conceive of but as far as I can
> tell this is currently impossible. That's fine for now--I simply
> disable that functionality in psutil. But it is unfortunate, though,
> since the information is there.
>
> There are a couple avenues I could see to this. The most "obvious"
> (to me) being to implement /proc/<pid>/environ.
>
> I would be willing to provide a patch for this if it would be
> accepted. Is there some particular non-obvious hurdle to this that it
> hasn't been implemented? Obviously there are security
> implications--the /proc/<pid>/environ should only be readable to the
> process's owner, but that is already within Cygwin's capabilities, and
> works for other /proc files.
Patch welcome. Implementing this should be fairly straightforward.
The only hurdle is winsup/CONTRIBUTORS ;)
Thanks,
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20161117/f3082e3b/attachment.sig>
More information about the Cygwin
mailing list