Search code examples
linuxperlsocketsfastcgiunix-socket

How to use abstract names of unix domain sockets with fcgi in Perl in Linux?


In Linux, in Perl, using the FCGI module, using the Open Socket function, is it possible to create an unix domain sockets using abstract names?

I tried to create a socket starting with a null character \0wibble \zwibble \x{0}wibble and it didn't work!

It worked only using pathname, as described in unix(7):

$socket = FCGI::OpenSocket( "/tmp/wibble", 10 );

Thank you!


Solution

  • The implementation underlying FCGI::OpenSocket() doesn't support it.

    That call ultimately calls a C function int OS_CreateLocalIpcFd(const char *bindPath, int backlog). You can immediately infer that the bindPath argument is understood as a NUL-terminated, rather than a NUL-prefixed, string.

    If you could supply your own socket to FCGI.pm, you might have a chance at making this work.