Unix域(AF_UNIX)套接字的端点(文件)放在哪里? [英] Where to place Unix Domain (AF_UNIX) sockets' end points (files)?
问题描述
是否有约定将表示端点的文件"放置到Unix域套接字?
Is there a convention where to place the 'files' representing the end points to Unix Domain Sockets?
我倾向于将它们放到/tmp/some-application-specific-subdir-name/
,但是我想知道是否还有更常见的地方.
I tend to put them to /tmp/some-application-specific-subdir-name/
, but I wonder if there is a more common place.
背景是, POSIX 不清楚关于访问这样的文件"的最大路径长度:
The background is, that POSIX is not clear about the maximum path length to access such 'files':
有意地未定义sun_path的大小.这是因为不同的实现使用不同的大小.例如,4.3 BSD使用大小为108,4.4 BSD使用大小为104.由于大多数实现源自BSD版本,因此大小通常在92到108范围内.
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.
应用程序不应假定sun_path的特定长度,也不能假定它可以容纳{_POSIX_PATH_MAX}个字节(256).
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.
推荐答案
(它以前是 /var/run
.)
(It used to be /var/run
.)
这篇关于Unix域(AF_UNIX)套接字的端点(文件)放在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!