]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/tools.h
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
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.
9 /* DEBUG: section 21 Misc Functions */
11 #ifndef SQUID_TOOLS_H_
12 #define SQUID_TOOLS_H_
16 #include "SquidString.h"
21 extern int DebugSignal
;
23 /// The Squid -n parameter service name.
24 /// Default is APP_SHORTNAME ('squid').
25 extern SBuf service_name
;
27 void kb_incr(kb_t
*, size_t);
28 void parseEtcHosts(void);
30 void setUmask(mode_t mask
);
31 void strwordquote(MemBuf
* mb
, const char *str
);
33 /* packs, then prints an object using debugs() */
34 void debugObj(int section
, int level
, const char *label
, void *obj
, ObjPackMethod pm
);
36 const char *getMyHostname(void);
37 const char *uniqueHostname(void);
40 void sigusr2_handle(int sig
);
41 void sig_child(int sig
);
42 void sig_shutdown(int sig
); ///< handles shutdown notifications from kids
43 void leave_suid(void);
44 void enter_suid(void);
46 void writePidFile(void);
48 void setSystemLimits(void);
49 void squid_signal(int sig
, SIGHDLR
*, int flags
);
50 pid_t
readPidFile(void);
51 void keepCapabilities(void);
52 void BroadcastSignalIfAny(int& sig
);
54 /// whether the current process is the parent of all other Squid processes
55 bool IamMasterProcess();
57 * whether the current process is dedicated to doing things that only
58 * a single process should do, such as PID file maintenance and WCCP
60 bool IamPrimaryProcess();
61 /// whether the current process coordinates worker processes
62 bool IamCoordinatorProcess();
63 /// whether the current process handles HTTP transactions and such
64 bool IamWorkerProcess();
65 /// whether the current process is dedicated to managing a cache_dir
66 bool IamDiskProcess();
67 /// Whether we are running in daemon mode
68 bool InDaemonMode(); // try using specific Iam*() checks above first
69 /// Whether there should be more than one worker process running
70 bool UsingSmp(); // try using specific Iam*() checks above first
71 /// number of Kid processes as defined in src/ipc/Kid.h
73 /// a string describing this process roles such as worker or coordinator
74 String
ProcessRoles();
76 void debug_trap(const char *);
80 void squid_getrusage(struct rusage
*r
);
81 double rusage_cputime(struct rusage
*r
);
82 int rusage_maxrss(struct rusage
*r
);
83 int rusage_pagefaults(struct rusage
*r
);
84 void releaseServerSockets(void);
85 void PrintRusage(void);
86 void dumpMallocStats(void);
88 #endif /* SQUID_TOOLS_H_ */