From: Francesco Chemolli Date: Thu, 30 Aug 2012 14:18:27 +0000 (+0200) Subject: Moved some prototypes to tools.h X-Git-Tag: sourceformat-review-1~39 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5bed43d622661d7302e7a0a740730129fecb3022;p=thirdparty%2Fsquid.git Moved some prototypes to tools.h --- diff --git a/include/fatal.h b/include/fatal.h index 4a8892c5e8..26ce8b2600 100644 --- a/include/fatal.h +++ b/include/fatal.h @@ -1,8 +1,8 @@ #ifndef SQUID_FATAL_H #define SQUID_FATAL_H -SQUIDCEXTERN void fatal(const char *message); -SQUIDCEXTERN void fatalf(const char *fmt,...) PRINTF_FORMAT_ARG1; +extern void fatal(const char *message); +extern void fatalf(const char *fmt,...) PRINTF_FORMAT_ARG1; extern void fatal_dump(const char *message); #endif /* SQUID_FATAL_H */ diff --git a/src/CpuAffinity.cc b/src/CpuAffinity.cc index b6649221fc..b944c912b5 100644 --- a/src/CpuAffinity.cc +++ b/src/CpuAffinity.cc @@ -13,6 +13,7 @@ #include "Debug.h" #include "protos.h" #include "structs.h" +#include "tools.h" #include diff --git a/src/DiskIO/DiskDaemon/DiskdAction.cc b/src/DiskIO/DiskDaemon/DiskdAction.cc index b255ab16f4..95f09845da 100644 --- a/src/DiskIO/DiskDaemon/DiskdAction.cc +++ b/src/DiskIO/DiskDaemon/DiskdAction.cc @@ -14,6 +14,7 @@ #include "mgr/ActionWriter.h" #include "Store.h" #include "protos.h" +#include "tools.h" DiskdActionData::DiskdActionData() { diff --git a/src/DiskIO/IpcIo/IpcIoFile.cc b/src/DiskIO/IpcIo/IpcIoFile.cc index 0c6f5d4ad0..03526a9f2d 100644 --- a/src/DiskIO/IpcIo/IpcIoFile.cc +++ b/src/DiskIO/IpcIo/IpcIoFile.cc @@ -23,6 +23,7 @@ #include "protos.h" #include "SquidTime.h" #include "StatCounters.h" +#include "tools.h" #if HAVE_ERRNO_H #include diff --git a/src/Makefile.am b/src/Makefile.am index 6945aabcb9..52de8c3283 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1183,7 +1183,6 @@ tests_testHttpReply_LDADD=\ $(XTRA_LIBS) tests_testHttpReply_DEPENDENCIES= $(SQUID_CPPUNIT_LA) - tests_testACLMaxUserIP_SOURCES= \ cbdata.cc \ ClientInfo.h \ @@ -1664,8 +1663,6 @@ tests_testDiskIO_SOURCES = \ tests/stub_store_stats.cc \ store_rebuild.h \ tests/stub_store_rebuild.cc \ - tools.h \ - tests/stub_tools.cc \ tests/stub_UdsOp.cc \ tests/testDiskIO.cc \ tests/testDiskIO.h \ @@ -1678,7 +1675,9 @@ tests_testDiskIO_SOURCES = \ URLScheme.cc \ $(WIN32_SOURCE) \ wordlist.h \ - wordlist.cc + wordlist.cc \ + tools.h \ + tests/stub_tools.cc nodist_tests_testDiskIO_SOURCES= \ $(TESTSOURCES) \ $(DISKIO_GEN_SOURCE) \ diff --git a/src/MemStore.cc b/src/MemStore.cc index 8e560b2432..2f7dd47e7f 100644 --- a/src/MemStore.cc +++ b/src/MemStore.cc @@ -15,6 +15,7 @@ #include "mime_header.h" #include "protos.h" #include "StoreStats.h" +#include "tools.h" /// shared memory segment path to use for MemStore maps static const char *ShmLabel = "cache_mem"; diff --git a/src/StoreStats.cc b/src/StoreStats.cc index 371d4184d3..9e55bb67bf 100644 --- a/src/StoreStats.cc +++ b/src/StoreStats.cc @@ -6,7 +6,7 @@ */ #include "squid.h" -#include "protos.h" /* for xmemset only */ +#include "tools.h" #include "StoreStats.h" /* StoreInfoStats */ diff --git a/src/SwapDir.cc b/src/SwapDir.cc index 40f5895559..a04239785a 100644 --- a/src/SwapDir.cc +++ b/src/SwapDir.cc @@ -1,6 +1,4 @@ /* - * $Id$ - * * DEBUG: section 20 Swap Dir base object * AUTHOR: Robert Collins * @@ -40,6 +38,7 @@ #include "protos.h" #include "StoreFileSystem.h" #include "SwapDir.h" +#include "tools.h" SwapDir::SwapDir(char const *aType): theType(aType), max_size(0), diff --git a/src/cache_manager.cc b/src/cache_manager.cc index 83445cfe0c..cafc1cb332 100644 --- a/src/cache_manager.cc +++ b/src/cache_manager.cc @@ -1,7 +1,4 @@ - /* - * $Id$ - * * DEBUG: section 16 Cache Manager Objects * AUTHOR: Duane Wessels * @@ -51,9 +48,11 @@ #include "mgr/FunAction.h" #include "mgr/QueryParams.h" #include "protos.h" /* rotate_logs() */ +#include "tools.h" #include "SquidTime.h" #include "Store.h" #include "wordlist.h" + #include /// \ingroup CacheManagerInternal diff --git a/src/event.cc b/src/event.cc index a5764cbcde..e837839285 100644 --- a/src/event.cc +++ b/src/event.cc @@ -40,6 +40,7 @@ #include "SquidTime.h" #include "profiler/Profiler.h" #include "protos.h" +#include "tools.h" /* The list of event processes */ diff --git a/src/fs/rock/RockRebuild.cc b/src/fs/rock/RockRebuild.cc index f1b7b3687e..4b2b7d8fc9 100644 --- a/src/fs/rock/RockRebuild.cc +++ b/src/fs/rock/RockRebuild.cc @@ -9,6 +9,7 @@ #include "fs/rock/RockDbCell.h" #include "md5.h" #include "protos.h" +#include "tools.h" #include "typedefs.h" #include "SquidTime.h" #include "store_rebuild.h" diff --git a/src/fs/rock/RockSwapDir.cc b/src/fs/rock/RockSwapDir.cc index 7bef29a71f..9bb6acc038 100644 --- a/src/fs/rock/RockSwapDir.cc +++ b/src/fs/rock/RockSwapDir.cc @@ -20,6 +20,8 @@ #include "Parsing.h" #include "protos.h" #include "SquidMath.h" +#include "tools.h" + #include #include diff --git a/src/fs/ufs/RebuildState.cc b/src/fs/ufs/RebuildState.cc index 78ea660397..9f345fc3d5 100644 --- a/src/fs/ufs/RebuildState.cc +++ b/src/fs/ufs/RebuildState.cc @@ -39,6 +39,7 @@ #include "store_key_md5.h" #include "StoreSwapLogData.h" #include "store_rebuild.h" +#include "tools.h" #include "UFSSwapLogParser.h" #if HAVE_MATH_H diff --git a/src/fs/ufs/UFSSwapDir.cc b/src/fs/ufs/UFSSwapDir.cc index b72626d918..90828770c4 100644 --- a/src/fs/ufs/UFSSwapDir.cc +++ b/src/fs/ufs/UFSSwapDir.cc @@ -48,6 +48,7 @@ #include "StoreSwapLogData.h" #include "SquidTime.h" #include "StatCounters.h" +#include "tools.h" #include "UFSSwapDir.h" #if HAVE_MATH_H diff --git a/src/icmp/net_db.cc b/src/icmp/net_db.cc index f9309018d4..afe19e6a9c 100644 --- a/src/icmp/net_db.cc +++ b/src/icmp/net_db.cc @@ -39,29 +39,30 @@ */ #include "squid.h" -#include "icmp/net_db.h" -#include "log/File.h" #include "cbdata.h" +#include "disk.h" #include "event.h" -#include "mgr/Registration.h" -#include "Store.h" -#include "SwapDir.h" -#include "HttpRequest.h" -#include "HttpReply.h" -#include "MemObject.h" #include "fde.h" #include "forward.h" +#include "HttpReply.h" +#include "HttpRequest.h" +#include "icmp/net_db.h" #include "internal.h" +#include "ip/Address.h" +#include "log/File.h" +#include "Mem.h" +#include "MemObject.h" +#include "mgr/Registration.h" #include "mime_header.h" +#include "neighbors.h" #include "protos.h" #include "SquidTime.h" -#include "wordlist.h" -#include "ip/Address.h" -#include "neighbors.h" -#include "URL.h" -#include "Mem.h" -#include "disk.h" +#include "Store.h" #include "StoreClient.h" +#include "SwapDir.h" +#include "tools.h" +#include "URL.h" +#include "wordlist.h" #if HAVE_SYS_STAT_H #include diff --git a/src/ipc/Kids.cc b/src/ipc/Kids.cc index 0747b564e1..94089cf548 100644 --- a/src/ipc/Kids.cc +++ b/src/ipc/Kids.cc @@ -9,6 +9,7 @@ #include "base/TextException.h" #include "ipc/Kids.h" #include "protos.h" +#include "tools.h" Kids TheKids; KidName TheKidName; diff --git a/src/ipc/SharedListen.cc b/src/ipc/SharedListen.cc index 80fc691e80..5547840c8e 100644 --- a/src/ipc/SharedListen.cc +++ b/src/ipc/SharedListen.cc @@ -1,8 +1,5 @@ /* - * $Id$ - * * DEBUG: section 54 Interprocess Communication - * */ #include "squid.h" @@ -17,6 +14,7 @@ #include "ipc/StartListening.h" #include "ipc/SharedListen.h" #include "protos.h" +#include "tools.h" #include diff --git a/src/ipc/StoreMap.cc b/src/ipc/StoreMap.cc index 1a97436ac4..b8345511fa 100644 --- a/src/ipc/StoreMap.cc +++ b/src/ipc/StoreMap.cc @@ -1,14 +1,13 @@ /* - * $Id$ - * * DEBUG: section 54 Interprocess Communication */ #include "squid.h" +#include "ipc/StoreMap.h" #include "protos.h" -#include "Store.h" #include "store_key_md5.h" -#include "ipc/StoreMap.h" +#include "Store.h" +#include "tools.h" Ipc::StoreMap::Owner * Ipc::StoreMap::Init(const char *const path, const int limit, const size_t extrasSize) diff --git a/src/ipc/TypedMsgHdr.cc b/src/ipc/TypedMsgHdr.cc index 68e011064a..c7ff95eab2 100644 --- a/src/ipc/TypedMsgHdr.cc +++ b/src/ipc/TypedMsgHdr.cc @@ -9,6 +9,7 @@ #include "protos.h" #include "base/TextException.h" #include "ipc/TypedMsgHdr.h" +#include "tools.h" #include diff --git a/src/ipc/mem/Pages.cc b/src/ipc/mem/Pages.cc index c99f4d5e19..e8711ed887 100644 --- a/src/ipc/mem/Pages.cc +++ b/src/ipc/mem/Pages.cc @@ -13,6 +13,7 @@ #include "protos.h" #include "structs.h" #include "SwapDir.h" +#include "tools.h" // Uses a single PagePool instance, for now. // Eventually, we may have pools dedicated to memory caching, disk I/O, etc. diff --git a/src/ipc/mem/Segment.cc b/src/ipc/mem/Segment.cc index 8ce9bc95da..0d006ff326 100644 --- a/src/ipc/mem/Segment.cc +++ b/src/ipc/mem/Segment.cc @@ -10,6 +10,7 @@ #include "compat/shm.h" #include "ipc/mem/Segment.h" #include "protos.h" +#include "tools.h" #include #include diff --git a/src/mgr/CountersAction.cc b/src/mgr/CountersAction.cc index f138888c26..d4b0cab517 100644 --- a/src/mgr/CountersAction.cc +++ b/src/mgr/CountersAction.cc @@ -13,6 +13,7 @@ #include "protos.h" #include "SquidTime.h" #include "Store.h" +#include "tools.h" extern void GetCountersStats(Mgr::CountersActionData& stats); extern void DumpCountersStats(Mgr::CountersActionData& stats, StoreEntry* sentry); diff --git a/src/mgr/FunAction.cc b/src/mgr/FunAction.cc index 855c40973f..14edd75941 100644 --- a/src/mgr/FunAction.cc +++ b/src/mgr/FunAction.cc @@ -16,6 +16,7 @@ #include "mgr/Request.h" #include "protos.h" #include "Store.h" +#include "tools.h" Mgr::FunAction::Pointer Mgr::FunAction::Create(const Command::Pointer &aCmd, OBJH* aHandler) diff --git a/src/mgr/InfoAction.cc b/src/mgr/InfoAction.cc index f419fbe85b..6acec69f94 100644 --- a/src/mgr/InfoAction.cc +++ b/src/mgr/InfoAction.cc @@ -20,6 +20,7 @@ #include "protos.h" #include "SquidTime.h" #include "Store.h" +#include "tools.h" extern void GetInfo(Mgr::InfoActionData& stats); extern void DumpInfo(Mgr::InfoActionData& stats, StoreEntry* sentry); diff --git a/src/mgr/IntervalAction.cc b/src/mgr/IntervalAction.cc index 1e6195caba..6ab1230a4e 100644 --- a/src/mgr/IntervalAction.cc +++ b/src/mgr/IntervalAction.cc @@ -13,6 +13,7 @@ #include "protos.h" #include "SquidMath.h" #include "Store.h" +#include "tools.h" extern void GetAvgStat(Mgr::IntervalActionData& stats, int minutes, int hours); extern void DumpAvgStat(Mgr::IntervalActionData& stats, StoreEntry* sentry); diff --git a/src/mgr/IoAction.cc b/src/mgr/IoAction.cc index 04131dfb7c..5a6eb8dfde 100644 --- a/src/mgr/IoAction.cc +++ b/src/mgr/IoAction.cc @@ -13,6 +13,7 @@ #include "protos.h" #include "SquidMath.h" #include "Store.h" +#include "tools.h" extern void GetIoStats(Mgr::IoActionData& stats); extern void DumpIoStats(Mgr::IoActionData& stats, StoreEntry* sentry); diff --git a/src/mgr/ServiceTimesAction.cc b/src/mgr/ServiceTimesAction.cc index f2f982fb4c..7246e209eb 100644 --- a/src/mgr/ServiceTimesAction.cc +++ b/src/mgr/ServiceTimesAction.cc @@ -12,6 +12,7 @@ #include "mgr/ServiceTimesAction.h" #include "protos.h" #include "Store.h" +#include "tools.h" extern void GetServiceTimesStats(Mgr::ServiceTimesActionData& stats); extern void DumpServiceTimesStats(Mgr::ServiceTimesActionData& stats, StoreEntry* sentry); diff --git a/src/mgr/StoreIoAction.cc b/src/mgr/StoreIoAction.cc index f47a1fe6bc..72e2a674f3 100644 --- a/src/mgr/StoreIoAction.cc +++ b/src/mgr/StoreIoAction.cc @@ -12,6 +12,7 @@ #include "mgr/StoreIoAction.h" #include "protos.h" #include "Store.h" +#include "tools.h" Mgr::StoreIoActionData::StoreIoActionData() { diff --git a/src/protos.h b/src/protos.h index c50b2620af..da767d3b16 100644 --- a/src/protos.h +++ b/src/protos.h @@ -90,33 +90,9 @@ class store_client; #include "fatal.h" -/// whether the current process is the parent of all other Squid processes -SQUIDCEXTERN bool IamMasterProcess(); -/** - whether the current process is dedicated to doing things that only - a single process should do, such as PID file maintenance and WCCP -*/ -SQUIDCEXTERN bool IamPrimaryProcess(); -/// whether the current process coordinates worker processes -SQUIDCEXTERN bool IamCoordinatorProcess(); -/// whether the current process handles HTTP transactions and such -SQUIDCEXTERN bool IamWorkerProcess(); -/// whether the current process is dedicated to managing a cache_dir -extern bool IamDiskProcess(); -/// Whether we are running in daemon mode -SQUIDCEXTERN bool InDaemonMode(); // try using specific Iam*() checks above first -/// Whether there should be more than one worker process running -SQUIDCEXTERN bool UsingSmp(); // try using specific Iam*() checks above first -/// number of Kid processes as defined in src/ipc/Kid.h -SQUIDCEXTERN int NumberOfKids(); -/// a string describing this process roles such as worker or coordinator -extern String ProcessRoles(); SQUIDCEXTERN int DebugSignal; -/* AYJ debugs function to show locations being reset with memset() */ -SQUIDCEXTERN void *xmemset(void *dst, int, size_t); -SQUIDCEXTERN void debug_trap(const char *); SQUIDCEXTERN void logsFlush(void); SQUIDCEXTERN const char *checkNullString(const char *p); diff --git a/src/snmp/Pdu.cc b/src/snmp/Pdu.cc index 10d09a8138..7565ab825b 100644 --- a/src/snmp/Pdu.cc +++ b/src/snmp/Pdu.cc @@ -12,6 +12,7 @@ #include "snmp_core.h" #include "snmp/Pdu.h" #include "snmp/Var.h" +#include "tools.h" #if HAVE_ALGORITHM #include #endif diff --git a/src/snmp/Session.cc b/src/snmp/Session.cc index 0afb380a0a..1bfbda4e58 100644 --- a/src/snmp/Session.cc +++ b/src/snmp/Session.cc @@ -10,6 +10,7 @@ #include "ipc/TypedMsgHdr.h" #include "protos.h" #include "snmp/Session.h" +#include "tools.h" Snmp::Session::Session() { diff --git a/src/snmp/Var.cc b/src/snmp/Var.cc index 93b0cde846..321168d2e8 100644 --- a/src/snmp/Var.cc +++ b/src/snmp/Var.cc @@ -10,6 +10,7 @@ #include "ipc/TypedMsgHdr.h" #include "protos.h" #include "snmp/Var.h" +#include "tools.h" #if HAVE_ALGORITHM #include #endif diff --git a/src/snmp_core.cc b/src/snmp_core.cc index fa1314555b..ccc42c0668 100644 --- a/src/snmp_core.cc +++ b/src/snmp_core.cc @@ -41,6 +41,7 @@ #include "protos.h" #include "snmp_core.h" #include "snmp/Forwarder.h" +#include "tools.h" static void snmpPortOpened(const Comm::ConnectionPointer &conn, int errNo); diff --git a/src/stat.cc b/src/stat.cc index 67a0cbf1b0..2cceb9003a 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -63,6 +63,7 @@ #include "StoreClient.h" #include "Store.h" #include "store_digest.h" +#include "tools.h" #if USE_AUTH #include "auth/UserRequest.h" #endif diff --git a/src/store.cc b/src/store.cc index fcbf2a8324..81b214793e 100644 --- a/src/store.cc +++ b/src/store.cc @@ -66,6 +66,7 @@ #include "StrList.h" #include "swap_log_op.h" #include "SwapDir.h" +#include "tools.h" #if USE_DELAY_POOLS #include "DelayPools.h" #endif diff --git a/src/store_dir.cc b/src/store_dir.cc index d7f876d01f..d437eea937 100644 --- a/src/store_dir.cc +++ b/src/store_dir.cc @@ -47,6 +47,7 @@ #include "StoreHashIndex.h" #include "SwapDir.h" #include "swap_log_op.h" +#include "tools.h" #if HAVE_STATVFS #if HAVE_SYS_STATVFS_H diff --git a/src/tests/stub_tools.cc b/src/tests/stub_tools.cc index 50f7292fd1..9202f4b5bd 100644 --- a/src/tests/stub_tools.cc +++ b/src/tests/stub_tools.cc @@ -1,6 +1,6 @@ #include "squid.h" -// tool functions still defined in protos.h - TODO extract -#include "protos.h" +// tool functions still defined in protos.h +#include "tools.h" #define STUB_API "tools.cc" #include "tests/STUB.h" diff --git a/src/tools.h b/src/tools.h index c143745928..7f3a944c84 100644 --- a/src/tools.h +++ b/src/tools.h @@ -33,7 +33,8 @@ #ifndef SQUID_TOOLS_H_ #define SQUID_TOOLS_H_ -/* for kb_t */ +#include "Packer.h" +#include "SquidString.h" #include "typedefs.h" class MemBuf; @@ -65,5 +66,29 @@ extern pid_t readPidFile(void); extern void keepCapabilities(void); extern void BroadcastSignalIfAny(int& sig); +/// whether the current process is the parent of all other Squid processes +extern bool IamMasterProcess(); +/** + * whether the current process is dedicated to doing things that only + * a single process should do, such as PID file maintenance and WCCP + */ +extern bool IamPrimaryProcess(); +/// whether the current process coordinates worker processes +extern bool IamCoordinatorProcess(); +/// whether the current process handles HTTP transactions and such +extern bool IamWorkerProcess(); +/// whether the current process is dedicated to managing a cache_dir +extern bool IamDiskProcess(); +/// Whether we are running in daemon mode +extern bool InDaemonMode(); // try using specific Iam*() checks above first +/// Whether there should be more than one worker process running +extern bool UsingSmp(); // try using specific Iam*() checks above first +/// number of Kid processes as defined in src/ipc/Kid.h +extern int NumberOfKids(); +/// a string describing this process roles such as worker or coordinator +extern String ProcessRoles(); + +extern void debug_trap(const char *); +extern void *xmemset(void *dst, int, size_t); #endif /* SQUID_TOOLS_H_ */ diff --git a/src/unlinkd.cc b/src/unlinkd.cc index c36a1655ea..022831150d 100644 --- a/src/unlinkd.cc +++ b/src/unlinkd.cc @@ -43,6 +43,7 @@ #include "SquidTime.h" #include "StatCounters.h" #include "SwapDir.h" +#include "tools.h" /* This code gets linked to Squid */