
Go to the source code of this file.
Typedefs | |
| typedef void(* | ObjPackMethod) (void *obj, Packable *p) |
| typedef void | SIGHDLR(int sig) |
| callback type for signal handlers More... | |
| typedef int | PidStatus |
Functions | |
| void | parseEtcHosts (void) |
| int | getMyPort (void) |
| void | setUmask (mode_t mask) |
| void | strwordquote (MemBuf *mb, const char *str) |
| void | debugObj (int section, int level, const char *label, void *obj, ObjPackMethod pm) |
| const char * | getMyHostname (void) |
| const char * | uniqueHostname (void) |
| void | death (int sig) |
| void | sigusr2_handle (int sig) |
| void | sig_child (int sig) |
| void | sig_shutdown (int sig) |
| handles shutdown notifications from kids More... | |
| void | leave_suid (void) |
| void | enter_suid (void) |
| void | no_suid (void) |
| void | setMaxFD (void) |
| void | setSystemLimits (void) |
| void | squid_signal (int sig, SIGHDLR *, int flags) |
| void | keepCapabilities (void) |
| void | BroadcastSignalIfAny (int &sig) |
| bool | IamMasterProcess () |
| whether the current process is the parent of all other Squid processes More... | |
| bool | IamPrimaryProcess () |
| bool | IamCoordinatorProcess () |
| whether the current process coordinates worker processes More... | |
| bool | IamWorkerProcess () |
| whether the current process handles HTTP transactions and such More... | |
| bool | IamDiskProcess () |
| whether the current process is dedicated to managing a cache_dir More... | |
| bool | InDaemonMode () |
| Whether we are running in daemon mode. More... | |
| bool | UsingSmp () |
| Whether there should be more than one worker process running. More... | |
| int | NumberOfKids () |
| number of Kid processes as defined in src/ipc/Kid.h More... | |
| SBuf | ProcessRoles () |
| a string describing this process roles such as worker or coordinator More... | |
| void | debug_trap (const char *) |
| void | logsFlush (void) |
| void | squid_getrusage (struct rusage *r) |
| double | rusage_cputime (struct rusage *r) |
| int | rusage_maxrss (struct rusage *r) |
| int | rusage_pagefaults (struct rusage *r) |
| void | releaseServerSockets (void) |
| void | PrintRusage (void) |
| void | dumpMallocStats (void) |
| pid_t | WaitForOnePid (pid_t pid, PidStatus &status, int flags) |
| pid_t | WaitForAnyPid (PidStatus &status, int flags) |
Variables | |
| int | DebugSignal |
| SBuf | service_name |
Typedef Documentation
◆ ObjPackMethod
◆ PidStatus
◆ SIGHDLR
Function Documentation
◆ BroadcastSignalIfAny()
| void BroadcastSignalIfAny | ( | int & | sig | ) |
Definition at line 419 of file tools.cc.
References Kids::count(), Kids::get(), IamMasterProcess(), and TheKids.
Referenced by masterCheckAndBroadcastSignals().
◆ death()
| void death | ( | int | sig | ) |
Definition at line 346 of file tools.cc.
References SquidConfig::adminEmail, Config, DBG_CRITICAL, dead_msg(), debugs, DebugStream(), dumpMallocStats(), ForceAlert(), mail_warranty(), Debug::PrepareToDie(), PrintRusage(), releaseServerSockets(), shutting_down, squid_curtime, SQUID_RELEASE_TIME, and storeDirWriteCleanLogs().
Referenced by mainInitialize().
◆ debug_trap()
| void debug_trap | ( | const char * | ) |
Definition at line 459 of file tools.cc.
References DBG_CRITICAL, debugs, fatal_dump(), and opt_catch_signals.
Referenced by EventScheduler::cancel(), clientdbEstablished(), clientdbUpdate(), neighborsUdpAck(), netdbHashDelete(), and unlinkdUnlink().
◆ debugObj()
| void debugObj | ( | int | section, |
| int | level, | ||
| const char * | label, | ||
| void * | obj, | ||
| ObjPackMethod | pm | ||
| ) |
Definition at line 939 of file tools.cc.
References assert, MemBuf::buf, MemBuf::clean(), debugs, and MemBuf::init().
Referenced by clientInterpretRequestHeaders(), and internalStart().
◆ dumpMallocStats()
| void dumpMallocStats | ( | void | ) |
Definition at line 167 of file tools.cc.
References DebugStream(), and Math::intPercent().
Referenced by death(), fatal_common(), and SquidShutdown().
◆ enter_suid()
| void enter_suid | ( | void | ) |
Definition at line 624 of file tools.cc.
References debugs, setTraceability(), and xstrerr().
Referenced by comm_set_transparent(), htcpOpenPorts(), icpOpenPorts(), mainReconfigureFinish(), File::open(), Ipc::Coordinator::openListenSocket(), Ip::Intercept::ProbeForTproxy(), RemoveInstance(), squid_getrusage(), SquidMain(), Ipc::StartListening(), StartUsingConfig(), and watch_child().
◆ getMyHostname()
| const char* getMyHostname | ( | void | ) |
Definition at line 468 of file tools.cc.
References Config, DBG_CRITICAL, DBG_IMPORTANT, debugs, Ip::Address::FreeAddr(), Ip::Address::getAddrInfo(), HttpPortList, Ip::Address::isAnyAddr(), LOCAL_ARRAY, SQUIDHOSTNAMELEN, SquidConfig::visibleHostname, xgethostname(), and xstrerr().
Referenced by ErrorState::compileLegacyCode(), configDoConfigure(), ErrorState::Dump(), idnsParseResolvConf(), internalHostname(), internalLocalUri(), neighbors_init(), uniqueHostname(), and urnHandleReply().
◆ getMyPort()
| int getMyPort | ( | void | ) |
Definition at line 1042 of file tools.cc.
References DBG_CRITICAL, debugs, FtpPortList, and HttpPortList.
Referenced by ClientHttpRequest::checkForInternalAccess(), ErrorState::compileLegacyCode(), and internalLocalUri().
◆ IamCoordinatorProcess()
| bool IamCoordinatorProcess | ( | ) |
Definition at line 703 of file tools.cc.
References pkCoordinator, and TheProcessKind.
Referenced by IamPrimaryProcess(), ProcessRoles(), and SquidMain().
◆ IamDiskProcess()
| bool IamDiskProcess | ( | ) |
Definition at line 685 of file tools.cc.
References pkDisker, and TheProcessKind.
Referenced by IpcIoFile::close(), Rock::SwapDir::create(), Rock::SwapDir::doReportStat(), IpcIoFile::HandleMessagesAtStart(), IpcIoFile::HandleNotification(), Rock::Rebuild::IsResponsible(), IpcIoFile::open(), ProcessRoles(), and SquidMain().
◆ IamMasterProcess()
| bool IamMasterProcess | ( | ) |
Definition at line 669 of file tools.cc.
References KidIdentifier.
Referenced by BroadcastSignalIfAny(), ProcessRoles(), SquidMain(), StartUsingConfig(), and Ipc::Mem::RegisteredRunner::useConfig().
◆ IamPrimaryProcess()
| bool IamPrimaryProcess | ( | ) |
whether the current process is dedicated to doing things that only a single process should do, such as PID file maintenance and WCCP
Definition at line 709 of file tools.cc.
References Config, IamCoordinatorProcess(), IamWorkerProcess(), NumberOfKids(), opt_no_daemon, and SquidConfig::workers.
Referenced by Mgr::InfoAction::dump(), mainReconfigureFinish(), SquidMain(), wccp2ConnectionClose(), wccp2ConnectionOpen(), wccp2Init(), wccpConnectionClose(), wccpConnectionOpen(), and wccpInit().
◆ IamWorkerProcess()
| bool IamWorkerProcess | ( | ) |
Definition at line 47 of file stub_tools.cc.
References Config, opt_no_daemon, pkWorker, TheProcessKind, and SquidConfig::workers.
Referenced by Store::Disk::active(), Ipc::Mem::Segment::Enabled(), htcpClosePorts(), htcpOpenPorts(), IamPrimaryProcess(), CollapsedForwarding::Init(), Store::Controller::init(), initializeSessionCache(), IpcIoFile::open(), Fs::Ufs::UFSSwapDir::openLog(), peerDNSConfigure(), ProcessRoles(), serverConnectionsClose(), serverConnectionsOpen(), snmpClosePorts(), snmpConstructReponse(), snmpInit(), snmpOpenPorts(), SquidMain(), CacheManager::start(), Fs::Ufs::UFSSwapDir::unlinkdUseful(), and Ipc::Mem::RegisteredRunner::useConfig().
◆ InDaemonMode()
| bool InDaemonMode | ( | ) |
Definition at line 691 of file tools.cc.
References Config, opt_no_daemon, and SquidConfig::workers.
Referenced by Store::Disks::configure(), CpuAffinityCheck(), CpuAffinityInit(), Rock::SwapDir::needsDiskStrand(), NumberOfKids(), SquidMain(), StartUsingConfig(), Ipc::Mem::RegisteredRunner::useConfig(), and UsingSmp().
◆ keepCapabilities()
| void keepCapabilities | ( | void | ) |
Definition at line 1123 of file tools.cc.
References Ip::Interceptor, and Ip::Intercept::StopTransparency().
Referenced by setEffectiveUser().
◆ leave_suid()
| void leave_suid | ( | void | ) |
leave a privileged section. (Give up any privilegies) Routines that need privilegies can rap themselves in enter_suid() and leave_suid() To give upp all posibilites to gain privilegies use no_suid()
Definition at line 560 of file tools.cc.
References Config, Config2, DBG_CRITICAL, debugs, SquidConfig::effectiveGroup, SquidConfig2::effectiveGroupID, SquidConfig::effectiveUser, SquidConfig2::effectiveUserID, fatalf(), initgroups(), restoreCapabilities(), setTraceability(), and xstrerr().
Referenced by comm_set_transparent(), fatal(), fatal_dump(), htcpOpenPorts(), icpOpenPorts(), no_suid(), File::open(), Ipc::Coordinator::openListenSocket(), Ip::Intercept::ProbeForTproxy(), RemoveInstance(), setEffectiveUser(), squid_getrusage(), SquidMain(), Ipc::StartListening(), StartUsingConfig(), and watch_child().
◆ logsFlush()
| void logsFlush | ( | void | ) |
◆ no_suid()
| void no_suid | ( | void | ) |
Definition at line 647 of file tools.cc.
References DBG_IMPORTANT, debugs, leave_suid(), restoreCapabilities(), setTraceability(), and xstrerr().
Referenced by ipcCreate(), mainInitialize(), and SquidMain().
◆ NumberOfKids()
| int NumberOfKids | ( | ) |
Definition at line 725 of file tools.cc.
References SquidConfig::cacheSwap, Config, InDaemonMode(), Store::DiskConfig::n_strands, and SquidConfig::workers.
Referenced by CpuAffinityCheck(), IamPrimaryProcess(), Kids::init(), and UsingSmp().
◆ parseEtcHosts()
| void parseEtcHosts | ( | void | ) |
Definition at line 950 of file tools.cc.
References SquidConfig::appendDomain, Config, DBG_IMPORTANT, debugs, SquidConfig::etcHostsPath, fqdncacheAddEntryFromHosts(), ipcacheAddEntryFromHosts(), O_TEXT, w_space, and xstrerr().
Referenced by mainInitialize(), and mainReconfigureFinish().
◆ PrintRusage()
| void PrintRusage | ( | void | ) |
Definition at line 330 of file tools.cc.
References DebugStream(), rusage::ru_stime, rusage::ru_utime, rusage_cputime(), rusage_maxrss(), rusage_pagefaults(), and squid_getrusage().
Referenced by death(), fatal_common(), and SquidShutdown().
◆ ProcessRoles()
| SBuf ProcessRoles | ( | ) |
Definition at line 740 of file tools.cc.
References SBuf::append(), IamCoordinatorProcess(), IamDiskProcess(), IamMasterProcess(), and IamWorkerProcess().
Referenced by mainInitialize().
◆ releaseServerSockets()
| void releaseServerSockets | ( | void | ) |
Definition at line 93 of file tools.cc.
References clientConnectionsClose(), and icpClosePorts().
Referenced by death().
◆ rusage_cputime()
Definition at line 239 of file tools.cc.
References double, rusage::ru_stime, and rusage::ru_utime.
Referenced by GetCountersStats(), GetInfo(), PrintRusage(), snmp_prfSysFn(), and statAvgTick().
◆ rusage_maxrss()
Definition at line 254 of file tools.cc.
References rusage::ru_maxrss.
Referenced by GetInfo(), PrintRusage(), and snmp_prfSysFn().
◆ rusage_pagefaults()
Definition at line 275 of file tools.cc.
References rusage::ru_majflt.
Referenced by GetCountersStats(), GetInfo(), PrintRusage(), snmp_prfSysFn(), and statAvgTick().
◆ setMaxFD()
| void setMaxFD | ( | void | ) |
Figure out the number of supported filedescriptors
Definition at line 763 of file tools.cc.
References Config, DBG_CRITICAL, debugs, SquidConfig::max_filedescriptors, Squid_MaxFD, and xstrerr().
Referenced by StartUsingConfig().
◆ setSystemLimits()
| void setSystemLimits | ( | void | ) |
Definition at line 812 of file tools.cc.
References Config, DBG_CRITICAL, DBG_IMPORTANT, debugs, fatal_dump(), SquidConfig::max_filedescriptors, Squid_MaxFD, tmp_error_buf, and xstrerr().
Referenced by mainInitialize().
◆ setUmask()
| void setUmask | ( | mode_t | mask | ) |
Definition at line 1070 of file tools.cc.
Referenced by mainReconfigureFinish(), and SquidMain().
◆ sig_child()
| void sig_child | ( | int | sig | ) |
Definition at line 762 of file main.cc.
References do_handle_stopped_child, and sig_child().
Referenced by mainInitialize(), and sig_child().
◆ sig_shutdown()
| void sig_shutdown | ( | int | sig | ) |
◆ sigusr2_handle()
| void sigusr2_handle | ( | int | sig | ) |
Definition at line 434 of file tools.cc.
References DBG_CRITICAL, Debug::debugOptions, debugs, DebugSignal, Debug::parseOptions(), sigusr2_handle(), and xstrerr().
Referenced by mainHandleCommandLineOption(), mainInitialize(), sigusr2_handle(), watch_child(), and WIN32_svcHandler().
◆ squid_getrusage()
| void squid_getrusage | ( | struct rusage * | r | ) |
Definition at line 181 of file tools.cc.
References enter_suid(), FALSE, leave_suid(), rusage::ru_majflt, rusage::ru_maxrss, rusage::ru_stime, and rusage::ru_utime.
Referenced by GetCountersStats(), GetInfo(), PrintRusage(), snmp_prfSysFn(), and statAvgTick().
◆ squid_signal()
Definition at line 874 of file tools.cc.
References DBG_CRITICAL, debugs, and xstrerr().
Referenced by mainInitialize(), and watch_child().
◆ strwordquote()
| void strwordquote | ( | MemBuf * | mb, |
| const char * | str | ||
| ) |
Definition at line 1081 of file tools.cc.
References MemBuf::append().
Referenced by Format::Format::assemble(), and ACLExternal::makeExternalAclKey().
◆ uniqueHostname()
| const char* uniqueHostname | ( | void | ) |
Definition at line 548 of file tools.cc.
References Config, debugs, getMyHostname(), and SquidConfig::uniqueHostname.
Referenced by clientReplyContext::buildReplyHeader(), configDoConfigure(), mail_warranty(), and snmp_confFn().
◆ UsingSmp()
| bool UsingSmp | ( | ) |
Definition at line 697 of file tools.cc.
References InDaemonMode(), and NumberOfKids().
Referenced by Rock::SwapDir::create(), Rock::SwapDir::doReportStat(), Ipc::Mem::Segment::Enabled(), Transients::EntryLimit(), MemStoreRr::finalizeConfig(), MemStore::getStats(), CollapsedForwarding::Init(), Rock::Rebuild::IsResponsible(), snmpConstructReponse(), SquidMain(), CacheManager::start(), and Ipc::StartListening().
◆ WaitForAnyPid()
Wait for state changes in any of the kid processes. Equivalent to waitpid(-1, ...) system call
- Parameters
-
status the exit status returned by waitpid flags WNOHANG or 0
Definition at line 107 of file tools.h.
References WaitForOnePid().
Referenced by Store::Controller::create(), SignalEngine::handleStoppedChild(), and watch_child().
◆ WaitForOnePid()
Compatibility wrapper function for waitpid \pid the pid of child process to wait for.
- Parameters
-
status the exit status returned by waitpid flags WNOHANG or 0
Definition at line 1181 of file tools.cc.
References pid.
Referenced by mainStartScript(), and WaitForAnyPid().
Variable Documentation
◆ DebugSignal
| int DebugSignal |
Definition at line 16 of file stub_tools.cc.
Referenced by masterCheckAndBroadcastSignals(), masterSignaled(), and sigusr2_handle().
◆ service_name
| SBuf service_name |
The Squid -n parameter service name. Default is APP_SHORTNAME ('squid').
Referenced by DumpInfo(), mainHandleCommandLineOption(), mainInitialize(), Instance::NamePrefix(), ProcessMacros(), WIN32_InstallService(), WIN32_RemoveService(), WIN32_sendSignal(), WIN32_SetServiceCommandLine(), WIN32_StartService(), and WIN32_Subsystem_Init().
Introduction
- About Squid
- Why Squid?
- Squid Developers
- How to Donate
- How to Help Out
- Getting Squid
- Squid Source Packages
- Squid Deployment Case-Studies
- Squid Software Foundation
Documentation
- Quick Setup
- Configuration:
- FAQ and Wiki
- Guide Books:
- Non-English
- More...
Support
- Security Advisories
- Bugzilla Database
- Mailing lists
- Contacting us
- Commercial services
- Project Sponsors
- Squid-based products
