]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/ipc/Kid.cc
4 * DEBUG: section 54 Interprocess Communication
19 Kid::Kid(const String
& kid_name
):
28 /// called when this kid got started, records PID
29 void Kid::start(pid_t cpid
)
39 /// called when kid terminates, sets exiting status
40 void Kid::stop(status_type exitStatus
)
43 assert(startTime
!= 0);
49 if ((stop_time
- startTime
) < fastFailureTimeLimit
)
52 badFailures
= 0; // the failures are not "frequent" [any more]
57 /// returns true if tracking of kid is stopped
58 bool Kid::running() const
63 /// returns current pid for a running kid and last pid for a stopped kid
64 pid_t
Kid::getPid() const
70 /// whether the failures are "repeated and frequent"
71 bool Kid::hopeless() const
73 return badFailures
> badFailureLimit
;
76 /// returns true if the process terminated normally
77 bool Kid::calledExit() const
79 return (pid
> 0) && !running() && WIFEXITED(status
);
82 /// returns the exit status of the process
83 int Kid::exitStatus() const
85 return WEXITSTATUS(status
);
88 /// whether the process exited with a given exit status code
89 bool Kid::calledExit(int code
) const
91 return calledExit() && (exitStatus() == code
);
94 /// whether the process exited with code 0
95 bool Kid::exitedHappy() const
100 /// returns true if the kid was terminated by a signal
101 bool Kid::signaled() const
103 return (pid
> 0) && !running() && WIFSIGNALED(status
);
106 /// returns the number of the signal that caused the kid to terminate
107 int Kid::termSignal() const
109 return WTERMSIG(status
);
112 /// whether the process was terminated by a given signal
113 bool Kid::signaled(int sgnl
) const
115 return signaled() && (termSignal() == sgnl
);
119 const String
& Kid::name() const