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
16
int
DebugSignal
= -1;
17
SBuf
service_name
(
APP_SHORTNAME
);
18
void
releaseServerSockets
(
void
)
STUB_NOP
19
void
dumpMallocStats
(
void
)
STUB
20
void
squid_getrusage
(
struct
rusage
*)
STUB
21
double
rusage_cputime
(
struct
rusage
*)
STUB_RETVAL
(0)
22
int
rusage_maxrss
(struct
rusage
*)
STUB_RETVAL
(0)
23
int
rusage_pagefaults
(struct
rusage
*)
STUB_RETVAL
(0)
24
void
PrintRusage
(
void
)
STUB
25
void
death
(
int
)
STUB
26
void
BroadcastSignalIfAny
(
int
&)
STUB
27
void
sigusr2_handle
(
int
)
STUB
28
void
debug_trap
(const
char
*)
STUB
29
void
sig_child
(
int
)
STUB
30
const
char
*
getMyHostname
(
void
)
STUB_RETVAL
(
nullptr
)
31
const
char
*
uniqueHostname
(
void
)
STUB_RETVAL
(
nullptr
)
32
void
leave_suid
(
void
)
STUB_NOP
33
void
enter_suid
(
void
)
STUB
34
void
no_suid
(
void
)
STUB
35
36
bool
37
IamMasterProcess
()
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
46
bool
47
IamWorkerProcess
()
48
{
49
//std::cerr << STUB_API << " IamWorkerProcess() Not implemented\n";
50
return
true
;
51
}
52
53
bool
IamDiskProcess
()
STUB_RETVAL_NOP
(false)
54
bool
InDaemonMode
()
STUB_RETVAL_NOP
(false)
55
bool
UsingSmp
()
STUB_RETVAL_NOP
(false)
56
bool
IamCoordinatorProcess
()
STUB_RETVAL
(false)
57
bool
IamPrimaryProcess
()
STUB_RETVAL
(false)
58
int
NumberOfKids
()
STUB_RETVAL
(0)
59
60
//not actually needed in the Stub, causes dependency on SBuf
61
//SBuf ProcessRoles() STUB_RETVAL(SBuf())
62
void
setMaxFD
(
void
)
STUB
63
void
setSystemLimits
(
void
)
STUB
64
void
squid_signal
(
int
,
SIGHDLR
*,
int
)
STUB
65
void
logsFlush
(
void
)
STUB
66
void
debugObj
(
int
,
int
, const
char
*,
void
*,
ObjPackMethod
)
STUB
67
void
parseEtcHosts
(
void
)
STUB
68
int
getMyPort
(
void
)
STUB_RETVAL
(0)
69
void
setUmask
(
mode_t
)
STUB
70
void
strwordquote
(
MemBuf
*, const
char
*)
STUB
71
void
keepCapabilities
(
void
)
STUB
72
pid_t
WaitForOnePid
(pid_t,
PidStatus
&,
int
)
STUB_RETVAL
(0)
73
74
#if _SQUID_WINDOWS_
75
SBuf
WindowsErrorMessage(DWORD)
STUB_RETVAL
(
SBuf
())
76
#endif
// _SQUID_WINDOWS_
77
STUB.h
STUB
#define STUB
macro to stub a void function.
Definition
STUB.h:34
STUB_NOP
#define STUB_NOP
Definition
STUB.h:38
STUB_RETVAL
#define STUB_RETVAL(x)
Definition
STUB.h:42
STUB_RETVAL_NOP
#define STUB_RETVAL_NOP(x)
Definition
STUB.h:46
MemBuf
Definition
MemBuf.h:24
SBuf
Definition
SBuf.h:94
sig_child
void sig_child(int sig)
Definition
main.cc:762
squid.h
rusage
Definition
compat_shared.h:86
logsFlush
bool SIGHDLR int STUB void logsFlush(void) STUB void debugObj(int
IamWorkerProcess
bool IamWorkerProcess()
whether the current process handles HTTP transactions and such
Definition
stub_tools.cc:47
keepCapabilities
bool SIGHDLR int STUB void const char void ObjPackMethod STUB void const char *STUB void keepCapabilities(void) STUB pid_t WaitForOnePid(pid_t
service_name
SBuf service_name(APP_SHORTNAME)
releaseServerSockets
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
IamDiskProcess
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
DebugSignal
int DebugSignal
Definition
stub_tools.cc:16
int
bool SIGHDLR int STUB void int
Definition
stub_tools.cc:66
parseEtcHosts
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 *
leave_suid
void leave_suid(void)
Definition
tools.cc:560
IamMasterProcess
bool IamMasterProcess()
whether the current process is the parent of all other Squid processes
Definition
tools.cc:669
InDaemonMode
bool InDaemonMode()
Whether we are running in daemon mode.
Definition
tools.cc:691
strwordquote
void strwordquote(MemBuf *mb, const char *str)
Definition
tools.cc:1081
squid_signal
void squid_signal(int sig, SIGHDLR *func, int flags)
Definition
tools.cc:874
WaitForOnePid
pid_t WaitForOnePid(pid_t pid, PidStatus &status, int flags)
Definition
tools.cc:1181
getMyHostname
const char * getMyHostname(void)
Definition
tools.cc:468
setUmask
void setUmask(mode_t mask)
Definition
tools.cc:1070
death
void death(int sig)
Definition
tools.cc:346
sigusr2_handle
void sigusr2_handle(int sig)
Definition
tools.cc:434
setMaxFD
void setMaxFD(void)
Definition
tools.cc:763
squid_getrusage
void squid_getrusage(struct rusage *r)
Definition
tools.cc:181
rusage_cputime
double rusage_cputime(struct rusage *r)
Definition
tools.cc:239
IamPrimaryProcess
bool IamPrimaryProcess()
Definition
tools.cc:709
no_suid
void no_suid(void)
Definition
tools.cc:647
rusage_maxrss
int rusage_maxrss(struct rusage *r)
Definition
tools.cc:254
PrintRusage
void PrintRusage(void)
Definition
tools.cc:330
NumberOfKids
int NumberOfKids()
number of Kid processes as defined in src/ipc/Kid.h
Definition
tools.cc:725
enter_suid
void enter_suid(void)
Definition
tools.cc:624
getMyPort
int getMyPort(void)
Definition
tools.cc:1042
debugObj
void debugObj(int section, int level, const char *label, void *obj, ObjPackMethod pm)
Definition
tools.cc:939
debug_trap
void debug_trap(const char *message)
Definition
tools.cc:459
rusage_pagefaults
int rusage_pagefaults(struct rusage *r)
Definition
tools.cc:275
BroadcastSignalIfAny
void BroadcastSignalIfAny(int &sig)
Definition
tools.cc:419
IamCoordinatorProcess
bool IamCoordinatorProcess()
whether the current process coordinates worker processes
Definition
tools.cc:703
uniqueHostname
const char * uniqueHostname(void)
Definition
tools.cc:548
dumpMallocStats
void dumpMallocStats(void)
Definition
tools.cc:167
UsingSmp
bool UsingSmp()
Whether there should be more than one worker process running.
Definition
tools.cc:697
setSystemLimits
void setSystemLimits(void)
Definition
tools.cc:812
tools.h
SIGHDLR
void SIGHDLR(int sig)
callback type for signal handlers
Definition
tools.h:39
PidStatus
int PidStatus
Definition
tools.h:91
ObjPackMethod
void(* ObjPackMethod)(void *obj, Packable *p)
Definition
tools.h:33
mode_t
unsigned short mode_t
Definition
types.h:129
APP_SHORTNAME
#define APP_SHORTNAME
Definition
version.h:22
squid
src
tests
stub_tools.cc
Generated by
1.9.8