This is the mail archive of the
mailing list for the glibc project.
[Bug libc/15607] Add threadsafe version of getenv()
- From: "hadess at hadess dot net" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Wed, 12 Jun 2013 15:06:53 +0000
- Subject: [Bug libc/15607] Add threadsafe version of getenv()
- Auto-submitted: auto-generated
- References: <bug-15607-131 at http dot sourceware dot org/bugzilla/>
--- Comment #3 from Bastien Nocera <hadess at hadess dot net> ---
(In reply to Jakub Jelinek from comment #2)
> It is certainly not straightforward or cleaner, if all the uses of getenv in
> glibc are converted to a version that requires locking, there will be a
> significant cost to all apps out there, not just one particular that does
> something like this.
> The current behavior of setenv/putenv is clearly documented.
"The implementation of getenv() is not required to be reentrant."
"POSIX.1-2001 does not require setenv() or unsetenv() to be reentrant."
"does not require" vs. "does not require and glibc's implementation is not".
> Why exactly do you want to change environment of the running multi-threaded
> process, as opposed just making sure that upon exec the executed programs
> will get the desired environment?
This is very early in running gnome-settings-daemon (not after minutes, or even
seconds, it's the first thing we do), but we read the stored configuration
using GSettings, which uses D-Bus. That D-Bus implementation (the one in glib)
uses threads, thus with a single call to get the configuration value, we're
> You can use execle or execvpe functions for that.
It still makes for pretty complicated and unfriendly code.
You are receiving this mail because:
You are on the CC list for the bug.