Skip to content

Commit

Permalink
Fix process container build (#1650)
Browse files Browse the repository at this point in the history
Co-authored-by: MFransen69 <39826971+MFransen69@users.noreply.github.com>
  • Loading branch information
sebaszm and MFransen69 authored Jun 18, 2024
1 parent 431ba5a commit 2d91420
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 44 deletions.
2 changes: 1 addition & 1 deletion Source/Thunder/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ namespace PluginHost {
ProcessContainerConfig& operator=(ProcessContainerConfig&& move) noexcept
{
if (this != &move) {
Logging = std::move(move.Logging;
Logging = std::move(move.Logging);
}
return (*this);
}
Expand Down
4 changes: 0 additions & 4 deletions Source/com/Communicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
#include <limits>
#include <memory>

#ifdef PROCESSCONTAINERS_ENABLED
#include "ProcessInfo.h"
#endif

namespace Thunder {
namespace RPC {

Expand Down
2 changes: 1 addition & 1 deletion Source/com/Communicator.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@


#ifdef PROCESSCONTAINERS_ENABLED
#include "../processcontainers/ProcessContainer.h"
#include <processcontainers/ProcessContainer.h>
#endif


Expand Down
1 change: 0 additions & 1 deletion Source/extensions/processcontainers/Messaging.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

#include "Module.h"

#include "../messaging/messaging.h"

namespace Thunder {
namespace ProcessContainers {
Expand Down
1 change: 1 addition & 0 deletions Source/extensions/processcontainers/Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#endif

#include <core/core.h>
#include <messaging/messaging.h>

#if defined(__WINDOWS__) && defined(CONTAINERS_EXPORTS)
#undef EXTERNAL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ AWCListener::AWCListener(AWCStateChangeNotifier * notifier)
: _notifier(notifier)
{}

void AWCListener::notifyWindowChange(int window_id, awc::AWCClient::awc_window_state_t window_state, unsigned int pid)
void AWCListener::notifyWindowChange(int window_id VARIABLE_IS_NOT_USED, awc::AWCClient::awc_window_state_t window_state VARIABLE_IS_NOT_USED, unsigned int pid VARIABLE_IS_NOT_USED)
{
// intentionally left empty
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct AWCProcessorInfo : public BaseRefCount<IProcessorInfo> {
return 0;
}

uint64_t CoreUsage(uint32_t coreNum) const
uint64_t CoreUsage(uint32_t coreNum VARIABLE_IS_NOT_USED) const
{
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ bool AWCProxyContainer::Start(const string &command, IStringIterator &params)

/* provided timeout is not used. Thunder provides 0ms timeout by default
* and if this function returns false next Stop() will be retried after 10s */
bool AWCProxyContainer::Stop(const uint32_t timeout /*ms*/)
bool AWCProxyContainer::Stop(const uint32_t timeout /*ms*/ VARIABLE_IS_NOT_USED)
{
if(!IsRunning())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "CRunImplementation.h"
#include "JSON.h"
#include <thread>

namespace Thunder {
Expand All @@ -31,7 +31,7 @@ namespace ProcessContainers {
return cRunContainerAdministrator;
}

IContainer* CRunContainerAdministrator::Container(const string& id, IStringIterator& searchpaths, const string& logpath, const string& configuration)
IContainer* CRunContainerAdministrator::Container(const string& id, IStringIterator& searchpaths, const string& logpath, const string& configuration VARIABLE_IS_NOT_USED)
{
searchpaths.Reset(0);
while (searchpaths.Next()) {
Expand Down Expand Up @@ -61,7 +61,7 @@ namespace ProcessContainers {
{
}

void CRunContainerAdministrator::Logging(const string& logPath, const string& loggingOptions)
void CRunContainerAdministrator::Logging(const string& logPath VARIABLE_IS_NOT_USED, const string& loggingOptions VARIABLE_IS_NOT_USED)
{
// Only container-scope logging
}
Expand Down Expand Up @@ -101,7 +101,7 @@ namespace ProcessContainers {
Core::Directory(logPath.c_str()).CreatePath();

libcrun_error_t error = nullptr;
int ret = init_logging(&_context.output_handler, &_context.output_handler_arg, _name.c_str(), (logPath + "/container.log").c_str(), &error);
int ret = libcrun_init_logging(&_context.output_handler, &_context.output_handler_arg, _name.c_str(), (logPath + "/container.log").c_str(), &error);
if (ret != 0) {
TRACE_L1("Cannot initialize logging of container \"%s\" in directory %s\n. Error %d: %s", _name.c_str(), logPath.c_str(), error->status, error->msg);
}
Expand Down Expand Up @@ -225,7 +225,7 @@ namespace ProcessContainers {
return result;
}

bool CRunContainer::Stop(const uint32_t timeout /*ms*/)
bool CRunContainer::Stop(const uint32_t timeout /*ms*/ VARIABLE_IS_NOT_USED)
{
bool result = true;
libcrun_error_t error = nullptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,18 @@
#include "processcontainers/common/BaseRefCount.h"
#include "processcontainers/common/CGroupContainerInfo.h"


PUSH_WARNING(DISABLE_WARNING_PEDANTIC)

extern "C" {
#include <crun/container.h>
#include <crun/error.h>
#include <crun/status.h>
#include <crun/utils.h>
}

POP_WARNING()

namespace Thunder {
namespace ProcessContainers {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <Dobby/IpcService/IpcFactory.h>
#include <fstream>
#include <thread>
#include <json/value.h>

namespace Thunder {

Expand All @@ -36,7 +35,7 @@ namespace ProcessContainers {
return dobbyContainerAdministrator;
}

IContainer* DobbyContainerAdministrator::Container(const string& id, IStringIterator& searchpaths, const string& logpath, const string& configuration)
IContainer* DobbyContainerAdministrator::Container(const string& id, IStringIterator& searchpaths, const string& logpath, const string& configuration VARIABLE_IS_NOT_USED)
{
searchpaths.Reset(0);
while (searchpaths.Next()) {
Expand Down Expand Up @@ -97,7 +96,7 @@ namespace ProcessContainers {
{
}

void DobbyContainerAdministrator::Logging(const string& logPath, const string& loggingOptions)
void DobbyContainerAdministrator::Logging(const string& logPath VARIABLE_IS_NOT_USED, const string& loggingOptions VARIABLE_IS_NOT_USED)
{
// Only container-scope logging
}
Expand Down Expand Up @@ -173,7 +172,7 @@ namespace ProcessContainers {
return result;
}

void DobbyContainerAdministrator::containerStopCallback(int32_t cd, const std::string& containerId,
void DobbyContainerAdministrator::containerStopCallback(int32_t cd VARIABLE_IS_NOT_USED, const std::string& containerId,
IDobbyProxyEvents::ContainerState state,
const void* params)
{
Expand Down Expand Up @@ -390,7 +389,7 @@ namespace ProcessContainers {
return result;
}

bool DobbyContainer::Stop(const uint32_t timeout /*ms*/)
bool DobbyContainer::Stop(const uint32_t timeout /*ms*/ VARIABLE_IS_NOT_USED)
{
// TODO: add timeout support
bool result = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,24 +132,6 @@ namespace ProcessContainers {
return _interfaces.at(_current).addresses[id];
}

LXCContainer::Config::ConfigItem::ConfigItem(const ConfigItem& copy)
: Core::JSON::Container()
, Key(copy.Key)
, Value(copy.Value)
{
Add(_T("key"), &Key);
Add(_T("value"), &Value);
}

LXCContainer::Config::ConfigItem::ConfigItem(ConfigItem&& move)
: Core::JSON::Container()
, Key(std::move(move.Key))
, Value(std::move(move.Value))
{
Add(_T("key"), &Key);
Add(_T("value"), &Value);
}

LXCContainer::Config::Config()
: Core::JSON::Container()
, ConsoleLogging("0")
Expand Down Expand Up @@ -369,7 +351,7 @@ namespace ProcessContainers {
return result;
}

bool LXCContainer::Stop(const uint32_t timeout /*ms*/)
bool LXCContainer::Stop(const uint32_t timeout VARIABLE_IS_NOT_USED /*ms*/)
{
bool result = true;

Expand Down Expand Up @@ -410,7 +392,7 @@ namespace ProcessContainers {
uint32_t LXCContainer::Release() const
{
uint32_t lxcresult = lxc_container_put(_lxcContainer);
uint32_t retVal = BaseRefCount<IContainer>::Release();
uint32_t retval = BaseRefCount<IContainer>::Release();

ASSERT((retval != Thunder::Core::ERROR_DESTRUCTION_SUCCEEDED) || (lxcresult == 1)); // if 1 is returned, lxc also released the container
return retval;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,40 @@ namespace ProcessContainers {
ConfigItem& operator=(ConfigItem&&) = delete;
ConfigItem& operator=(const ConfigItem&) = delete;

ConfigItem(ConfigItem&& move);
ConfigItem(const ConfigItem& copy);
ConfigItem();

~ConfigItem() override = default;

ConfigItem()
: Core::JSON::Container()
, Key()
, Value()
{
Init();
}

ConfigItem(const ConfigItem& copy)
: Core::JSON::Container()
, Key(copy.Key)
, Value(copy.Value)
{
Init();
}

ConfigItem(ConfigItem&& move)
: Core::JSON::Container()
, Key(std::move(move.Key))
, Value(std::move(move.Value))
{
Init();
}

private:
void Init()
{
Add(_T("key"), &Key);
Add(_T("value"), &Value);
}

public:
Core::JSON::String Key;
Core::JSON::String Value;
};
Expand Down

0 comments on commit 2d91420

Please sign in to comment.