libreoffice-online/loolwsd/LOOLWSD.hpp
Henry Castro ee928f9af1 loolwsd: create lokit process id logs
Also, when used with --test option, create lokit PID log
so it is attached to the debugger.

gdb loolwsd $(cat /tmp/lokit.pid)
2015-08-05 20:20:05 -04:00

84 lines
2.3 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_LOOLWSD_HPP
#define INCLUDED_LOOLWSD_HPP
#include "config.h"
#include <string>
#include <mutex>
#include <Poco/Util/OptionSet.h>
#include <Poco/Random.h>
#include <Poco/Path.h>
#include <Poco/Util/ServerApplication.h>
#include <Poco/SharedMemory.h>
#include <Poco/NamedMutex.h>
class LOOLWSD: public Poco::Util::ServerApplication
{
public:
LOOLWSD();
~LOOLWSD();
// An Application is a singleton anyway, so just keep these as
// statics
static int portNumber;
static int timeoutCounter;
static bool doTest;
static std::string cache;
static std::string sysTemplate;
static std::string loTemplate;
static std::string childRoot;
static std::string loSubPath;
static std::string jail;
static Poco::SharedMemory _sharedForkChild;
static Poco::NamedMutex _namedMutexLOOL;
static const int DEFAULT_CLIENT_PORT_NUMBER = 9980;
static const int MASTER_PORT_NUMBER = 9981;
static const int INTERVAL_PROBES = 10;
static const int MAINTENANCE_INTERVAL = 1;
static const std::string CHILD_URI;
static const std::string PIDLOG;
static const std::string LOKIT_PIDLOG;
protected:
void initialize(Poco::Util::Application& self) override;
void uninitialize() override;
void defineOptions(Poco::Util::OptionSet& options) override;
void handleOption(const std::string& name, const std::string& value) override;
int main(const std::vector<std::string>& args) override;
private:
void displayHelp();
bool childMode() const;
void componentMain();
void desktopMain();
void startupComponent(int nComponents);
void startupDesktop(int nDesktop);
int createComponent();
int createDesktop();
Poco::UInt64 _childId;
static int _numPreSpawnedChildren;
static std::mutex _rngMutex;
static Poco::Random _rng;
#if ENABLE_DEBUG
public:
static bool runningAsRoot;
static int uid;
#endif
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */