Deskflow 1.22.0.197
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
ArchDaemonUnix Class Reference

Unix implementation of IArchDaemon. More...

#include <ArchDaemonUnix.h>

Inheritance diagram for ArchDaemonUnix:
Collaboration diagram for ArchDaemonUnix:

Public Member Functions

 ArchDaemonUnix ()=default
 ~ArchDaemonUnix () override=default
int daemonize (const char *name, DaemonFunc const &func) override
 Daemonize the process.
Public Member Functions inherited from ArchDaemonNone
 ArchDaemonNone ()=default
 ~ArchDaemonNone () override=default
void installDaemon (const char *name, const char *description, const char *pathname, const char *commandLine, const char *dependencies) override
 Install daemon.
void uninstallDaemon (const char *name) override
 Uninstall daemon.
bool canInstallDaemon (const char *name) override
 Check if user has permission to install the daemon.
bool isDaemonInstalled (const char *name) override
 Check if the daemon is installed.
void installDaemon () override
 Install daemon.
void uninstallDaemon () override
 Uninstall daemon.
std::string commandLine () const override
 Get the command line.
Public Member Functions inherited from IArchDaemon
Public Member Functions inherited from IInterface
virtual ~IInterface ()=default
 Interface destructor does nothing.

Additional Inherited Members

Public Types inherited from IArchDaemon
using DaemonFunc = std::function<int(int, const char **)>

Detailed Description

Unix implementation of IArchDaemon.

Constructor & Destructor Documentation

◆ ArchDaemonUnix()

ArchDaemonUnix::ArchDaemonUnix ( )
default

◆ ~ArchDaemonUnix()

ArchDaemonUnix::~ArchDaemonUnix ( )
overridedefault

Member Function Documentation

◆ daemonize()

int ArchDaemonUnix::daemonize ( const char * name,
DaemonFunc const & func )
overridevirtual

Daemonize the process.

Daemonize. Throw XArchDaemonFailed on error. name is the name of the daemon. Once daemonized, func is invoked and daemonize returns when and what it does.

Exactly what happens when daemonizing depends on the platform.

  • unix: Detaches from terminal. func gets passed one argument, the name passed to daemonize().
  • win32: Becomes a service. Argument 0 is the name of the service and the rest are the arguments passed to StartService(). func is only called when the service is actually started. func must call ArchMiscWindows::runDaemon() to finally becoming a service. The runFunc function passed to runDaemon() must call ArchMiscWindows::daemonRunning(true) when it enters the main loop (i.e. after initialization) and ArchMiscWindows::daemonRunning(false) when it leaves the main loop. The stopFunc function passed to runDaemon() is called when the daemon must exit the main loop and it must cause runFunc to return. func should return what runDaemon() returns. func or runFunc can call ArchMiscWindows::daemonFailed() to indicate startup failure.

Reimplemented from ArchDaemonNone.


The documentation for this class was generated from the following files: