This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/6399] gettid() should have a wrapper


http://sourceware.org/bugzilla/show_bug.cgi?id=6399

--- Comment #17 from Michael Kerrisk <mtk.manpages at gmail dot com> 2013-02-09 02:53:06 UTC ---
(In reply to comment #16)
> I don't see how caching could have any effect on namespaces. Any application is
> able (and entitled) to store its own pid and assume that remains constant for
> the lifetime of the process. Whether this happens in application-level code or
> libc-level code is rather irrelevant.

So, a possible implementation of PID namespaces would have allowed setns() to
change the caller's PID namespace, which in effect would change the caller's
PID. Of course, this is not done. Instead, setns() into a PID namespace only
changes the PID namespace of children subsequently created by the caller. 

One of the cited reasons that setns() didn't change the PID namespace of the
caller is because glibc caches PIDs, and the result of getpid() would thus no
longer be correct. 

Now, you could say that the issue equally affects the application itself, but
there is a difference: if an application calls setns(), then it would know (in
that alternative implementation model) that its PID was about to change and
that any PID that *it* had cached was now invalid.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]