tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
pthread2lwp API
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
I need to extract lwp (lwpid_t) from arbitrary -- and not the current
one -- POSIX thread (pthread_t). I need to access sysctl(7)
interfaces for lwp and read its properties with a given pthread_t.
In my current use-case is to access l_rtime_sec and l_rtime_usec from
struct kinfo_lwp.
I don't see a way to do it cleanly, something different than reading
opaque pthread_t pointer and accessing rawly pt_lid at some offset.
FreeBSD has similar interface, but only working for the current thread:
pthread_getthreadid_np()
Linux:
pthread_getunique_np()
and thread id = pid: syscall(__NR_gettid)
Maybe something like it:
int pthread_tolwp_np(pthread_t, lwpid_t*);
int pthread_fromlwp_np(pthread_t*, lwpid_t);
When error - return value != 0 and set errno.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBCAAGBQJXGgqTAAoJEEuzCOmwLnZsIKsP/1e/zxWuOB+qBioIu2LfR+nv
FdUu62xNMaA+3v94PUppdwhOl+ZqrAh5vL96CepDRmGsOWM+BOL8XdqJzPuV3rsl
2U9D+r5ye8q6S08ytbBMI2+QJu3NXex2RY7VOMcKZ9uJ1N+R7bpfVQj1pzx0OoIl
MU9ba3JXqB6psfpSJzq2FdE5UL0HHAl5xsCQw4nJM2jQrheHVG+4hgnwEhkuw446
2dyIjf1QOc2/jq6KSZ+PyF2ECsrBJDwhCfvXyXTBQjmJtcKJg3eEBu5/jbUtH+WK
1kG5C/t0Yqz02bw20nKbP147YYT0P3P6gVsNPosW+La/sowX/1JmtpcYNy4Qa6Nz
8kbuQG1SvNPGdrmTbsECHICHwU7VYksHshchUE82LkjTukVQB0bkKMIBXdZTaM2F
ZmByy8b5SXmYbRo4a7//iKavsB/E/VyBsACokw+F2tkMwosdcSRIHVuDxqkbPcyi
GKLVRjRaW0TscZZfdf+Ife5RbuEHLlMj5za7Pumt1Wew9RQjzB7ROd/IzWN82ts7
+RwU6rA1kn90WDZwBfg1lWU+xL0FYeCcW0Nmo3olsQL2dKzfNe9gFga5clSPFqNU
RZp7uRavZLEAXimkTg0Xx/09dDFDTDYLhOHuRYranxYSW4F7fOoqZPZNV7Pute1W
lU+6nxCqiD1jRthZO/5z
=nlIi
-----END PGP SIGNATURE-----
Home |
Main Index |
Thread Index |
Old Index