X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:mime-version:from:date:message-id:subject:to
	:content-type; q=dns; s=default; b=Zczo8ycxuWiC6e2wt15jAHWDh/Uq/
	Z+7/qXLuInysKuEFZdNLhADckiM1k59M15wzTwl4LRcbx1J8h/Zj/H3NJL9XRwJi
	b1B2Nv8H2bgkoYfhBQhndgirz5jul0RA4GQHfHcTYjSUD6tFzOzP8VOt1nG4DU5w
	pdsutQhEn944mo=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:mime-version:from:date:message-id:subject:to
	:content-type; s=default; bh=2HUqeZuln1WfS6gi2sdnC9qeTuk=; b=L3n
	1Dyqcsg9WE5UWLtW6gZu0npNl8Fxg9UFevB/pbOJQu71OjhDiWpT7ARqVG48ZO7U
	b1C02Idyt17eK4tHaXyBqHFXBXNci1X8nTx2J1hgxHpEcHosk3JqHaJwVi+VJcOA
	vCgmPC4JAn79nkhsdmP/zJVlvFjD/cXN+Wq9JFuU=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1366, environ, highly
X-HELO: mail-ua0-f180.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=1e100.net; s=20130820;        h=x-gm-message-state:mime-version:from:date:message-id:subject:to;        bh=Y7t87Xi7gn90ymkBxkjhbWJXVxypC6GloiwyQZamJ+8=;        b=lEK2egje2yuHEWTGie0dqFj8jA9w0BAYjgXPrA6Y+C5Z+4JCJ5qWcnKP3Xyggz1HkF         6TJZ8yydXWsqzZBFsAT/QsLqnpJE/Cw7OZ3doktIcP3htAIN2ocwAEGXky2dI6OzKR0g         Rk/VVLAvgne5vAHJE5B6S8DXwRu1flGQjOwVKwvjh4XXXXnjnCchXG4yHdtO9gGPtxqK         9TqZKsjPQ7dsY9hEm4clJ8DxNXbO+9kRUWcl/BMKx6T2ZW2m61T1GhfQ2giYtf2zdRZY         wL3aT6PmnqBB2Ph8ZqClWTaJ1zPWuj6TvLXMP5GpVMZEIDHqePCe7hUib0aO/IgRvWNg         U1lw==
X-Gm-Message-State: ABUngvf+8ztkETgZVO7OTc91mfHSy4rUn2YXtIqgvekx+nbsOhyEuUZnENdYbg1+qcDIU77b2e/YU8rLaTq06Q==
X-Received: by 10.176.2.110 with SMTP id 101mr1857987uas.8.1479389425567; Thu, 17 Nov 2016 05:30:25 -0800 (PST)
MIME-Version: 1.0
From: Erik Bray <erik.m.bray@gmail.com>
Date: Thu, 17 Nov 2016 14:30:24 +0100
Message-ID: <CAOTD34ZFH5E3r3AuDOXctss46e1hoU2f9pwE1mt4L674J2Ak_A@mail.gmail.com>
Subject: Retrieving per-process environment block?
To: cygwin@cygwin.com
Content-Type: text/plain; charset=UTF-8
X-IsSubscribed: yes

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.

Thanks,
Erik


[1] https://pythonhosted.org/psutil/

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

