mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-16 19:10:40 +01:00
add global option internal.developeronly.options
This permits the ability to set some developer-specific behaviour changes, e.g. for testbench testing or things like this. NEVER to be used by users.
This commit is contained in:
parent
2f8d8fb3f5
commit
bd6f016db0
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* Module begun 2008-04-16 by Rainer Gerhards
|
* Module begun 2008-04-16 by Rainer Gerhards
|
||||||
*
|
*
|
||||||
* Copyright 2008-2017 Rainer Gerhards and Adiscon GmbH.
|
* Copyright 2008-2018 Rainer Gerhards and Adiscon GmbH.
|
||||||
*
|
*
|
||||||
* This file is part of the rsyslog runtime library.
|
* This file is part of the rsyslog runtime library.
|
||||||
*
|
*
|
||||||
@ -128,6 +128,8 @@ size_t glblDbgFilesNum = 0;
|
|||||||
int glblDbgWhitelist = 1;
|
int glblDbgWhitelist = 1;
|
||||||
int glblPermitCtlC = 0;
|
int glblPermitCtlC = 0;
|
||||||
|
|
||||||
|
uint64_t glblDevOptions = 0; /* to be used by developers only */
|
||||||
|
|
||||||
pid_t glbl_ourpid;
|
pid_t glbl_ourpid;
|
||||||
#ifndef HAVE_ATOMIC_BUILTINS
|
#ifndef HAVE_ATOMIC_BUILTINS
|
||||||
static DEF_ATOMIC_HELPER_MUT(mutTerminateInputs);
|
static DEF_ATOMIC_HELPER_MUT(mutTerminateInputs);
|
||||||
@ -182,6 +184,7 @@ static struct cnfparamdescr cnfparamdescr[] = {
|
|||||||
{ "environment", eCmdHdlrArray, 0 },
|
{ "environment", eCmdHdlrArray, 0 },
|
||||||
{ "processinternalmessages", eCmdHdlrBinary, 0 },
|
{ "processinternalmessages", eCmdHdlrBinary, 0 },
|
||||||
{ "umask", eCmdHdlrFileCreateMode, 0 },
|
{ "umask", eCmdHdlrFileCreateMode, 0 },
|
||||||
|
{ "internal.developeronly.options", eCmdHdlrInt, 0 },
|
||||||
{ "internalmsg.ratelimit.interval", eCmdHdlrPositiveInt, 0 },
|
{ "internalmsg.ratelimit.interval", eCmdHdlrPositiveInt, 0 },
|
||||||
{ "internalmsg.ratelimit.burst", eCmdHdlrPositiveInt, 0 },
|
{ "internalmsg.ratelimit.burst", eCmdHdlrPositiveInt, 0 },
|
||||||
{ "errormessagestostderr.maxnumber", eCmdHdlrPositiveInt, 0 },
|
{ "errormessagestostderr.maxnumber", eCmdHdlrPositiveInt, 0 },
|
||||||
@ -1002,6 +1005,8 @@ glblProcessCnf(struct cnfobj *o)
|
|||||||
continue;
|
continue;
|
||||||
if(!strcmp(paramblk.descr[i].name, "processinternalmessages")) {
|
if(!strcmp(paramblk.descr[i].name, "processinternalmessages")) {
|
||||||
bProcessInternalMessages = (int) cnfparamvals[i].val.d.n;
|
bProcessInternalMessages = (int) cnfparamvals[i].val.d.n;
|
||||||
|
} else if(!strcmp(paramblk.descr[i].name, "internal.developeronly.options")) {
|
||||||
|
glblDevOptions = (uint64_t) cnfparamvals[i].val.d.n;
|
||||||
} else if(!strcmp(paramblk.descr[i].name, "stdlog.channelspec")) {
|
} else if(!strcmp(paramblk.descr[i].name, "stdlog.channelspec")) {
|
||||||
#ifndef HAVE_LIBLOGGING_STDLOG
|
#ifndef HAVE_LIBLOGGING_STDLOG
|
||||||
LogError(0, RS_RET_ERR, "rsyslog wasn't "
|
LogError(0, RS_RET_ERR, "rsyslog wasn't "
|
||||||
|
|||||||
@ -123,6 +123,16 @@ extern size_t glblDbgFilesNum;
|
|||||||
extern int glblDbgWhitelist;
|
extern int glblDbgWhitelist;
|
||||||
extern int glblPermitCtlC;
|
extern int glblPermitCtlC;
|
||||||
|
|
||||||
|
/* Developer options enable some strange things for developer-only testing.
|
||||||
|
* These should never be enabled in a user build, except if explicitly told
|
||||||
|
* by a developer. The options are acutally flags, so they should be powers
|
||||||
|
* of two. Flag assignment may change between versions, **backward
|
||||||
|
* compatibility is NOT necessary**.
|
||||||
|
* rgerhards, 2018-04-28
|
||||||
|
*/
|
||||||
|
#define DEV_OPTION_KEEP_RUNNING_ON_HARD_CONF_ERROR 1
|
||||||
|
extern uint64_t glblDevOptions;
|
||||||
|
|
||||||
#define glblGetOurPid() glbl_ourpid
|
#define glblGetOurPid() glbl_ourpid
|
||||||
#define glblSetOurPid(pid) { glbl_ourpid = (pid); }
|
#define glblSetOurPid(pid) { glbl_ourpid = (pid); }
|
||||||
|
|
||||||
|
|||||||
@ -1456,7 +1456,17 @@ initAll(int argc, char **argv)
|
|||||||
/* check for "hard" errors that needs us to abort in any case */
|
/* check for "hard" errors that needs us to abort in any case */
|
||||||
if( (localRet == RS_RET_CONF_FILE_NOT_FOUND)
|
if( (localRet == RS_RET_CONF_FILE_NOT_FOUND)
|
||||||
|| (localRet == RS_RET_NO_ACTIONS) ) {
|
|| (localRet == RS_RET_NO_ACTIONS) ) {
|
||||||
ABORT_FINALIZE(localRet);
|
/* for extreme testing, we keep the ability to let rsyslog continue
|
||||||
|
* even on hard config errors. Note that this may lead to segfaults
|
||||||
|
* or other malfunction further down the road.
|
||||||
|
*/
|
||||||
|
if((glblDevOptions & DEV_OPTION_KEEP_RUNNING_ON_HARD_CONF_ERROR) == 1) {
|
||||||
|
fprintf(stderr, "rsyslogd: NOTE: developer-only option set to keep rsyslog "
|
||||||
|
"running where it should abort - this can lead to "
|
||||||
|
"more problems later in the run.\n");
|
||||||
|
} else {
|
||||||
|
ABORT_FINALIZE(localRet);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glbl.GenerateLocalHostNameProperty();
|
glbl.GenerateLocalHostNameProperty();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user