0
@@ -219,6 +219,7 @@ private:
0
string listenSocketName;
0
+ bool usingAbstractNamespace;
0
@@ -230,19 +231,27 @@ public:
0
* but the path does not have to be absolute.
0
* @param pid The process ID of this application instance.
0
* @param listenSocketName The name of the listener socket of this application instance.
0
+ * @param usingAbstractNamespace Whether <tt>listenSocketName</tt> refers to a Unix
0
+ * socket on the abstract namespace. Note that listenSocketName must not
0
+ * contain the leading null byte, even if it's an abstract namespace socket.
0
* @param ownerPipe The owner pipe of this application instance.
0
* @post getAppRoot() == theAppRoot && getPid() == pid
0
- Application(const string &theAppRoot, pid_t pid, const string &listenSocketName, int ownerPipe) {
0
+ Application(const string &theAppRoot, pid_t pid, const string &listenSocketName,
0
+ bool usingAbstractNamespace, int ownerPipe) {
0
this->listenSocketName = listenSocketName;
0
+ this->usingAbstractNamespace = usingAbstractNamespace;
0
this->ownerPipe = ownerPipe;
0
P_TRACE("Application " << this << ": created.");
0
virtual ~Application() {
0
+ if (usingAbstractNamespace) {
0
+ unlink(listenSocketName.c_str());
0
P_TRACE("Application " << this << ": destroyed.");
0
@@ -319,8 +328,12 @@ public:
0
struct sockaddr_un addr;
0
addr.sun_family = AF_UNIX;
0
- strncpy(addr.sun_path + 1, listenSocketName.c_str(), sizeof(addr.sun_path) - 1);
0
- addr.sun_path[0] = '\0';
0
+ if (usingAbstractNamespace) {
0
+ strncpy(addr.sun_path + 1, listenSocketName.c_str(), sizeof(addr.sun_path) - 1);
0
+ addr.sun_path[0] = '\0';
0
+ strncpy(addr.sun_path, listenSocketName.c_str(), sizeof(addr.sun_path));
0
addr.sun_path[sizeof(addr.sun_path) - 1] = '\0';
0
ret = ::connect(fd, (const sockaddr *) &addr, sizeof(addr));
Comments
No one has commented yet.