]>
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 extern void kb_incr(kb_t
*, size_t);
45 extern void parseEtcHosts(void);
46 extern int getMyPort(void);
47 extern void setUmask(mode_t mask
);
48 extern void strwordquote(MemBuf
* mb
, const char *str
);
50 /* packs, then prints an object using debugs() */
51 extern void debugObj(int section
, int level
, const char *label
, void *obj
, ObjPackMethod pm
);
53 extern const char *getMyHostname(void);
54 extern const char *uniqueHostname(void);
56 extern void death(int sig
);
57 extern void sigusr2_handle(int sig
);
58 extern void sig_child(int sig
);
59 extern void sig_shutdown(int sig
); ///< handles shutdown notifications from kids
60 extern void leave_suid(void);
61 extern void enter_suid(void);
62 extern void no_suid(void);
63 extern void writePidFile(void);
64 extern void setMaxFD(void);
65 extern void setSystemLimits(void);
66 extern void squid_signal(int sig
, SIGHDLR
*, int flags
);
67 extern pid_t
readPidFile(void);
68 extern void keepCapabilities(void);
69 extern void BroadcastSignalIfAny(int& sig
);
71 /// whether the current process is the parent of all other Squid processes
72 extern 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 extern bool IamPrimaryProcess();
78 /// whether the current process coordinates worker processes
79 extern bool IamCoordinatorProcess();
80 /// whether the current process handles HTTP transactions and such
81 extern bool IamWorkerProcess();
82 /// whether the current process is dedicated to managing a cache_dir
83 extern bool IamDiskProcess();
84 /// Whether we are running in daemon mode
85 extern bool InDaemonMode(); // try using specific Iam*() checks above first
86 /// Whether there should be more than one worker process running
87 extern bool UsingSmp(); // try using specific Iam*() checks above first
88 /// number of Kid processes as defined in src/ipc/Kid.h
89 extern int NumberOfKids();
90 /// a string describing this process roles such as worker or coordinator
91 extern String
ProcessRoles();
93 extern void debug_trap(const char *);
94 extern void *xmemset(void *dst
, int, size_t);
96 extern void logsFlush(void);
98 extern void squid_getrusage(struct rusage
*r
);
99 extern double rusage_cputime(struct rusage
*r
);
100 extern int rusage_maxrss(struct rusage
*r
);
101 extern int rusage_pagefaults(struct rusage
*r
);
102 extern void releaseServerSockets(void);
103 extern void PrintRusage(void);
104 extern void dumpMallocStats(void);
106 #endif /* SQUID_TOOLS_H_ */