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)

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


Home | Main Index | Thread Index | Old Index