Where to place Unix Domain (AF_UNIX) sockets' end points (files)?

alk picture alk · Sep 28, 2011 · Viewed 17.7k times · Source

Is there a convention where to place the 'files' representing the end points to Unix Domain Sockets?

I tend to put them to /tmp/some-application-specific-subdir-name/, but I wonder if there is a more common place.

The background is, that POSIX is not clear about the maximum path length to access such 'files':

The size of sun_path has intentionally been left undefined. This is because different implementations use different sizes. For example, 4.3 BSD uses a size of 108, and 4.4 BSD uses a size of 104. Since most implementations originate from BSD versions, the size is typically in the range 92 to 108.

Applications should not assume a particular length for sun_path or assume that it can hold {_POSIX_PATH_MAX} bytes (256).

So this "restriction" on the path's length should be kept out of the application's file/path name configurations.

Answer

JB. picture JB. · Sep 28, 2011

The FHS says: /run

(It used to be /var/run.)