This is the mail archive of the libc-alpha@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]

Re: Caching of PID/TID after fork


On 06/10/2016 21:43, Zack Weinberg wrote:
> On Thu, Oct 6, 2016 at 8:42 PM, Zack Weinberg <zackw@panix.com> wrote:
>> On Thu, Oct 6, 2016 at 5:35 PM, Robert Święcki <robert@swiecki.net> wrote:
>>> Maybe providing something like fork_with_flags(int flags) would work
>>> here? Seems that most (all?) the projects that I've seen, which use
>>> clone() directly and had problems with caching of TID/PID, basically
>>> need fork with some flags (mainly of the CLONE_NEW* type). Such
>>> function would deal with tid/gid/locks/pthread_atfork as fork does,
>>> but would also OR the provided flags with the canonical ones?
>>
>> I've thought for quite some time that there should be a second
>> clone-wrapper in glibc that doesn't ask for a new stack.  It might be
>> better to call it something with "clone" in the name, but I don't care
>> terribly much.
> 
> Meant to say: in addition to the PID/TID caching issues, this would be
> able to run pthread_atfork() handlers.
> 
> zw

Adding a new implementation would require either change the clone
prototype (since flags is used for the kernel defined ones) or
adding a new arch-specific implementation.  This is an extra
burden on current assembly-only clone variants and for new
ports (an extra symbol to implement).

The stack check seems just error-prone one and I see it might be
justifiable to remove it.  I am not sure how we should act on 
semantic change for Linux-only syscall, so it might require to 
add compatibility symbol I would try to avoid it.  Also, this path
would lead to more arch-specific assembly hackery that I would
try to avoid.


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