As I understand it, a unix domain socket is a file (with its own FS inode) that internally points to a socket inode (namespaced internally by the kernel). This is evident by inspecting the file descriptors of the binding process, returning a value such as socket:[345678]
.
Typically, unix domain sockets can be mv
/rm
'd, etc. within the same filesystem, as their own file inodes do not change in such instances (as mv
is just a hard link + unlink, conceptually).
However, if I wanted to move a socket file to a new filesystem, such that a new filesystem inode would have to be allocated to the socket file, I'd need to somehow register that new socket file with the underlying socket descriptor in the kernel.
Is there a way to do this, transparently and without affecting the running, bound server process?
Particularly interested in doing this in C, but conceptually understanding this is also helpful. It's probably worth mentioning that, I assume, mknod()
will be involved, and that's OK in this case. I just have no idea how to go about invoking it correctly.