unpack_sockaddr_un#

Extract the filesystem path from a packed sockaddr_un.

Σύνοψη#

my ($path) = unpack_sockaddr_un($sockaddr);

Τι επιστρέφεται#

The sun_path field as a string, trimmed at the first NUL byte, or undef if the input is too short to be a sockaddr_un.

Παραδείγματα#

my ($path) = unpack_sockaddr_un(getsockname($sock));
print "listening on $path\n";

Οριακές περιπτώσεις#

  • Abstract Linux-namespace sockets have a leading NUL; the result is truncated at that first NUL, so callers that need the full abstract name must unpack the raw bytes themselves.

  • Input shorter than 3 bytes yields undef.

Διαφορές από το upstream#

Fully compatible with upstream Socket.

Δείτε επίσης#

  • pack_sockaddr_un - reverse direction.