This header used to be included by sys/types.h in glibc, and musl
adopted the behaviour. However, this dependency was never desired, so
glibc deprecated it in 2016 and finally removed it in 2019, and so did
musl. Explicitly including the header should be a no-op on older libc
versions and fixes the build on newer versions.
https://sourceware.org/bugzilla/show_bug.cgi?id=19239https://git.musl-libc.org/cgit/musl/commit/?id=f552c79
For the common case where we have pts/ or tty do it straight
away. Otherwise traverse /dev for a match. This fixes ps(1) when
it is executed over a serial terminal with tty names like ttyAMA0.