FlatImage
A configurable Linux containerization system
Loading...
Searching...
No Matches
janitor.cpp File Reference

Cleans mountpoint after the PID passed as an argument exits, it works as a fallback in case the main process fails to cleanup. More...

#include <chrono>
#include <cstdlib>
#include <thread>
#include <filesystem>
#include <csignal>
#include "../std/expected.hpp"
#include "../lib/log.hpp"
#include "../lib/fuse.hpp"
#include "../macro.hpp"
Include dependency graph for janitor.cpp:

Go to the source code of this file.

Functions

void cleanup (int sig)
 Signal handler for parent process exit detection.
 
Value< void > boot (int argc, char **argv)
 Boots the main janitor program.
 
int main (int argc, char **argv)
 Entry point for the janitor cleanup process.
 

Variables

volatile std::sig_atomic_t G_PARENT_OK = 0
 

Detailed Description

Cleans mountpoint after the PID passed as an argument exits, it works as a fallback in case the main process fails to cleanup.

Author
Ruan Formigoni

Definition in file janitor.cpp.

Function Documentation

◆ boot()

Value< void > boot ( int argc,
char ** argv )
nodiscard

Boots the main janitor program.

Parameters
argcArgument count
argvArgument vector
Returns
Value<void> Nothing on success or the respective error

Definition at line 49 of file janitor.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cleanup()

void cleanup ( int sig)

Signal handler for parent process exit detection.

Sets the G_PARENT_OK flag to 1 when parent process exits, triggering cleanup operations.

Parameters
sigSignal number (unused)

Definition at line 36 of file janitor.cpp.

Here is the caller graph for this function:

◆ main()

int main ( int argc,
char ** argv )

Entry point for the janitor cleanup process.

Parameters
argcArgument count
argvArgument vector
Returns
int Exit code (0 for success, non-zero for failure)

Definition at line 99 of file janitor.cpp.

Here is the call graph for this function:

Variable Documentation

◆ G_PARENT_OK

volatile std::sig_atomic_t G_PARENT_OK = 0

Definition at line 26 of file janitor.cpp.