mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-14 02:57:47 +01:00
Add abstract namespace support for IPC sockets on Linux.
Converts an initial strudel or "at sign" (@) in the Unix socket path to a NULL character ('\0') indicating that the socket uses the abstract namespace instead of the filesystem namespace. For instance, binding a socket to 'ipc://@/tmp/tester' will not create a file associated with the socket whereas binding to 'ipc:///tmp/tester' will create the file /tmp/tester. See issue 567 for more information.
This commit is contained in:
parent
23e58e30d5
commit
31cdbd2afa
1
AUTHORS
1
AUTHORS
@ -20,6 +20,7 @@ Ben Gray <ben@benjamg.com>
|
|||||||
Bernd Prager <bernd@prager.ws>
|
Bernd Prager <bernd@prager.ws>
|
||||||
Bernd Melchers <melchers@ZEDAT.FU-Berlin.DE>
|
Bernd Melchers <melchers@ZEDAT.FU-Berlin.DE>
|
||||||
Bob Beaty <rbeaty@peak6.com>
|
Bob Beaty <rbeaty@peak6.com>
|
||||||
|
Brandon Carpenter <hashstat@yahoo.com>
|
||||||
Brian Buchanan <bwb@holo.org>
|
Brian Buchanan <bwb@holo.org>
|
||||||
Brett Cameron <Brett.Cameron@hp.com>
|
Brett Cameron <Brett.Cameron@hp.com>
|
||||||
Burak Arslan <burak-github@arskom.com.tr>
|
Burak Arslan <burak-github@arskom.com.tr>
|
||||||
|
@ -54,6 +54,10 @@ int zmq::ipc_address_t::resolve (const char *path_)
|
|||||||
|
|
||||||
address.sun_family = AF_UNIX;
|
address.sun_family = AF_UNIX;
|
||||||
strcpy (address.sun_path, path_);
|
strcpy (address.sun_path, path_);
|
||||||
|
#if defined ZMQ_HAVE_LINUX
|
||||||
|
if (*path_ == '@')
|
||||||
|
*address.sun_path = '\0';
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +69,15 @@ int zmq::ipc_address_t::to_string (std::string &addr_)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
|
#if !defined ZMQ_HAVE_LINUX
|
||||||
s << "ipc://" << address.sun_path;
|
s << "ipc://" << address.sun_path;
|
||||||
|
#else
|
||||||
|
s << "ipc://";
|
||||||
|
if (*address.sun_path)
|
||||||
|
s << address.sun_path;
|
||||||
|
else
|
||||||
|
s << "@" << address.sun_path + 1;
|
||||||
|
#endif
|
||||||
addr_ = s.str ();
|
addr_ = s.str ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user