cfengine  3.15.4
About: CFEngine is a configuration management system for configuring and maintaining Unix-like computers (using an own high level policy language). Community version.
  Fossies Dox: cfengine-3.15.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

cf-execd.c File Reference
#include <cf-execd.h>
#include <cf-execd-runner.h>
#include <item_lib.h>
#include <known_dirs.h>
#include <man.h>
#include <ornaments.h>
#include <exec_tools.h>
#include <signals.h>
#include <processes_select.h>
#include <bootstrap.h>
#include <policy_server.h>
#include <sysinfo.h>
#include <timeout.h>
#include <time_classes.h>
#include <loading.h>
#include <printsize.h>
#include <cleanup.h>
#include <repair.h>
#include <dbm_api.h>
#include <string_lib.h>
#include <cf-windows-functions.h>
Include dependency graph for cf-execd.c:

Go to the source code of this file.

Macros

#define CF_EXEC_IFELAPSED   0
 
#define CF_EXEC_EXPIREAFTER   1
 

Enumerations

enum  Reload { RELOAD_ENVIRONMENT , RELOAD_FULL }
 

Functions

static GenericAgentConfigCheckOpts (int argc, char **argv)
 
void ThisAgentInit (void)
 
static bool ScheduleRun (EvalContext *ctx, Policy **policy, GenericAgentConfig *config, ExecdConfig **execd_config, ExecConfig **exec_config)
 
static void Apoptosis (void)
 
static bool LocalExecInThread (const ExecConfig *config)
 
int main (int argc, char *argv[])
 
static unsigned int MaybeSleepLog (LogLevel level, const char *msg, unsigned int seconds)
 
void StartServer (EvalContext *ctx, Policy *policy, GenericAgentConfig *config, ExecdConfig **execd_config, ExecConfig **exec_config)
 
static void Thread_AllSignalsBlock (void)
 
static void Thread_AllSignalsUnblock (void)
 
static void * LocalExecThread (void *param)
 
static Reload CheckNewPromises (GenericAgentConfig *config)
 

Variables

static bool PERFORM_DB_CHECK = false
 
static int NO_FORK = false
 
static int ONCE = false
 
static int WINSERVICE = true
 
static pthread_attr_t threads_attrs
 
static const char *const CF_EXECD_SHORT_DESCRIPTION
 
static const char *const CF_EXECD_MANPAGE_LONG_DESCRIPTION
 
static const struct option OPTIONS []
 
static const char *const HINTS []
 

Macro Definition Documentation

◆ CF_EXEC_EXPIREAFTER

#define CF_EXEC_EXPIREAFTER   1

Definition at line 50 of file cf-execd.c.

◆ CF_EXEC_IFELAPSED

#define CF_EXEC_IFELAPSED   0

Definition at line 49 of file cf-execd.c.

Enumeration Type Documentation

◆ Reload

enum Reload
Enumerator
RELOAD_ENVIRONMENT 
RELOAD_FULL 

Definition at line 601 of file cf-execd.c.

Function Documentation

◆ Apoptosis()

◆ CheckNewPromises()

◆ CheckOpts()

◆ LocalExecInThread()

◆ LocalExecThread()

static void* LocalExecThread ( void *  param)
static

Definition at line 515 of file cf-execd.c.

References ExecConfigDestroy(), LocalExec(), Log(), LOG_LEVEL_VERBOSE, and NULL.

Referenced by LocalExecInThread().

◆ main()

◆ MaybeSleepLog()

static unsigned int MaybeSleepLog ( LogLevel  level,
const char *  msg,
unsigned int  seconds 
)
static

Definition at line 386 of file cf-execd.c.

References IsPendingTermination(), Log(), and sleep().

Referenced by ScheduleRun(), and StartServer().

◆ ScheduleRun()

◆ StartServer()

◆ ThisAgentInit()

static void ThisAgentInit ( void  )

Definition at line 378 of file cf-execd.c.

Referenced by main().

◆ Thread_AllSignalsBlock()

static void Thread_AllSignalsBlock ( void  )
static

Definition at line 484 of file cf-execd.c.

References GetErrorStr(), Log(), LOG_LEVEL_ERR, NULL, and pthread_sigmask().

Referenced by LocalExecInThread().

◆ Thread_AllSignalsUnblock()

static void Thread_AllSignalsUnblock ( void  )
static

Definition at line 500 of file cf-execd.c.

References GetErrorStr(), Log(), LOG_LEVEL_ERR, NULL, and pthread_sigmask().

Referenced by LocalExecInThread().

Variable Documentation

◆ CF_EXECD_MANPAGE_LONG_DESCRIPTION

const char* const CF_EXECD_MANPAGE_LONG_DESCRIPTION
static
Initial value:
=
"cf-execd is the scheduling daemon for cf-agent. It runs cf-agent locally according to a schedule specified in "
"policy code (executor control body). After a cf-agent run is completed, cf-execd gathers output from cf-agent, "
"and may be configured to email the output to a specified address. It may also be configured to splay (randomize) the "
"execution schedule to prevent synchronized cf-agent runs across a network. "
"Note: this daemon reloads it's config when the SIGHUP signal is received."

Definition at line 79 of file cf-execd.c.

Referenced by CheckOpts().

◆ CF_EXECD_SHORT_DESCRIPTION

const char* const CF_EXECD_SHORT_DESCRIPTION
static
Initial value:
=
"scheduling daemon for cf-agent"

Definition at line 76 of file cf-execd.c.

Referenced by CheckOpts().

◆ HINTS

const char* const HINTS[]
static
Initial value:
=
{
"Print the help message",
"Enable debugging output",
"Output verbose information about the behaviour of cf-execd",
"All talk and no action mode - make no changes, only inform of promises not kept",
"Output the version of the software",
"Specify an alternative input file than the default. This option is overridden by FILE if supplied as argument.",
"Define a list of comma separated classes to be defined at the start of execution",
"Define a list of comma separated classes to be undefined at the start of execution",
"Ignore locking constraints during execution (ifelapsed/expireafter) if \"too soon\" to run",
"Print basic information about changes made to the system, i.e. promises repaired",
"Activate internal diagnostics (developers only)",
"Specify how detailed logs should be. Possible values: 'error', 'warning', 'notice', 'info', 'verbose', 'debug'",
"Run as a foreground processes (do not fork)",
"Run once and then exit (implies no-fork)",
"Do not run as a service on windows - use this when running from a command shell (CFEngine Nova only)",
"Set the internal value of LD_LIBRARY_PATH for child processes",
"Enable colorized output. Possible values: 'always', 'auto', 'never'. If option is used, the default value is 'auto'",
"Log timestamps on each line of log output",
"Do not run database integrity checks and repairs at startup",
}
#define NULL
Definition: getopt1.c:56

Definition at line 110 of file cf-execd.c.

Referenced by CheckOpts().

◆ NO_FORK

int NO_FORK = false
static

Definition at line 53 of file cf-execd.c.

Referenced by CheckOpts(), and StartServer().

◆ ONCE

int ONCE = false
static

Definition at line 54 of file cf-execd.c.

Referenced by CheckOpts(), main(), ScheduleRun(), and StartServer().

◆ OPTIONS

const struct option OPTIONS[]
static
Initial value:
=
{
{"help", no_argument, 0, 'h'},
{"debug", no_argument, 0, 'd'},
{"verbose", no_argument, 0, 'v'},
{"dry-run", no_argument, 0, 'n'},
{"version", no_argument, 0, 'V'},
{"file", required_argument, 0, 'f'},
{"define", required_argument, 0, 'D'},
{"negate", required_argument, 0, 'N'},
{"no-lock", no_argument, 0, 'K'},
{"inform", no_argument, 0, 'I'},
{"diagnostic", no_argument, 0, 'x'},
{"log-level", required_argument, 0, 'g'},
{"no-fork", no_argument, 0, 'F'},
{"once", no_argument, 0, 'O'},
{"no-winsrv", no_argument, 0, 'W'},
{"ld-library-path", required_argument, 0, 'L'},
{"color", optional_argument, 0, 'C'},
{"timestamp", no_argument, 0, 'l'},
{"skip-db-check", optional_argument, 0, 0 },
{NULL, 0, 0, '\0'}
}
#define no_argument
Definition: getopt.h:98
#define required_argument
Definition: getopt.h:99
#define optional_argument
Definition: getopt.h:100

Definition at line 79 of file cf-execd.c.

Referenced by CheckOpts().

◆ PERFORM_DB_CHECK

bool PERFORM_DB_CHECK = false
static

Definition at line 52 of file cf-execd.c.

Referenced by CheckOpts(), and main().

◆ threads_attrs

pthread_attr_t threads_attrs
static

Definition at line 57 of file cf-execd.c.

Referenced by LocalExecInThread(), and StartServer().

◆ WINSERVICE

int WINSERVICE = true
static

Definition at line 55 of file cf-execd.c.

Referenced by CheckOpts(), and main().