summaryrefslogtreecommitdiff
path: root/src/sys/time.rs
diff options
context:
space:
mode:
authorAlan Somers <asomers@gmail.com>2021-12-21 18:48:28 -0700
committerAlan Somers <asomers@gmail.com>2021-12-30 21:00:32 -0700
commitf7b62f607cb336a24153c8f46d837681e49197e8 (patch)
tree9c3c55fcb0aebcfb137e1c8c5d10e9a2281b436c /src/sys/time.rs
parent6d07477fac02d14ddd885fa298346d4403c2aacb (diff)
downloadnix-f7b62f607cb336a24153c8f46d837681e49197e8.zip
Optimize UnixAddr for the BSDs
On BSD-derived operating systems, struct sockaddr has a sa_len field that holds the length of the structure. UnixAddr's path_len field is redundant. Remove path_len on BSD-derived OSes, retaining it only for Illumos and Linux-based OSes. Also, ensure that two UnixAddrs compare equal if they differ only by the presence of a trailing NUL. On Linux, syscalls like getsockname add a trailing NUL to the sockaddr they return, even if no NUL was present on the sockaddr originally passed to the kernel via a syscall like bind, and even though the docs explicitly say that any NUL passed to bind is not considered to be part of the address. Work around this bug by stripping it in UnixAddrKind::get(), so that at least two UnixAddrs will compare identical even if they differ in the presence of a trailing NUL.
Diffstat (limited to 'src/sys/time.rs')
0 files changed, 0 insertions, 0 deletions