>>
>> The lwpid is 1, not zero, of course.
>
> Is 1 a reasonable value for pi->prstatus.pr_lwp.pr_lwpid ? (It looks
> rather fishy to me.)
The first lwpid is 1, like the first pid is 1.
$ ps -fLp 1,$$
UID PID PPID LWP NLWP CLS PRI C STIME TTY LTIME COMD
root 1 0 1 1 TS 70 0 Jun 25 ? 5:26
/sbin/init
john 1576 1574 1 1 TS 70 0 Jul 06 pts/19 0:00 -bash