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