nbd_set_socket_activation_name(3)

πŸ’– nbd_set_socket_activation_name β€” set the socket activation name πŸ’–

🌸 NAME 🌸

okay bestie, you're on the nbd_set_socket_activation_name(3) page in the LIBNBD manual, and this one is lowkey a lil name-tag moment for your socket πŸ’…

nbd_set_socket_activation_name β€” set the socket activation name ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

        #include <libnbd.h>

        int nbd_set_socket_activation_name (
              struct nbd_handle *h, const char *socket_name
            );

πŸŽ€ DESCRIPTION πŸŽ€

so when you're running an NBD server using nbd_connect_systemd_socket_activation(3), you can optionally name the socket. iconic, honestly. call this function before connecting to the server, fr fr 🫢

some servers, like qemu-storage-daemon(1), can use this info to associate the socket with a name used on the command line. most servers will just ignore it tho β€” not everyone is main character energy. the name is passed through the LISTEN_FDNAMES environment variable 🌈

the parameter socket_name can be a short alphanumeric string. if it's set to the empty string β€” which is also the default when the handle is created β€” then the server will see the name unknown πŸ‘€


⭐ RETURN VALUE ⭐

if the call is successful, the function returns 0. slay βœ…


πŸ’€ ERRORS πŸ’€

on error, -1 is returned 😭

refer to ERROR HANDLING in libnbd(3) for how to get further details of the error.

the following parameters must not be NULL: h, socket_name. for more info, see Non-NULL parameters in libnbd(3). no cap, those two have to be real.


πŸ‘‘ HANDLE STATE πŸ‘‘

you can call nbd_set_socket_activation_name when the handle is in these states, and here's the vibe check:

  • Handle created, before connecting β€” βœ… allowed
  • Connecting β€” ❌ error
  • Connecting & handshaking (opt_mode) β€” ❌ error
  • Connected to the server β€” ❌ error
  • Connection shut down β€” ❌ error
  • Handle dead β€” ❌ error

🧚 VERSION 🧚

this function first appeared in libnbd 1.16. periodt.

if you need to test if this function is available at compile time, check if the following macro is defined:

#define LIBNBD_HAVE_NBD_SET_SOCKET_ACTIVATION_NAME 1

πŸ”₯ SEE ALSO πŸ”₯


πŸ’œ AUTHORS πŸ’œ

  • Eric Blake
  • Richard W.M. Jones

Copyright Red Hat


πŸŽ€ LICENSE πŸŽ€

legal bestie moment β€” here's the license, word-for-word, because we do not mess with legal text:

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

kisses πŸ’‹ β€” this iconic page is from libnbd-1.25.8, dated 2026-10-13, and it's the nbd_set_socket_activation_name(3) manual page. periodt. πŸŽ€

πŸ“¦ where this page comes from