cloudius-systems / osv

OSv, a new operating system for the cloud.
osv.io
Other
4.1k stars 602 forks source link

Support unpaired unix domain sockets #355

Open nyh opened 10 years ago

nyh commented 10 years ago

Our existing Unix-domain socket support is currently limited to socketpair() (but see also issue #351).

If an application tries to create an unpaired Unix-domain socket with socket() with the AF_LOCAL (a.k.a PF_LOCAL or PF_UNIX) domain, it will fail:

    auto fd = socket(AF_LOCAL, SOCK_STREAM, 0);
    report(fd >= 0, "create AF_LOCAL socket");
    if (fd < 0) {
        perror("socket() failed");
    }

We get

socket() failed: Protocol not supported

To be honest, this is not a high-priority issue, because creating a Unix domain socket is not very useful for OSv's intended single-process use cases: Unix-domain sockets are a good one to communicate between two unrelated processes (a file name is used as an "address" for Unix-domain sockets), and allows interesting things like sending open file descriptors between the two processes. When OSv doesn't support more than one process anyway, the only reason we might need Unix-domain sockets is to support specific legacy applications which need them.

One user, for example, tried to run netperf's STREAM_STREAM (unix domain socket streaming test), which failed because we don't support unix domain sockets.

glommer commented 10 years ago

For tracking, MySQL does not run at all without unix sockets - even if it is disabled in the configuration file. My apps port is carrying a patch that disables it. Whenever we have UNIX sockets support, we should clean that up.