HomeFreeBSD

ktrace: make ktr_tid a long not intptr_t (NFC)

Description

ktrace: make ktr_tid a long not intptr_t (NFC)

Long ago, ktr_tid was ktr_buffer which pointed to the buffer following
the header and was used internally in the kernel. Use was removed in
efbbbf570d70b and it was repurposed as ktr_kid in c6854c347f4d8. For
ABI reasons, it stayed an intptr_t rather than becoming an lwpid_t at
the time. Since it doesn't hold a pointer any more (unless you have
a ktrace.out from 2005), change the type to long which is alwasy the
same size on all supported architectures. Add a suggestion to change
the type to lwpid_t (__int32_t) on a future ABI break.

Remove most remaining references to ktr_buffer, retaing a comment in
kdump.c explaining why negative values are treated as 0. While here,
accept that pid_t and lwpid_t are of type int and simplify casts in
printf.

This changed was motivated by CheriBSD where intptr_t is 16-bytes
in the pure-capability ABI.

Reviewed by: kib, markj
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D36599

Details

Provenance
brooksAuthored on Sep 17 2022, 8:21 AM
Reviewer
kib
Differential Revision
D36599: ktrace: make ktr_tid a long not intptr_t (NFC)
Parents
rG714300faecbe: Change sysctl section to 3 as suggested by Benjamin Kaduk.
Branches
Unknown
Tags
Unknown