[libc] Add socket test support library (#193207)
A couple of tests (and I plan to add a couple more) need to
create/compare unix domain socket addresses. This isn't completely
trivial due to the the interaction between the `addrlen` argument and
the terminating '\0', and the existing code doing that was subtly wrong
in some cases.
This patch centralizes the functions for these operations, reducing code
duplication and ensuring consistent (and correct) behavior everywhere.