main.cc
Go to the documentation of this file.
287 debugs(1, Important(2), "Preparing for shutdown after " << statCounter.client_http.requests << " requests");
353 "Usage: %s [-cdzCFNRVYX] [-n name] [-s | -l facility] [-f config-file] [-[au] port] [-k signal]"
413 };
621 fatalf("Service name (-n option) must be limited to 32 characters but got %u", service_name.length());
674 printf("For legal restrictions on distribution see https://www.openssl.org/source/license.html\n\n");
1126 debugs(50, DBG_CRITICAL, "WARNING: Can't find current directory, getcwd: " << xstrerr(xerrno));
1147 debugs(1, DBG_CRITICAL, "Starting Squid Cache version " << version_string << " for " << CONFIG_HOST_TYPE << "...");
1199 httpHeaderInitModule(); /* must go before any header processing (e.g. the one in errorInitialize) */
1346 debugs(1, DBG_CRITICAL, "FATAL: Dying from an exception handling failure; exception: " << CurrentException);
struct timeval squid_start
int opt_send_signal
struct SquidConfig::@97 Port
void releaseServerSockets(void) STUB_NOP void dumpMallocStats(void) STUB void squid_getrusage(struct rusage *) STUB double rusage_cputime(struct rusage *) STUB_RETVAL(0) int rusage_maxrss(struct rusage *) STUB_RETVAL(0) int rusage_pagefaults(struct rusage *) STUB_RETVAL(0) void PrintRusage(void) STUB void death(int) STUB void BroadcastSignalIfAny(int &) STUB void sigusr2_handle(int) STUB void debug_trap(const char *) STUB void sig_child(int) STUB const char *getMyHostname(void) STUB_RETVAL(NULL) const char *uniqueHostname(void) STUB_RETVAL(NULL) void leave_suid(void) STUB_NOP void enter_suid(void) STUB void no_suid(void) STUB bool IamMasterProcess()
Definition: stub_tools.cc:18
virtual void create() override
create system resources needed for this store to operate in the future
Definition: Controller.cc:78
Definition: main.cc:188
static void masterReconfigureFinish()
Ends reconfiguration sequence started by masterReconfigureStart().
Definition: main.cc:1801
static void mainHandleCommandLineOption(const int optId, const char *optValue)
Definition: main.cc:435
int opt_store_doublecheck
Definition: comm.h:102
int KidIdentifier
SBuf ProcessRoles()
a string describing this process roles such as worker or coordinator
Definition: tools.cc:736
bool someSignaled(const int sgnl) const
whether some kids died from a given signal
Definition: Kids.cc:116
static bool mainChangeDir(const char *dir)
changes working directory, providing error reporting
Definition: main.cc:1082
struct SquidConfig2::@125 onoff
bool hasOption(const int optId, const char **optValue=nullptr) const
Definition: CommandLine.cc:71
static bool AvoidSignalAction(const char *description, volatile int &signalVar)
Definition: main.cc:253
virtual int callback() override
called once every main loop iteration; TODO: Move to UFS code.
Definition: Controller.cc:229
SBuf service_name(APP_SHORTNAME)
Definition: main.cc:198
void forEachOption(Visitor) const
calls Visitor for each of the configured command line option
Definition: CommandLine.cc:89
bool shouldRestartSome() const
whether some kids should be restarted by master
Definition: Kids.cc:136
static void ConfigureSyslog(const char *facility)
enables logging to syslog (using the specified facility, when not nil)
Definition: debug.cc:1078
bool IamWorkerProcess()
whether the current process handles HTTP transactions and such
Definition: stub_tools.cc:47
void LoadableModulesConfigure(const wordlist *names)
Definition: LoadableModules.cc:29
static int SquidMainSafe(int argc, char **argv)
unsafe main routine wrapper to catch exceptions
Definition: main.cc:1383
#define RunRegisteredHere(m)
convenience macro to describe/debug the caller and the method being called
Definition: RunnersRegistry.h:117
int opt_no_daemon
#define TexcHere(msg)
legacy convenience macro; it is not difficult to type Here() now
Definition: TextException.h:59
const char * version_string
static void RegisterWithCacheManager(void)
Definition: SBufStatsAction.cc:124
static void ConfigureDebugging()
Start directing debugs() messages to the configured cache.log.
Definition: main.cc:1428
struct timeval current_time
the current UNIX time in timeval {seconds, microseconds} format
Definition: gadgets.cc:17
struct StatCounters::@127 client_http
void resetArg0(const char *programName)
replaces argv[0] with the new value
Definition: CommandLine.cc:115
time_t getCurrentTime() STUB_RETVAL(0) int tvSubUsec(struct timeval
bool IamDiskProcess() STUB_RETVAL_NOP(false) bool InDaemonMode() STUB_RETVAL_NOP(false) bool UsingSmp() STUB_RETVAL_NOP(false) bool IamCoordinatorProcess() STUB_RETVAL(false) bool IamPrimaryProcess() STUB_RETVAL(false) int NumberOfKids() STUB_RETVAL(0) void setMaxFD(void) STUB void setSystemLimits(void) STUB void squid_signal(int
whether the current process is dedicated to managing a cache_dir
static void ForgetSaved()
silently erases saved early debugs() messages (if any)
Definition: debug.cc:552
Manages arguments passed to a program (i.e., main(argc, argv) parameters).
Definition: CommandLine.h:35
void CpuAffinityCheck()
check CPU affinity configuration and print warnings if needed
Definition: CpuAffinity.cc:49
static void EnsureDefaultStderrLevel(int maxDefault)
Definition: debug.cc:691
Definition: AsyncEngine.h:19
int starting_up
Definition: EventLoop.h:27
bool SIGHDLR int STUB void const char void ObjPackMethod STUB void const char *STUB void keepCapabilities(void) STUB pid_t WaitForOnePid(pid_t
int reconfiguring
static void GoIntoBackground()
makes the caller a daemon process running in the background
Definition: main.cc:1859
int opt_create_swap_dirs
std::ostream & CurrentException(std::ostream &os)
prints active (i.e., thrown but not yet handled) exception
Definition: TextException.cc:69
int opt_reuseaddr
Definition: Tokenizer.h:30
int opt_foreground
int Squid_MaxFD
Receives coordination messages on behalf of its process or thread.
Definition: Strand.h:28
void Init(Controller *root=nullptr)
initialize the storage module; a custom root is used by unit tests only
Definition: Controller.cc:941
bool IamMasterProcess()
whether the current process is the parent of all other Squid processes
Definition: tools.cc:665
static void masterReconfigureStart()
Initiates reconfiguration sequence. See also: masterReconfigureFinish().
Definition: main.cc:1788
int opt_reload_hit_only
GlobalContextStorage TheGlobalContextStorage
Global cache for store all SSL server certificates.
Definition: context_storage.cc:123
void reconfigureStart()
When reconfigring should be called this method.
Definition: context_storage.cc:91
Definition: parse.c:160
int cmp(const SBuf &S, const size_type n) const
shorthand version for compare()
Definition: SBuf.h:268
char * ConfigFile
struct SquidConfig::@110 onoff
virtual void finishShutdown()
Meant for cleanup of services needed by the already destroyed objects.
Definition: RunnersRegistry.h:91
static void masterMaintainKidRevivalSchedule()
Definition: main.cc:1841
bool IamCoordinatorProcess()
whether the current process coordinates worker processes
Definition: tools.cc:699
void wccp2Init(void) STUB void wccp2ConnectionOpen(void) STUB void wccp2ConnectionClose(void) STUB void dump_wccp2_method(StoreEntry *
SBuf ToSBuf(Args &&... args)
slowly stream-prints all arguments into a freshly allocated SBuf
Definition: Stream.h:63
int opt_parse_cfg_only
static void ConfigureCurrentKid(const CommandLine &cmdLine)
computes name and ID for the current kid process
Definition: main.cc:1400
static void masterShutdownStart()
Initiates shutdown sequence. Shutdown ends when the last running kids stops.
Definition: main.cc:1778
optimized set of C chars, with quick membership test and merge support
Definition: CharacterSet.h:18
int opt_foreground_rebuild
int opt_catch_signals
bool UsingSmp()
Whether there should be more than one worker process running.
Definition: tools.cc:693
bool SIGHDLR int STUB void const char void ObjPackMethod STUB void parseEtcHosts(void) STUB int getMyPort(void) STUB_RETVAL(0) void setUmask(mode_t) STUB void strwordquote(MemBuf *
void eventAdd(const char *name, EVH *func, void *arg, double when, int weight, bool cbdata)
Definition: event.cc:107
static void master_shutdown(int sig)
Shutdown signal handler for master process.
Definition: main.cc:765