ソースを参照

Merge branch 'systemd' of https://github.com/CendioOssman/tigervnc

pull/1722/head
Pierre Ossman 4ヶ月前
コミット
0bec9f984a

+ 3
- 0
BUILDING.txt ファイルの表示

* All build requirements Xorg imposes (see its documentation) * All build requirements Xorg imposes (see its documentation)
* patch * patch


-- If building x0vncserver with socket activation support:
* libsystemd

-- Optional ffmpeg development kit support (libav) -- Optional ffmpeg development kit support (libav)
* You might have to enable additional repositories for this. E.g., * You might have to enable additional repositories for this. E.g.,
on RHEL, EPEL and RPMFusion (free + nonfree) need to be enabled. on RHEL, EPEL and RPMFusion (free + nonfree) need to be enabled.

+ 8
- 0
CMakeLists.txt ファイルの表示

endif() endif()
endif() endif()


# check for systemd support (socket activation)
if(UNIX AND NOT APPLE)
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(LIBSYSTEMD libsystemd)
endif()
endif()

# Generate config.h and make sure the source finds it # Generate config.h and make sure the source finds it
configure_file(config.h.in config.h) configure_file(config.h.in config.h)
add_definitions(-DHAVE_CONFIG_H) add_definitions(-DHAVE_CONFIG_H)

+ 6
- 0
unix/x0vncserver/CMakeLists.txt ファイルの表示

target_include_directories(x0vncserver PUBLIC ${CMAKE_SOURCE_DIR}/common) target_include_directories(x0vncserver PUBLIC ${CMAKE_SOURCE_DIR}/common)
target_link_libraries(x0vncserver tx rfb network rdr unixcommon) target_link_libraries(x0vncserver tx rfb network rdr unixcommon)


# systemd support (socket activation)
if (LIBSYSTEMD_FOUND)
add_definitions(-DHAVE_SYSTEMD_H)
target_link_libraries(x0vncserver ${LIBSYSTEMD_LIBRARIES})
endif()

if(X11_FOUND AND X11_XTest_LIB) if(X11_FOUND AND X11_XTest_LIB)
add_definitions(-DHAVE_XTEST) add_definitions(-DHAVE_XTEST)
target_link_libraries(x0vncserver ${X11_XTest_LIB}) target_link_libraries(x0vncserver ${X11_XTest_LIB})

+ 43
- 0
unix/x0vncserver/x0vncserver.cxx ファイルの表示

#include <rfb/Timer.h> #include <rfb/Timer.h>
#include <network/TcpSocket.h> #include <network/TcpSocket.h>
#include <network/UnixSocket.h> #include <network/UnixSocket.h>
#ifdef HAVE_SYSTEMD_H
# include <systemd/sd-daemon.h>
#endif


#include <signal.h> #include <signal.h>
#include <X11/X.h> #include <X11/X.h>
caughtSignal = true; caughtSignal = true;
} }


static bool hasSystemdListeners()
{
#ifdef HAVE_SYSTEMD_H
// This also returns true on errors, because we then assume we were
// meant to use systemd but failed somewhere
return sd_listen_fds(0) != 0;
#else
return false;
#endif
}

static int createSystemdListeners(std::list<SocketListener*> *listeners)
{
#ifdef HAVE_SYSTEMD_H
int count = sd_listen_fds(0);
if (count < 0) {
vlog.error("Error getting listening sockets from systemd: %s",
strerror(-count));
return count;
}

for (int i = 0; i < count; ++i)
listeners->push_back(new TcpListener(SD_LISTEN_FDS_START + i));

return count;
#else
(void)listeners;
return 0;
#endif
}



class FileTcpFilter : public TcpFilter class FileTcpFilter : public TcpFilter
{ {
Configuration::removeParam("SendCutText"); Configuration::removeParam("SendCutText");
Configuration::removeParam("MaxCutText"); Configuration::removeParam("MaxCutText");


// Assume different defaults when socket activated
if (hasSystemdListeners())
rfbport.setParam(-1);

for (int i = 1; i < argc; i++) { for (int i = 1; i < argc; i++) {
if (Configuration::setParam(argv[i])) if (Configuration::setParam(argv[i]))
continue; continue;


VNCServerST server(desktopName, &desktop); VNCServerST server(desktopName, &desktop);


if (createSystemdListeners(&listeners) > 0) {
// When systemd is in charge of listeners, do not listen to anything else
vlog.info("Listening on systemd sockets");
}

if (rfbunixpath.getValueStr()[0] != '\0') { if (rfbunixpath.getValueStr()[0] != '\0') {
listeners.push_back(new network::UnixListener(rfbunixpath, rfbunixmode)); listeners.push_back(new network::UnixListener(rfbunixpath, rfbunixmode));
vlog.info("Listening on %s (mode %04o)", (const char*)rfbunixpath, (int)rfbunixmode); vlog.info("Listening on %s (mode %04o)", (const char*)rfbunixpath, (int)rfbunixmode);

+ 4
- 3
unix/x0vncserver/x0vncserver.man ファイルの表示

.B \-rfbport \fIport\fP .B \-rfbport \fIport\fP
Specifies the TCP port on which x0vncserver listens for connections from Specifies the TCP port on which x0vncserver listens for connections from
viewers (the protocol used in VNC is called RFB - "remote framebuffer"). viewers (the protocol used in VNC is called RFB - "remote framebuffer").
The default port is 5900. Specify \fB-1\fP to disable listening on a TCP
port.
Specify \fB-1\fP to disable listening on a TCP port. The default port is
5900 when started directly, and -1 when activated by a systemd socket.
. .
.TP .TP
.B \-UseIPv4 .B \-UseIPv4
.TP .TP
.B \-rfbunixpath \fIpath\fP .B \-rfbunixpath \fIpath\fP
Specifies the path of a Unix domain socket on which x0vncserver listens for Specifies the path of a Unix domain socket on which x0vncserver listens for
connections from viewers.
connections from viewers. Default is to not listen to any Unix domain
socket.
. .
.TP .TP
.B \-rfbunixmode \fImode\fP .B \-rfbunixmode \fImode\fP

読み込み中…
キャンセル
保存