]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/tools.h
2 * DEBUG: section 21 Misc Functions
3 * AUTHOR: Harvest Derived
5 * SQUID Web Proxy Cache http://www.squid-cache.org/
6 * ----------------------------------------------------------
8 * Squid is the result of efforts by numerous individuals from
9 * the Internet community; see the CONTRIBUTORS file for full
10 * details. Many organizations have provided support for Squid's
11 * development; see the SPONSORS file for full details. Squid is
12 * Copyrighted (C) 2001 by the Regents of the University of
13 * California; see the COPYRIGHT file for full details. Squid
14 * incorporates software developed and/or copyrighted by other
15 * sources; see the CREDITS file for full details.
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published by
19 * the Free Software Foundation; either version 2 of the License, or
20 * (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
33 #ifndef SQUID_TOOLS_H_
34 #define SQUID_TOOLS_H_
37 #include "SquidString.h"
42 extern int DebugSignal
;
44 void kb_incr(kb_t
*, size_t);
45 void parseEtcHosts(void);
47 void setUmask(mode_t mask
);
48 void strwordquote(MemBuf
* mb
, const char *str
);
50 /* packs, then prints an object using debugs() */
51 void debugObj(int section
, int level
, const char *label
, void *obj
, ObjPackMethod pm
);
53 const char *getMyHostname(void);
54 const char *uniqueHostname(void);
57 void sigusr2_handle(int sig
);
58 void sig_child(int sig
);
59 void sig_shutdown(int sig
); ///< handles shutdown notifications from kids
60 void leave_suid(void);
61 void enter_suid(void);
63 void writePidFile(void);
65 void setSystemLimits(void);
66 void squid_signal(int sig
, SIGHDLR
*, int flags
);
67 pid_t
readPidFile(void);
68 void keepCapabilities(void);
69 void BroadcastSignalIfAny(int& sig
);
71 /// whether the current process is the parent of all other Squid processes
72 bool IamMasterProcess();
74 * whether the current process is dedicated to doing things that only
75 * a single process should do, such as PID file maintenance and WCCP
77 bool IamPrimaryProcess();
78 /// whether the current process coordinates worker processes
79 bool IamCoordinatorProcess();
80 /// whether the current process handles HTTP transactions and such
81 bool IamWorkerProcess();
82 /// whether the current process is dedicated to managing a cache_dir
83 bool IamDiskProcess();
84 /// Whether we are running in daemon mode
85 bool InDaemonMode(); // try using specific Iam*() checks above first
86 /// Whether there should be more than one worker process running
87 bool UsingSmp(); // try using specific Iam*() checks above first
88 /// number of Kid processes as defined in src/ipc/Kid.h
90 /// a string describing this process roles such as worker or coordinator
91 String
ProcessRoles();
93 void debug_trap(const char *);
97 void squid_getrusage(struct rusage
*r
);
98 double rusage_cputime(struct rusage
*r
);
99 int rusage_maxrss(struct rusage
*r
);
100 int rusage_pagefaults(struct rusage
*r
);
101 void releaseServerSockets(void);
102 void PrintRusage(void);
103 void dumpMallocStats(void);
105 #endif /* SQUID_TOOLS_H_ */