tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Interface to retrieve LWPs via ptrace(2)

In article <>,
Kamil Rytarowski  <> wrote:
>On 03.11.2016 14:10, Joerg Sonnenberger wrote:
>> On Tue, Nov 01, 2016 at 03:58:10PM +0100, Kamil Rytarowski wrote:
>>> Which one is preferred for NetBSD?
>> I'd go with neither, but base the new interface on FreeBSD's.
>> PT_GETLWPS takes as argument:
>> struct ptrace_getinfos_request {
>>   size_t allocated_lwps;
>>   size_t current_lwps;
>>   struct ptrace_lwpinfo[];
>> }
>> The caller provides allocated_lwps and promises that the buffer can hold
>> sizeof(ptrace_getinfos_request) + allocated_lwps * sizeof(ptrace_lwpinfo)
>> byte. The kernel writes up to allocated_lwps entries and sets
>> current_lwps to the current total number of lwps. The caller can then
>> easily check how many entries it has to allocate and maybe repeat the
>> request.

Before adding more PT_ stuff, we should see if libpthread_dbg (td_open() etc.)
have enough stuff to support what you want. They do for gdb. This was written
for SA threads because they were M:N threads but it still works.


Home | Main Index | Thread Index | Old Index