File Reference
#include "squid.h"
#include "anyp/PortCfg.h"
#include "base/Subscription.h"
#include "client_side.h"
#include "fatal.h"
#include "fde.h"
#include "fqdncache.h"
#include "fs_io.h"
#include "htcp.h"
#include "http/Stream.h"
#include "ICP.h"
#include "ip/Intercept.h"
#include "ip/QosConfig.h"
#include "ipc/Coordinator.h"
#include "ipc/Kids.h"
#include "ipcache.h"
#include "MemBuf.h"
#include "sbuf/Stream.h"
#include "SquidConfig.h"
#include "SquidMath.h"
#include "store/Disks.h"
#include "tools.h"
#include "wordlist.h"
#include <cerrno>
Include dependency graph for

Go to the source code of this file.


#define DEAD_MSG   "\The Squid Cache (version %s) died.\n\\n\You've encountered a fatal error in the Squid Cache version %s.\n\If a core file was created (possibly in the swap directory),\n\please execute 'gdb squid core' or 'dbx squid core', then type 'where',\n\and report the trace back to\n\\n\Thanks!\n"


static void mail_warranty (void)
static void restoreCapabilities (bool keep)
void releaseServerSockets (void)
static char * dead_msg (void)
void dumpMallocStats (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)
static void makeTraceable ()
static void setTraceability ()
void PrintRusage (void)
void death (int sig)
void BroadcastSignalIfAny (int &sig)
void sigusr2_handle (int sig)
void debug_trap (const char *message)
const char * getMyHostname (void)
const char * uniqueHostname (void)
void leave_suid (void)
void enter_suid (void)
void no_suid (void)
bool IamMasterProcess ()
 whether the current process is the parent of all other Squid 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...
bool IamCoordinatorProcess ()
 whether the current process coordinates worker processes More...
bool IamPrimaryProcess ()
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 setMaxFD (void)
void setSystemLimits (void)
void squid_signal (int sig, SIGHDLR *func, int flags)
void logsFlush (void)
void debugObj (int section, int level, const char *label, void *obj, ObjPackMethod pm)
void parseEtcHosts (void)
int getMyPort (void)
void setUmask (mode_t mask)
void strwordquote (MemBuf *mb, const char *str)
void keepCapabilities (void)
pid_t WaitForOnePid (pid_t pid, PidStatus &status, int flags)


int DebugSignal = -1
SBuf service_name (APP_SHORTNAME)
static char tmp_error_buf [32768]

Macro Definition Documentation


#define DEAD_MSG   "\The Squid Cache (version %s) died.\n\\n\You've encountered a fatal error in the Squid Cache version %s.\n\If a core file was created (possibly in the swap directory),\n\please execute 'gdb squid core' or 'dbx squid core', then type 'where',\n\and report the trace back to\n\\n\Thanks!\n"

Definition at line 61 of file



Definition at line 248 of file

Function Documentation

◆ BroadcastSignalIfAny()

void BroadcastSignalIfAny ( int sig)

Definition at line 418 of file

References Kids::count(), Kids::get(), IamMasterProcess(), and TheKids.

Referenced by masterCheckAndBroadcastSignals().

◆ dead_msg()

static char * dead_msg ( void  )

Definition at line 107 of file

References DEAD_MSG, LOCAL_ARRAY, and version_string.

Referenced by death(), and mail_warranty().

◆ death()

◆ debug_trap()

void debug_trap ( const char *  message)

◆ debugObj()

void debugObj ( int  section,
int  level,
const char *  label,
void *  obj,
ObjPackMethod  pm 

Definition at line 938 of file

References assert, MemBuf::buf, MemBuf::clean(), debugs, and MemBuf::init().

Referenced by clientInterpretRequestHeaders(), and internalStart().

◆ dumpMallocStats()

void dumpMallocStats ( void  )

Definition at line 166 of file

References debug_log, and Math::intPercent().

Referenced by death(), fatal_common(), and SquidShutdown().

◆ enter_suid()

◆ getMyHostname()

◆ getMyPort()

int getMyPort ( void  )

◆ IamCoordinatorProcess()

bool IamCoordinatorProcess ( )

Definition at line 702 of file

References pkCoordinator, and TheProcessKind.

Referenced by IamPrimaryProcess(), ProcessRoles(), and SquidMain().

◆ IamDiskProcess()

bool IamDiskProcess ( )

Definition at line 684 of file

References pkDisker, and TheProcessKind.

Referenced by ProcessRoles().

◆ IamMasterProcess()

bool IamMasterProcess ( )

◆ 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 708 of file

References Config, IamCoordinatorProcess(), IamWorkerProcess(), NumberOfKids(), opt_no_daemon, and SquidConfig::workers.

Referenced by Mgr::InfoAction::dump(), mainInitialize(), mainReconfigureFinish(), serverConnectionsClose(), serverConnectionsOpen(), and SquidMain().

◆ IamWorkerProcess()

bool IamWorkerProcess ( )

Definition at line 674 of file

References Config, opt_no_daemon, pkWorker, TheProcessKind, and SquidConfig::workers.

Referenced by IamPrimaryProcess(), and ProcessRoles().

◆ InDaemonMode()

◆ keepCapabilities()

void keepCapabilities ( void  )

Definition at line 1122 of file

References Ip::Interceptor.

◆ leave_suid()

◆ logsFlush()

void logsFlush ( void  )

Definition at line 931 of file

References debug_log.

◆ mail_warranty()

static void mail_warranty ( void  )

◆ makeTraceable()

static void makeTraceable ( )

Make the process traceable if possible. Call setTraceability() instead! Traceable processes may support attachment via ptrace(2) or ktrace(2), debugging sysctls, hwpmc(4), dtrace(1) and core dumping.

Definition at line 288 of file

References debugs, Here, ToSBuf(), and xstrerr().

Referenced by setTraceability().

◆ no_suid()

void no_suid ( void  )

◆ NumberOfKids()

◆ parseEtcHosts()

◆ PrintRusage()

void PrintRusage ( void  )

◆ ProcessRoles()

SBuf ProcessRoles ( )

◆ releaseServerSockets()

void releaseServerSockets ( void  )

Definition at line 92 of file

References clientConnectionsClose(), and icpClosePorts().

Referenced by death().

◆ restoreCapabilities()

static void restoreCapabilities ( bool  keep)

Definition at line 1133 of file

References Ip::Interceptor, and Ip::Qos::TheConfig.

Referenced by leave_suid(), and no_suid().

◆ rusage_cputime()

double rusage_cputime ( struct rusage r)

Definition at line 238 of file

References double, rusage::ru_stime, and rusage::ru_utime.

Referenced by GetCountersStats(), GetInfo(), PrintRusage(), snmp_prfSysFn(), and statAvgTick().

◆ rusage_maxrss()

int rusage_maxrss ( struct rusage r)

Definition at line 253 of file

References rusage::ru_maxrss.

Referenced by GetInfo(), PrintRusage(), and snmp_prfSysFn().

◆ rusage_pagefaults()

int rusage_pagefaults ( struct rusage r)

Definition at line 274 of file

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 762 of file

References Config, DBG_CRITICAL, debugs, SquidConfig::max_filedescriptors, Squid_MaxFD, and xstrerr().

Referenced by StartUsingConfig().

◆ setSystemLimits()

void setSystemLimits ( void  )

◆ setTraceability()

static void setTraceability ( )

Make the process traceable if necessary.

See also

Definition at line 314 of file

References Config, SquidConfig::coredump_dir, CurrentException(), DBG_IMPORTANT, debugs, Debug::Extra(), and makeTraceable().

Referenced by enter_suid(), leave_suid(), and no_suid().

◆ setUmask()

void setUmask ( mode_t  mask)

Definition at line 1069 of file

Referenced by mainReconfigureFinish(), and SquidMain().

◆ sigusr2_handle()

◆ squid_getrusage()

void squid_getrusage ( struct rusage r)

◆ squid_signal()

void squid_signal ( int  sig,
int  flags 

Definition at line 873 of file

References DBG_CRITICAL, debugs, and xstrerr().

Referenced by mainInitialize(), and watch_child().

◆ strwordquote()

void strwordquote ( MemBuf mb,
const char *  str 

Definition at line 1080 of file

References MemBuf::append().

Referenced by Format::Format::assemble(), and makeExternalAclKey().

◆ uniqueHostname()

const char * uniqueHostname ( void  )

◆ UsingSmp()

◆ WaitForOnePid()

pid_t WaitForOnePid ( pid_t  pid,
PidStatus status,
int  flags 

Compatibility wrapper function for waitpid \pid the pid of child process to wait for.

statusthe exit status returned by waitpid
flagsWNOHANG or 0

Definition at line 1180 of file

References pid.

Referenced by mainStartScript(), and WaitForAnyPid().

Variable Documentation

◆ DebugSignal

int DebugSignal = -1

Definition at line 73 of file

Referenced by sigusr2_handle().

◆ service_name


◆ tmp_error_buf

char tmp_error_buf[32768]

Definition at line 89 of file

Referenced by setSystemLimits().






Web Site Translations