stub_tools.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 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;
19 void dumpMallocStats(void) STUB
20 void squid_getrusage(struct rusage *) STUB
21 double rusage_cputime(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
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
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)
57 bool IamPrimaryProcess() STUB_RETVAL(false)
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 
void SIGHDLR(int sig)
callback type for signal handlers
Definition: tools.h:39
int getMyPort(void)
Definition: tools.cc:1041
void dumpMallocStats(void)
Definition: tools.cc:166
const char * uniqueHostname(void)
Definition: tools.cc:547
#define STUB_RETVAL(x)
Definition: STUB.h:42
Definition: SBuf.h:93
void death(int sig)
Definition: tools.cc:345
SBuf service_name(APP_SHORTNAME)
bool SIGHDLR int STUB void int
Definition: stub_tools.cc:66
bool IamWorkerProcess()
whether the current process handles HTTP transactions and such
Definition: stub_tools.cc:47
#define APP_SHORTNAME
Definition: version.h:22
int DebugSignal
Definition: stub_tools.cc:16
void leave_suid(void)
Definition: tools.cc:559
void(* ObjPackMethod)(void *obj, Packable *p)
Definition: tools.h:33
void sigusr2_handle(int sig)
Definition: tools.cc:433
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
void PrintRusage(void)
Definition: tools.cc:329
int rusage_pagefaults(struct rusage *r)
Definition: tools.cc:274
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
pid_t WaitForOnePid(pid_t pid, PidStatus &status, int flags)
Definition: tools.cc:1180
Definition: MemBuf.h:23
void squid_signal(int sig, SIGHDLR *func, int flags)
Definition: tools.cc:873
#define STUB_RETVAL_NOP(x)
Definition: STUB.h:46
bool SIGHDLR int STUB void const char void ObjPackMethod STUB void const char *STUB void keepCapabilities(void) STUB pid_t WaitForOnePid(pid_t
bool SIGHDLR int STUB void logsFlush(void) STUB void debugObj(int
void debug_trap(const char *message)
Definition: tools.cc:458
void squid_getrusage(struct rusage *r)
Definition: tools.cc:180
#define STUB
macro to stub a void function.
Definition: STUB.h:34
bool IamMasterProcess()
whether the current process is the parent of all other Squid processes
Definition: tools.cc:668
void strwordquote(MemBuf *mb, const char *str)
Definition: tools.cc:1080
void BroadcastSignalIfAny(int &sig)
Definition: tools.cc:418
int rusage_maxrss(struct rusage *r)
Definition: tools.cc:253
double rusage_cputime(struct rusage *r)
Definition: tools.cc:238
void setUmask(mode_t mask)
Definition: tools.cc:1069
int PidStatus
Definition: tools.h:91
#define STUB_NOP
Definition: STUB.h:38
bool IamCoordinatorProcess()
whether the current process coordinates worker processes
Definition: tools.cc:702
const char * getMyHostname(void)
Definition: tools.cc:467
unsigned short mode_t
Definition: types.h:129
void enter_suid(void)
Definition: tools.cc:623
void setSystemLimits(void)
Definition: tools.cc:811
void setMaxFD(void)
Definition: tools.cc:762
void no_suid(void)
Definition: tools.cc:646
void debugObj(int section, int level, const char *label, void *obj, ObjPackMethod pm)
Definition: tools.cc:938
bool UsingSmp()
Whether there should be more than one worker process running.
Definition: tools.cc:696
int NumberOfKids()
number of Kid processes as defined in src/ipc/Kid.h
Definition: tools.cc:724
void sig_child(int sig)
Definition: main.cc:768
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 *
bool IamPrimaryProcess()
Definition: tools.cc:708
bool InDaemonMode()
Whether we are running in daemon mode.
Definition: tools.cc:690

 

Introduction

Documentation

Support

Miscellaneous