tools.cc 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 "SquidTime.h"
#include "store/Disks.h"
#include "tools.h"
#include "wordlist.h"
#include <cerrno>
Include dependency graph for tools.cc:

Go to the source code of this file.

Macros

#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 squid-bugs@lists.squid-cache.org.\n\\n\Thanks!\n"
 
#define HAVE_GETPAGESIZE   0
 

Functions

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)
 
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)
 

Variables

int DebugSignal = -1
 
SBuf service_name (APP_SHORTNAME)
 

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 squid-bugs@lists.squid-cache.org.\n\\n\Thanks!\n"

Definition at line 53 of file tools.cc.

Referenced by dead_msg().

#define HAVE_GETPAGESIZE   0

Definition at line 238 of file tools.cc.

Function Documentation

void BroadcastSignalIfAny ( int sig)

Definition at line 363 of file tools.cc.

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

Referenced by masterCheckAndBroadcastSignals().

static char* dead_msg ( void  )
static

Definition at line 97 of file tools.cc.

References DEAD_MSG, LOCAL_ARRAY, and version_string.

Referenced by death(), and mail_warranty().

void death ( int  sig)

Definition at line 291 of file tools.cc.

Referenced by mainInitialize().

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

Definition at line 900 of file tools.cc.

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

Referenced by clientInterpretRequestHeaders(), and internalStart().

void dumpMallocStats ( void  )

Definition at line 156 of file tools.cc.

References debug_log, and Math::intPercent().

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

bool IamCoordinatorProcess ( )

Definition at line 664 of file tools.cc.

References pkCoordinator, and TheProcessKind.

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

bool IamDiskProcess ( )

Definition at line 646 of file tools.cc.

References pkDisker, and TheProcessKind.

Referenced by ProcessRoles().

bool IamMasterProcess ( )
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 670 of file tools.cc.

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

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

bool IamWorkerProcess ( )

Definition at line 636 of file tools.cc.

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

Referenced by IamPrimaryProcess(), and ProcessRoles().

void keepCapabilities ( void  )

Definition at line 1084 of file tools.cc.

References Ip::Interceptor, and Ip::Intercept::StopTransparency().

void logsFlush ( void  )

Definition at line 893 of file tools.cc.

References debug_log.

static void mail_warranty ( void  )
static
void no_suid ( void  )
void PrintRusage ( void  )
SBuf ProcessRoles ( )
void releaseServerSockets ( void  )

Definition at line 82 of file tools.cc.

References clientConnectionsClose(), and icpClosePorts().

Referenced by death().

static void restoreCapabilities ( bool  keep)
static

Definition at line 1095 of file tools.cc.

References Ip::Interceptor, Ip::Intercept::StopTransparency(), and Ip::Qos::TheConfig.

Referenced by leave_suid(), and no_suid().

double rusage_cputime ( struct rusage r)

Definition at line 228 of file tools.cc.

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

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

int rusage_maxrss ( struct rusage r)

Definition at line 243 of file tools.cc.

References rusage::ru_maxrss.

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

int rusage_pagefaults ( struct rusage r)

Definition at line 264 of file tools.cc.

References rusage::ru_majflt.

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

void setMaxFD ( void  )

Figure out the number of supported filedescriptors

Definition at line 724 of file tools.cc.

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

Referenced by SquidMain().

void setSystemLimits ( void  )
void setUmask ( mode_t  mask)

Definition at line 1031 of file tools.cc.

Referenced by mainReconfigureFinish(), parseConfigFileOrThrow(), and SquidMain().

void squid_getrusage ( struct rusage r)
void squid_signal ( int  sig,
SIGHDLR func,
int  flags 
)

Definition at line 835 of file tools.cc.

References DBG_CRITICAL, debugs, func, NULL, and xstrerr().

Referenced by mainInitialize(), and watch_child().

void strwordquote ( MemBuf mb,
const char *  str 
)

Definition at line 1042 of file tools.cc.

References MemBuf::append().

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

const char* uniqueHostname ( void  )

Definition at line 492 of file tools.cc.

References Config, debugs, getMyHostname(), HERE(), and SquidConfig::uniqueHostname.

Referenced by configDoConfigure(), mail_warranty(), and snmp_confFn().

pid_t WaitForOnePid ( pid_t  pid,
PidStatus status,
int  flags 
)

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

Parameters
statusthe exit status returned by waitpid
flagsWNOHANG or 0

Definition at line 1135 of file tools.cc.

References NULL.

Referenced by mainStartScript(), and WaitForAnyPid().

Variable Documentation

int DebugSignal = -1

Definition at line 65 of file tools.cc.

Referenced by sigusr2_handle().

SBuf service_name(APP_SHORTNAME)

The Squid -n parameter service name. Default is APP_SHORTNAME ('squid').

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors