main.cc
Go to the documentation of this file.
275 debugs(1, Important(2), "Preparing for shutdown after " << statCounter.client_http.requests << " requests");
328 "Usage: %s [-cdzCFNRVYX] [-n name] [-s | -l facility] [-f config-file] [-[au] port] [-k signal]"
388};
596 fatalf("Service name (-n option) must be limited to 32 characters but got %u", service_name.length());
650 printf("For legal restrictions on distribution see https://www.openssl.org/source/license.html\n\n");
1094 debugs(50, DBG_CRITICAL, "WARNING: Can't find current directory, getcwd: " << xstrerr(xerrno));
1115 debugs(1, DBG_CRITICAL, "Starting Squid Cache version " << version_string << " for " << CONFIG_HOST_TYPE << "...");
1167 httpHeaderInitModule(); /* must go before any header processing (e.g. the one in errorInitialize) */
1310 debugs(1, DBG_CRITICAL, "FATAL: Dying after an undetermined failure" << CurrentExceptionExtra);
void CpuAffinityCheck()
check CPU affinity configuration and print warnings if needed
Definition: CpuAffinity.cc:49
void LoadableModulesConfigure(const wordlist *names)
Definition: LoadableModules.cc:29
#define RunRegisteredHere(m)
convenience macro to describe/debug the caller and the method being called
Definition: RunnersRegistry.h:117
#define CallRunnerRegistratorIn(Namespace, ClassName)
Definition: RunnersRegistry.h:151
std::ostream & CurrentExceptionExtra(std::ostream &os)
Definition: TextException.cc:99
std::ostream & CurrentException(std::ostream &os)
prints active (i.e., thrown but not yet handled) exception
Definition: TextException.cc:88
#define TexcHere(msg)
legacy convenience macro; it is not difficult to type Here() now
Definition: TextException.h:63
Definition: AsyncEngine.h:19
optimized set of C chars, with quick membership test and merge support
Definition: CharacterSet.h:18
Definition: client_db.cc:100
initializes shared queue used by CollapsedForwarding
Definition: CollapsedForwarding.cc:175
Definition: comm.h:100
Manages arguments passed to a program (i.e., main(argc, argv) parameters).
Definition: CommandLine.h:35
bool hasOption(const int optId, const char **optValue=nullptr) const
Definition: CommandLine.cc:71
void forEachOption(Visitor) const
calls Visitor for each of the configured command line option
Definition: CommandLine.cc:89
void resetArg0(const char *programName)
replaces argv[0] with the new value
Definition: CommandLine.cc:115
static void ForgetSaved()
silently erases saved early debugs() messages (if any)
Definition: debug.cc:553
static void ConfigureSyslog(const char *facility)
enables logging to syslog (using the specified facility, when not nil)
Definition: debug.cc:1080
static void EnsureDefaultStderrLevel(int maxDefault)
Definition: debug.cc:692
Definition: EventLoop.h:27
Definition: IpcIoFile.cc:1014
Receives coordination messages on behalf of its process or thread.
Definition: Strand.h:28
bool someSignaled(const int sgnl) const
whether some kids died from a given signal
Definition: Kids.cc:116
bool shouldRestartSome() const
whether some kids should be restarted by master
Definition: Kids.cc:136
Definition: MemStore.cc:971
Definition: Scheme.cc:18
Definition: Tokenizer.h:30
launches PeerPoolMgrs for peers configured with standby.limit
Definition: PeerPoolMgr.cc:236
virtual void finishShutdown()
Meant for cleanup of services needed by the already destroyed objects.
Definition: RunnersRegistry.h:91
static void RegisterWithCacheManager(void)
Definition: SBufStatsAction.cc:124
int cmp(const SBuf &S, const size_type n) const
shorthand version for compare()
Definition: SBuf.h:275
Definition: main.cc:197
struct SquidConfig2::@120 onoff
struct SquidConfig::@94 Port
void reconfigureStart()
When reconfigring should be called this method.
Definition: context_storage.cc:91
struct StatCounters::@122 client_http
Definition: main.cc:187
void create() override
create system resources needed for this store to operate in the future
Definition: Controller.cc:78
int callback() override
called once every main loop iteration; TODO: Move to UFS code.
Definition: Controller.cc:229
Definition: cache_cf.cc:4373
void eventAdd(const char *name, EVH *func, void *arg, double when, int weight, bool cbdata)
Definition: event.cc:107
char * ConfigFile
int opt_reload_hit_only
int opt_send_signal
int opt_store_doublecheck
struct timeval squid_start
int opt_create_swap_dirs
int opt_reuseaddr
int opt_no_daemon
int opt_foreground
const char * version_string
int Squid_MaxFD
int opt_foreground_rebuild
int opt_parse_cfg_only
int opt_catch_signals
int starting_up
int reconfiguring
int KidIdentifier
static void master_shutdown(int sig)
Shutdown signal handler for master process.
Definition: main.cc:742
static void ConfigureDebugging()
Start directing debugs() messages to the configured cache.log.
Definition: main.cc:1392
static void RegisterModules()
register all known modules for handling future RegisteredRunner events
Definition: main.cc:1444
static void GoIntoBackground()
makes the caller a daemon process running in the background
Definition: main.cc:1866
static void ConfigureCurrentKid(const CommandLine &cmdLine)
computes name and ID for the current kid process
Definition: main.cc:1364
static void mainHandleCommandLineOption(const int optId, const char *optValue)
Definition: main.cc:410
static void masterShutdownStart()
Initiates shutdown sequence. Shutdown ends when the last running kids stops.
Definition: main.cc:1785
static bool mainChangeDir(const char *dir)
changes working directory, providing error reporting
Definition: main.cc:1050
static int SquidMainSafe(int argc, char **argv)
unsafe main routine wrapper to catch exceptions
Definition: main.cc:1347
static void masterMaintainKidRevivalSchedule()
Definition: main.cc:1848
static void masterReconfigureFinish()
Ends reconfiguration sequence started by masterReconfigureStart().
Definition: main.cc:1808
static void masterReconfigureStart()
Initiates reconfiguration sequence. See also: masterReconfigureFinish().
Definition: main.cc:1795
static bool AvoidSignalAction(const char *description, volatile int &signalVar)
Definition: main.cc:241
Definition: forward.h:28
GlobalContextStorage TheGlobalContextStorage
Global cache for store all SSL server certificates.
Definition: context_storage.cc:123
void Init(Controller *root=nullptr)
initialize the storage module; a custom root is used by unit tests only
Definition: Controller.cc:945
SBuf ToSBuf(Args &&... args)
slowly stream-prints all arguments into a freshly allocated SBuf
Definition: Stream.h:63
Definition: parse.c:160
time_t getCurrentTime() STUB_RETVAL(0) int tvSubUsec(struct timeval
bool IamWorkerProcess()
whether the current process handles HTTP transactions and such
Definition: stub_tools.cc:47
bool SIGHDLR int STUB void const char void ObjPackMethod STUB void const char *STUB void keepCapabilities(void) STUB pid_t WaitForOnePid(pid_t
SBuf service_name(APP_SHORTNAME)
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(nullptr) const char *uniqueHostname(void) STUB_RETVAL(nullptr) void leave_suid(void) STUB_NOP void enter_suid(void) STUB void no_suid(void) STUB bool IamMasterProcess()
Definition: stub_tools.cc:18
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
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 wccp2Init(void) STUB void wccp2ConnectionOpen(void) STUB void wccp2ConnectionClose(void) STUB void dump_wccp2_method(StoreEntry *
struct timeval current_time
the current UNIX time in timeval {seconds, microseconds} format
Definition: gadgets.cc:17
bool IamMasterProcess()
whether the current process is the parent of all other Squid processes
Definition: tools.cc:668
bool IamCoordinatorProcess()
whether the current process coordinates worker processes
Definition: tools.cc:702
bool UsingSmp()
Whether there should be more than one worker process running.
Definition: tools.cc:696
SBuf ProcessRoles()
a string describing this process roles such as worker or coordinator
Definition: tools.cc:739