rust/library/std/src/net
Matthias Krüger 8223831942
Rollup merge of #146937 - joboet:gethostname, r=Mark-Simulacrum
std: implement `hostname`

Resolves https://github.com/rust-lang/libs-team/issues/330
Tracking issue: https://github.com/rust-lang/rust/issues/135142

This is based on rust-lang/rust#135141, but I've reimplemented the UNIX version, which now:
* uses `sysconf(_SC_HOST_NAME_MAX)` as an initial buffer length
* returns `OutOfMemory` if the `Vec` allocation fails
* retries the operation if it detects that the name returned by `gethostname` was truncated

Additionally, as part of the rebase, I had to move some WinSock abstractions (initialisation and error access) to `sys::pal` so that they can be accessed from `sys::net::hostname`.

CC ``@orowith2os`` (and thank you for your work!)
2025-09-29 21:42:41 +02:00
..
ip_addr Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
socket_addr Fix SocketAddrV6: Display tests 2023-06-14 15:21:15 -04:00
tcp std: make address resolution weirdness local to SGX 2025-09-08 16:58:43 +02:00
udp std: make address resolution weirdness local to SGX 2025-09-08 16:58:43 +02:00
hostname.rs std: implement hostname 2025-09-29 10:24:54 +02:00
ip_addr.rs std: replace the FromInner implementation for addresses with private conversion functions 2025-02-12 14:13:35 +01:00
mod.rs std: implement hostname 2025-09-29 10:24:54 +02:00
socket_addr.rs Explicitly note &[SocketAddr] impl of ToSocketAddrs. 2025-09-24 15:56:38 -07:00
tcp.rs std: make address resolution weirdness local to SGX 2025-09-08 16:58:43 +02:00
test.rs Fix test hangs on AIX 2025-03-04 10:06:28 -05:00
udp.rs std: make address resolution weirdness local to SGX 2025-09-08 16:58:43 +02:00