]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/ipc/Kids.cc
4 * DEBUG: section 54 Interprocess Communication
22 if (storage
.size() > 0)
25 storage
.reserve(NumberOfKids());
29 // add Kid records for all workers
30 for (int i
= 0; i
< Config
.workers
; ++i
) {
31 snprintf(kid_name
, sizeof(kid_name
), "(squid-%d)", (int)(storage
.size()+1));
32 storage
.push_back(Kid(kid_name
));
35 // add Kid records for all disk processes
36 // (XXX: some cache_dirs do not need this)
37 for (int i
= 0; i
< Config
.cacheSwap
.n_configured
; ++i
) {
38 snprintf(kid_name
, sizeof(kid_name
), "(squid-disk-%d)", (int)(storage
.size()+1));
39 storage
.push_back(Kid(kid_name
));
42 // if coordination is needed, add a Kid record for Coordinator
43 if (storage
.size() > 1) {
44 snprintf(kid_name
, sizeof(kid_name
), "(squid-coord-%d)", (int)(storage
.size()+1));
45 storage
.push_back(Kid(kid_name
));
49 /// returns kid by pid
50 Kid
* Kids::find(pid_t pid
)
55 for (size_t i
= 0; i
< storage
.size(); ++i
) {
56 if (storage
[i
].getPid() == pid
)
62 /// returns the kid by index, useful for kids iteration
63 Kid
& Kids::get(size_t i
)
65 assert(i
>= 0 && i
< count());
69 /// whether all kids are hopeless
70 bool Kids::allHopeless() const
72 for (size_t i
= 0; i
< storage
.size(); ++i
) {
73 if (!storage
[i
].hopeless())
79 /// whether all kids called exited happy
80 bool Kids::allExitedHappy() const
82 for (size_t i
= 0; i
< storage
.size(); ++i
) {
83 if (!storage
[i
].exitedHappy())
89 /// whether all kids died from a given signal
90 bool Kids::allSignaled(int sgnl
) const
92 for (size_t i
= 0; i
< storage
.size(); ++i
) {
93 if (!storage
[i
].signaled(sgnl
))
99 /// returns the number of kids
100 size_t Kids::count() const
102 return storage
.size();