Squid Web Cache master
Loading...
Searching...
No Matches
stub_tools.cc
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2025 The Squid Software Foundation and contributors
3 *
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.
7 */
8
9#include "squid.h"
10// XXX: need src/ to avoid clashes with ip/tools.h in TestIpAddress
11#include "src/tools.h"
12
13#define STUB_API "tools.cc"
14#include "tests/STUB.h"
15
16int DebugSignal = -1;
19void dumpMallocStats(void) STUB
20void squid_getrusage(struct rusage *) STUB
21double rusage_cputime(struct rusage *) STUB_RETVAL(0)
24void PrintRusage(void) STUB
25void death(int) STUB
26void BroadcastSignalIfAny(int &) STUB
27void sigusr2_handle(int) STUB
28void debug_trap(const char *) STUB
29void sig_child(int) STUB
30const char * getMyHostname(void) STUB_RETVAL(nullptr)
31const char * uniqueHostname(void) STUB_RETVAL(nullptr)
32void leave_suid(void) STUB_NOP
33void enter_suid(void) STUB
34void no_suid(void) STUB
35
36bool
38{
39 //std::cerr << STUB_API << " IamMasterProcess() Not implemented\n";
40 // Since most tests run as a single process, this is the best default.
41 // TODO: If some test case uses multiple processes and cares about
42 // its role, we may need to parameterize or remove this stub.
43 return true;
44}
45
46bool
48{
49 //std::cerr << STUB_API << " IamWorkerProcess() Not implemented\n";
50 return true;
51}
52
54bool InDaemonMode() STUB_RETVAL_NOP(false)
55bool UsingSmp() STUB_RETVAL_NOP(false)
59
60//not actually needed in the Stub, causes dependency on SBuf
61//SBuf ProcessRoles() STUB_RETVAL(SBuf())
62void setMaxFD(void) STUB
63void setSystemLimits(void) STUB
64void squid_signal(int, SIGHDLR *, int) STUB
65void logsFlush(void) STUB
66void debugObj(int, int, const char *, void *, ObjPackMethod) STUB
68int getMyPort(void) STUB_RETVAL(0)
70void strwordquote(MemBuf *, const char *) STUB
72pid_t WaitForOnePid(pid_t, PidStatus &, int) STUB_RETVAL(0)
73
74#if _SQUID_WINDOWS_
75SBuf WindowsErrorMessage(DWORD) STUB_RETVAL(SBuf())
76#endif // _SQUID_WINDOWS_
77
#define STUB
macro to stub a void function.
Definition STUB.h:34
#define STUB_NOP
Definition STUB.h:38
#define STUB_RETVAL(x)
Definition STUB.h:42
#define STUB_RETVAL_NOP(x)
Definition STUB.h:46
Definition SBuf.h:94
void sig_child(int sig)
Definition main.cc:762
bool SIGHDLR int STUB void logsFlush(void) STUB void debugObj(int
bool IamWorkerProcess()
whether the current process handles HTTP transactions and such
Definition stub_tools.cc:47
bool SIGHDLR int STUB void const char void ObjPackMethod STUB void const char *STUB void keepCapabilities(void) STUB pid_t WaitForOnePid(pid_t
SBuf service_name(APP_SHORTNAME)
void releaseServerSockets(void) STUB_NOP void dumpMallocStats(void) STUB void squid_getrusage(struct rusage *) STUB double rusage_cputime(struct rusage *) STUB_RETVAL(0) int rusage_maxrss(struct rusage *) STUB_RETVAL(0) int rusage_pagefaults(struct rusage *) STUB_RETVAL(0) void PrintRusage(void) STUB void death(int) STUB void BroadcastSignalIfAny(int &) STUB void sigusr2_handle(int) STUB void debug_trap(const char *) STUB void sig_child(int) STUB const char *getMyHostname(void) STUB_RETVAL(nullptr) const char *uniqueHostname(void) STUB_RETVAL(nullptr) void leave_suid(void) STUB_NOP void enter_suid(void) STUB void no_suid(void) STUB bool IamMasterProcess()
Definition stub_tools.cc:18
bool IamDiskProcess() STUB_RETVAL_NOP(false) bool InDaemonMode() STUB_RETVAL_NOP(false) bool UsingSmp() STUB_RETVAL_NOP(false) bool IamCoordinatorProcess() STUB_RETVAL(false) bool IamPrimaryProcess() STUB_RETVAL(false) int NumberOfKids() STUB_RETVAL(0) void setMaxFD(void) STUB void setSystemLimits(void) STUB void squid_signal(int
whether the current process is dedicated to managing a cache_dir
int DebugSignal
Definition stub_tools.cc:16
bool SIGHDLR int STUB void int
Definition stub_tools.cc:66
bool SIGHDLR int STUB void const char void ObjPackMethod STUB void parseEtcHosts(void) STUB int getMyPort(void) STUB_RETVAL(0) void setUmask(mode_t) STUB void strwordquote(MemBuf *
void leave_suid(void)
Definition tools.cc:560
bool IamMasterProcess()
whether the current process is the parent of all other Squid processes
Definition tools.cc:669
bool InDaemonMode()
Whether we are running in daemon mode.
Definition tools.cc:691
void strwordquote(MemBuf *mb, const char *str)
Definition tools.cc:1081
void squid_signal(int sig, SIGHDLR *func, int flags)
Definition tools.cc:874
pid_t WaitForOnePid(pid_t pid, PidStatus &status, int flags)
Definition tools.cc:1181
const char * getMyHostname(void)
Definition tools.cc:468
void setUmask(mode_t mask)
Definition tools.cc:1070
void death(int sig)
Definition tools.cc:346
void sigusr2_handle(int sig)
Definition tools.cc:434
void setMaxFD(void)
Definition tools.cc:763
void squid_getrusage(struct rusage *r)
Definition tools.cc:181
double rusage_cputime(struct rusage *r)
Definition tools.cc:239
bool IamPrimaryProcess()
Definition tools.cc:709
void no_suid(void)
Definition tools.cc:647
int rusage_maxrss(struct rusage *r)
Definition tools.cc:254
void PrintRusage(void)
Definition tools.cc:330
int NumberOfKids()
number of Kid processes as defined in src/ipc/Kid.h
Definition tools.cc:725
void enter_suid(void)
Definition tools.cc:624
int getMyPort(void)
Definition tools.cc:1042
void debugObj(int section, int level, const char *label, void *obj, ObjPackMethod pm)
Definition tools.cc:939
void debug_trap(const char *message)
Definition tools.cc:459
int rusage_pagefaults(struct rusage *r)
Definition tools.cc:275
void BroadcastSignalIfAny(int &sig)
Definition tools.cc:419
bool IamCoordinatorProcess()
whether the current process coordinates worker processes
Definition tools.cc:703
const char * uniqueHostname(void)
Definition tools.cc:548
void dumpMallocStats(void)
Definition tools.cc:167
bool UsingSmp()
Whether there should be more than one worker process running.
Definition tools.cc:697
void setSystemLimits(void)
Definition tools.cc:812
void SIGHDLR(int sig)
callback type for signal handlers
Definition tools.h:39
int PidStatus
Definition tools.h:91
void(* ObjPackMethod)(void *obj, Packable *p)
Definition tools.h:33
unsigned short mode_t
Definition types.h:129
#define APP_SHORTNAME
Definition version.h:22