#include <Kid.h>

Collaboration diagram for Kid:

Public Types

enum  { badFailureLimit = 4 }
 keep restarting until the number of bad failures exceed this limit More...
enum  { fastFailureTimeLimit = 10 }
 slower start failures are not "frequent enough" to be counted as "bad" More...

Public Member Functions

 Kid ()
 Kid (const String &kid_name)
void start (pid_t cpid)
 called when this kid got started, records PID More...
void stop (PidStatus const exitStatus)
 called when kid terminates, sets exiting status More...
bool running () const
 returns true if tracking of kid is stopped More...
bool shouldRestart () const
 returns true if master should restart this kid More...
pid_t getPid () const
 returns current pid for a running kid and last pid for a stopped kid More...
bool hopeless () const
 whether the failures are "repeated and frequent" More...
void forgetFailures ()
 forgets all past failures, ensuring that we are not hopeless() More...
time_t deathDuration () const
bool calledExit () const
 returns true if the process terminated normally More...
int exitStatus () const
 returns the exit status of the process More...
bool calledExit (int code) const
 whether the process exited with a given exit status code More...
bool exitedHappy () const
 whether the process exited with code 0 More...
bool signaled () const
 returns true if the kid was terminated by a signal More...
int termSignal () const
 returns the number of the signal that caused the kid to terminate More...
bool signaled (int sgnl) const
 whether the process was terminated by a given signal More...
const Stringname () const
 returns kid name More...

Private Member Functions

void reportStopped () const
 describes a recently stopped kid More...

Private Attributes

String theName
 process name More...
int badFailures
 number of "repeated frequent" failures More...
pid_t pid
 current (for a running kid) or last (for stopped kid) PID More...
time_t startTime
 last start time More...
time_t stopTime = 0
 last termination time More...
bool isRunning
 whether the kid is assumed to be alive More...
PidStatus status
 exit status of a stopped kid More...

Detailed Description

Squid child, including current forked process info and info persistent across restarts

Definition at line 17 of file Kid.h.

Member Enumeration Documentation

anonymous enum

Definition at line 22 of file Kid.h.

anonymous enum

Definition at line 25 of file Kid.h.

Constructor & Destructor Documentation

Kid::Kid ( )

Definition at line 23 of file Kid.cc.

Kid::Kid ( const String kid_name)

Definition at line 32 of file Kid.cc.

Member Function Documentation

bool Kid::calledExit ( ) const

Definition at line 131 of file Kid.cc.

References pid, running(), and status.

Referenced by calledExit(), exitedHappy(), and reportStopped().

bool Kid::calledExit ( int  code) const

Definition at line 143 of file Kid.cc.

References calledExit(), code, and exitStatus().

time_t Kid::deathDuration ( ) const
the time since process termination

Definition at line 179 of file Kid.cc.

References squid_curtime, and stopTime.

bool Kid::exitedHappy ( ) const

Definition at line 149 of file Kid.cc.

References calledExit().

Referenced by shouldRestart().

int Kid::exitStatus ( ) const

Definition at line 137 of file Kid.cc.

References status.

Referenced by calledExit(), and reportStopped().

void Kid::forgetFailures ( )

Definition at line 51 of file Kid.h.

References badFailures.

pid_t Kid::getPid ( ) const

Definition at line 118 of file Kid.cc.

References assert, and pid.

bool Kid::hopeless ( ) const

Definition at line 125 of file Kid.cc.

References badFailureLimit, and badFailures.

Referenced by reportStopped(), and shouldRestart().

const String & Kid::name ( ) const

Definition at line 173 of file Kid.cc.

References theName.

Referenced by watch_child().

void Kid::reportStopped ( ) const
bool Kid::running ( ) const

Definition at line 100 of file Kid.cc.

References isRunning.

Referenced by calledExit(), shouldRestart(), signaled(), start(), and stop().

bool Kid::shouldRestart ( ) const

returns true if master process should restart this kid

Definition at line 106 of file Kid.cc.

References exitedHappy(), hopeless(), running(), shutting_down, and signaled().

Referenced by watch_child().

bool Kid::signaled ( ) const

Definition at line 155 of file Kid.cc.

References pid, running(), and status.

Referenced by reportStopped(), shouldRestart(), and signaled().

bool Kid::signaled ( int  sgnl) const

Definition at line 167 of file Kid.cc.

References signaled(), and termSignal().

void Kid::start ( pid_t  cpid)

Definition at line 43 of file Kid.cc.

References assert, isRunning, pid, running(), squid_curtime, startTime, and stopTime.

Referenced by watch_child().

void Kid::stop ( PidStatus const  exitStatus)
int Kid::termSignal ( ) const

Definition at line 161 of file Kid.cc.

References status.

Referenced by reportStopped(), and signaled().

Member Data Documentation

int Kid::badFailures

Definition at line 85 of file Kid.h.

Referenced by forgetFailures(), hopeless(), and stop().

bool Kid::isRunning

Definition at line 91 of file Kid.h.

Referenced by running(), start(), and stop().

pid_t Kid::pid

Definition at line 88 of file Kid.h.

Referenced by calledExit(), getPid(), reportStopped(), signaled(), and start().

time_t Kid::startTime

Definition at line 89 of file Kid.h.

Referenced by start(), and stop().

PidStatus Kid::status

Definition at line 92 of file Kid.h.

Referenced by calledExit(), exitStatus(), signaled(), stop(), and termSignal().

time_t Kid::stopTime = 0

Definition at line 90 of file Kid.h.

Referenced by deathDuration(), start(), and stop().

String Kid::theName

Definition at line 84 of file Kid.h.

Referenced by name(), and reportStopped().

The documentation for this class was generated from the following files:






Web Site Translations