Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nx-libs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dimbor
nx-libs
Commits
aaf4a59e
Commit
aaf4a59e
authored
Feb 09, 2015
by
Mike Gabriel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add X11 abstract socket support to nxcomp/nxproxy (027_nxcomp_abstract-X11-socket.full+lite.patch).
parent
3384aba3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
60 deletions
+38
-60
027_nxcomp_abstract-X11-socket.full+lite.patch
...an/patches/027_nxcomp_abstract-X11-socket.full+lite.patch
+0
-59
series
debian/patches/series
+0
-1
Loop.cpp
nxcomp/Loop.cpp
+38
-0
No files found.
debian/patches/027_nxcomp_abstract-X11-socket.full+lite.patch
deleted
100644 → 0
View file @
3384aba3
Description: Add X11 abstract socket support to nxcomp/nxproxy
Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
diff --git a/nxcomp/Loop.cpp b/nxcomp/Loop.cpp
index 92b6fc2..d86809d 100644
--- a/nxcomp/Loop.cpp
+++ b/nxcomp/Loop.cpp
@@ -4250,6 +4250,39 @@ int SetupDisplaySocket(int &xServerAddrFamily, sockaddr *&xServerAddr,
// where the socket will be created.
//
+ // Try abstract X11 socket first (via a test connect), if that fails
+ // fall back to Unix domain socket file.
+
+ #ifdef __linux__
+ int testSocketFD;
+ testSocketFD = socket(xServerAddrFamily, SOCK_STREAM, PF_UNSPEC);
+
+ int len = sprintf(unixSocketName + 1, "/tmp/.X11-unix/X%d", xPort);
+ unixSocketName[0] = '\0';
+
+ sockaddr_un *xServerAddrABSTRACT = new sockaddr_un;
+ memset(xServerAddrABSTRACT, 0, xServerAddrLength);
+ xServerAddrABSTRACT -> sun_family = AF_UNIX;
+ memcpy(xServerAddrABSTRACT -> sun_path, unixSocketName, len+1);
+ xServerAddrLength = len +3;
+
+ int ret = connect(testSocketFD, (struct sockaddr *) xServerAddrABSTRACT, xServerAddrLength);
+ if (ret == 0) {
+
+ cerr << "Info" << ": Using abstract X11 socket in kernel namespace "
+ << "for accessing DISPLAY=:" << xPort << ".\n";
+
+ close(testSocketFD);
+ xServerAddr = (sockaddr *) xServerAddrABSTRACT;
+ return 1;
+
+ } else {
+
+ cerr << "Info" << ": Falling back to file system X11 socket "
+ << "for accessing DISPLAY=:" << xPort << ".\n";
+
+ #endif
+
struct stat statInfo;
char unixSocketDir[DEFAULT_STRING_LENGTH];
@@ -4322,6 +4355,11 @@ int SetupDisplaySocket(int &xServerAddrFamily, sockaddr *&xServerAddr,
xServerAddr = (sockaddr *) xServerAddrUNIX;
xServerAddrLength = sizeof(sockaddr_un);
+
+ #ifdef __linux__
+
+ }
+ #endif
}
else
{
debian/patches/series
View file @
aaf4a59e
027_nxcomp_abstract-X11-socket.full+lite.patch
028_nx-X11_abstract-kernel-sockets.full.patch
029_nxcomp_ppc64.full+lite.patch
030_nx-X11_configure-args.full.patch
...
...
nxcomp/Loop.cpp
View file @
aaf4a59e
...
...
@@ -4250,6 +4250,39 @@ int SetupDisplaySocket(int &xServerAddrFamily, sockaddr *&xServerAddr,
// where the socket will be created.
//
// Try abstract X11 socket first (via a test connect), if that fails
// fall back to Unix domain socket file.
#ifdef __linux__
int
testSocketFD
;
testSocketFD
=
socket
(
xServerAddrFamily
,
SOCK_STREAM
,
PF_UNSPEC
);
int
len
=
sprintf
(
unixSocketName
+
1
,
"/tmp/.X11-unix/X%d"
,
xPort
);
unixSocketName
[
0
]
=
'\0'
;
sockaddr_un
*
xServerAddrABSTRACT
=
new
sockaddr_un
;
memset
(
xServerAddrABSTRACT
,
0
,
xServerAddrLength
);
xServerAddrABSTRACT
->
sun_family
=
AF_UNIX
;
memcpy
(
xServerAddrABSTRACT
->
sun_path
,
unixSocketName
,
len
+
1
);
xServerAddrLength
=
len
+
3
;
int
ret
=
connect
(
testSocketFD
,
(
struct
sockaddr
*
)
xServerAddrABSTRACT
,
xServerAddrLength
);
if
(
ret
==
0
)
{
cerr
<<
"Info"
<<
": Using abstract X11 socket in kernel namespace "
<<
"for accessing DISPLAY=:"
<<
xPort
<<
".
\n
"
;
close
(
testSocketFD
);
xServerAddr
=
(
sockaddr
*
)
xServerAddrABSTRACT
;
return
1
;
}
else
{
cerr
<<
"Info"
<<
": Falling back to file system X11 socket "
<<
"for accessing DISPLAY=:"
<<
xPort
<<
".
\n
"
;
#endif
struct
stat
statInfo
;
char
unixSocketDir
[
DEFAULT_STRING_LENGTH
];
...
...
@@ -4322,6 +4355,11 @@ int SetupDisplaySocket(int &xServerAddrFamily, sockaddr *&xServerAddr,
xServerAddr
=
(
sockaddr
*
)
xServerAddrUNIX
;
xServerAddrLength
=
sizeof
(
sockaddr_un
);
#ifdef __linux__
}
#endif
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment