]> git.ipfire.org Git - thirdparty/squid.git/blob - src/ipc/Kids.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / ipc / Kids.h
1 /*
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 #ifndef SQUID_IPC_KIDS_H
10 #define SQUID_IPC_KIDS_H
11
12 #include "ipc/Kid.h"
13
14 #include <vector>
15
16 /// a collection of kids
17 class Kids
18 {
19 public:
20 Kids ();
21
22 private:
23 Kids (const Kids&); ///< not implemented
24 Kids& operator= (const Kids&); ///< not implemented
25
26 public:
27 /// initialize all kid records based on Config
28 void init();
29
30 /// returns kid by pid
31 Kid* find(pid_t pid);
32
33 /// returns the kid by index, useful for kids iteration
34 Kid& get(size_t i);
35
36 /// whether all kids are hopeless
37 bool allHopeless() const;
38
39 /// whether all kids called exited happy
40 bool allExitedHappy() const;
41
42 /// whether some kids died from a given signal
43 bool someSignaled(const int sgnl) const;
44
45 /// whether some kids are running
46 bool someRunning() const;
47
48 /// whether some kids should be restarted by master
49 bool shouldRestartSome() const;
50
51 /// returns the number of kids
52 size_t count() const;
53
54 private:
55 std::vector<Kid> storage;
56 };
57
58 extern Kids TheKids; ///< All kids being maintained
59
60 typedef char KidName[64]; ///< Squid process name (e.g., "squid-coord")
61 extern KidName TheKidName; ///< current Squid process name
62
63 #endif /* SQUID_IPC_KIDS_H */
64