Operating systems limit the length of a path of a Unix domain socket. How can I check whether a particular path is within that limit?
Or, to put it another way, how can I check the maximum permitted length of a path of a Unix domain socket, on a Linux or Mac OS X system?
My use case here is for SSH multiplexing: if the ControlPath is too long, then SSH multiplexing won't work since it creates a unix domain sockets. I want to be able to check for a valid control path without having to actually start an ssh session and look for the error message.
Best Answer
On Linux, this length is usually defined as 108.
It is defined by the
UNIX_PATH_MAX
variable in the/usr/include/linux/un.h
header file :You could find further info here :