]>
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_
38 #include "SquidString.h"
43 extern int DebugSignal
;
45 /// The Squid -n parameter service name.
46 /// Default is APP_SHORTNAME ('squid').
47 extern SBuf service_name
;
49 void kb_incr(kb_t
*, size_t);
50 void parseEtcHosts(void);
52 void setUmask(mode_t mask
);
53 void strwordquote(MemBuf
* mb
, const char *str
);
55 /* packs, then prints an object using debugs() */
56 void debugObj(int section
, int level
, const char *label
, void *obj
, ObjPackMethod pm
);
58 const char *getMyHostname(void);
59 const char *uniqueHostname(void);
62 void sigusr2_handle(int sig
);
63 void sig_child(int sig
);
64 void sig_shutdown(int sig
); ///< handles shutdown notifications from kids
65 void leave_suid(void);
66 void enter_suid(void);
68 void writePidFile(void);
70 void setSystemLimits(void);
71 void squid_signal(int sig
, SIGHDLR
*, int flags
);
72 pid_t
readPidFile(void);
73 void keepCapabilities(void);
74 void BroadcastSignalIfAny(int& sig
);
76 /// whether the current process is the parent of all other Squid processes
77 bool IamMasterProcess();
79 * whether the current process is dedicated to doing things that only
80 * a single process should do, such as PID file maintenance and WCCP
82 bool IamPrimaryProcess();
83 /// whether the current process coordinates worker processes
84 bool IamCoordinatorProcess();
85 /// whether the current process handles HTTP transactions and such
86 bool IamWorkerProcess();
87 /// whether the current process is dedicated to managing a cache_dir
88 bool IamDiskProcess();
89 /// Whether we are running in daemon mode
90 bool InDaemonMode(); // try using specific Iam*() checks above first
91 /// Whether there should be more than one worker process running
92 bool UsingSmp(); // try using specific Iam*() checks above first
93 /// number of Kid processes as defined in src/ipc/Kid.h
95 /// a string describing this process roles such as worker or coordinator
96 String
ProcessRoles();
98 void debug_trap(const char *);
100 void logsFlush(void);
102 void squid_getrusage(struct rusage
*r
);
103 double rusage_cputime(struct rusage
*r
);
104 int rusage_maxrss(struct rusage
*r
);
105 int rusage_pagefaults(struct rusage
*r
);
106 void releaseServerSockets(void);
107 void PrintRusage(void);
108 void dumpMallocStats(void);
110 #endif /* SQUID_TOOLS_H_ */