]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/ipc/Kids.h
Docs: Copyright updates for 2018 (#114)
[thirdparty/squid.git] / src / ipc / Kids.h
index d2432a9d51ca87bd82892e95d3ba064e7a278aaa..89f49ff0b7a90d2f378ec5203711e46bce41b9a7 100644 (file)
@@ -1,14 +1,17 @@
 /*
- * $Id$
+ * Copyright (C) 1996-2018 The Squid Software Foundation and contributors
  *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
  */
 
 #ifndef SQUID_IPC_KIDS_H
 #define SQUID_IPC_KIDS_H
 
-#include "Array.h"
 #include "ipc/Kid.h"
 
+#include <vector>
 
 /// a collection of kids
 class Kids
@@ -21,8 +24,8 @@ private:
     Kids& operator= (const Kids&); ///< not implemented
 
 public:
-    /// maintain n kids
-    void init(size_t n);
+    /// initialize all kid records based on Config
+    void init();
 
     /// returns kid by pid
     Kid* find(pid_t pid);
@@ -33,22 +36,36 @@ public:
     /// whether all kids are hopeless
     bool allHopeless() const;
 
+    /// forgets all failures in all kids
+    void forgetAllFailures();
+
+    /// forgets all failures in hopeless kids that were dead for a long time
+    /// \returns seconds till the next check (zero if there are no hopeless kids left)
+    time_t forgetOldFailures();
+
     /// whether all kids called exited happy
     bool allExitedHappy() const;
 
-    /// whether all kids died from a given signal
-    bool allSignaled(int sgnl) const;
+    /// whether some kids died from a given signal
+    bool someSignaled(const int sgnl) const;
+
+    /// whether some kids are running
+    bool someRunning() const;
+
+    /// whether some kids should be restarted by master
+    bool shouldRestartSome() const;
 
     /// returns the number of kids
     size_t count() const;
 
 private:
-    Vector<Kid> storage;
+    std::vector<Kid> storage;
 };
 
 extern Kids TheKids; ///< All kids being maintained
 
-extern char KidName[NAME_MAX]; ///< current Squid process name (e.g., squid2)
-
+typedef char KidName[64]; ///< Squid process name (e.g., "squid-coord")
+extern KidName TheKidName; ///< current Squid process name
 
 #endif /* SQUID_IPC_KIDS_H */
+