tools.h File Reference
#include "sbuf/SBuf.h"
#include "typedefs.h"
Include dependency graph for tools.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


typedef void(* ObjPackMethod )(void *obj, Packable *p)
typedef void SIGHDLR (int sig)
 callback type for signal handlers More...
typedef int PidStatus


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)


int DebugSignal
SBuf service_name

Typedef Documentation

typedef void(* ObjPackMethod)(void *obj, Packable *p)

Definition at line 33 of file tools.h.

typedef int PidStatus

Definition at line 94 of file tools.h.

typedef void SIGHDLR(int sig)

Definition at line 39 of file tools.h.

Function Documentation

void BroadcastSignalIfAny ( int sig)

Definition at line 363 of file

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

Referenced by masterCheckAndBroadcastSignals().

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

Definition at line 900 of file

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

Referenced by clientInterpretRequestHeaders(), and internalStart().

void dumpMallocStats ( void  )

Definition at line 156 of file

References debug_log, and Math::intPercent().

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

bool IamCoordinatorProcess ( )

Definition at line 664 of file

References pkCoordinator, and TheProcessKind.

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

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

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

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

void keepCapabilities ( void  )

Definition at line 1084 of file

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

Referenced by setEffectiveUser().

void logsFlush ( void  )

Definition at line 893 of file

References debug_log.

Referenced by ipcCreate().

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

Definition at line 82 of file

References clientConnectionsClose(), and icpClosePorts().

Referenced by death().

double rusage_cputime ( struct rusage r)

Definition at line 228 of file

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

References rusage::ru_maxrss.

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

int rusage_pagefaults ( struct rusage r)

Definition at line 264 of file

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

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

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

void sig_child ( int  sig)

Definition at line 786 of file

References do_handle_stopped_child, and sig_child().

Referenced by mainInitialize(), and sig_child().

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

Definition at line 835 of file

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

References MemBuf::append().

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

const char* uniqueHostname ( void  )

Definition at line 492 of file

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

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

pid_t WaitForAnyPid ( PidStatus status,
int  flags 

Wait for state changes in any of the kid processes. Equivalent to waitpid(-1, ...) system call

statusthe exit status returned by waitpid
flagsWNOHANG or 0

Definition at line 111 of file tools.h.

References WaitForOnePid().

Referenced by Store::Controller::create(), SignalEngine::handleStoppedChild(), and watch_child().

pid_t WaitForOnePid ( pid_t  pid,
PidStatus status,
int  flags 

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

statusthe exit status returned by waitpid
flagsWNOHANG or 0

Definition at line 1135 of file

References NULL.

Referenced by mainStartScript(), and WaitForAnyPid().

Variable Documentation

int DebugSignal

Definition at line 16 of file

Referenced by masterCheckAndBroadcastSignals(), masterSignaled(), and sigusr2_handle().






Web Site Translations