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

前端 未结 3 1790
醉酒成梦
醉酒成梦 2020-12-23 16:51

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-sub

相关标签:
3条回答
  • 2020-12-23 17:10

    In Android you can place it in /dev/socket/

    0 讨论(0)
  • 2020-12-23 17:21

    The FHS says: /run

    (It used to be /var/run.)

    0 讨论(0)
  • 2020-12-23 17:28

    On Ubuntu, the netstat command shows UNIX Domain Sockets in multiple different places. Some, however a few, in /var/run, as JB suggested; most of them in @/tmp/… (I believe the @ designate abstract names, which is Linux specific), and some others in various application's specific places. So in practice, the most common location seems to be in /tmp, at least on Ubuntu, which is a rather common platform. Note the /tmp location particularly makes sense here, as UDS has to be created by each bind and to be deleted afterwards (either when the socket is closed, or when the application exit, or when the application starts the next time and before its next invocation to bind).

    0 讨论(0)
提交回复
热议问题