|
Squid Web Cache master
|
#include "squid.h"#include "base/File.h"#include "debug/Messages.h"#include "fs_io.h"#include "Instance.h"#include "md5.h"#include "parser/Tokenizer.h"#include "sbuf/Stream.h"#include "SquidConfig.h"#include "tools.h"#include <cerrno>Go to the source code of this file.
Functions | |
| static SBuf | PidFilenameCalc () |
| static SBuf | PidFileDescription (const SBuf &filename) |
| static SBuf | PidFilename () |
| static pid_t | GetOtherPid (File &pidFile) |
| static bool | ProcessIsRunning (const pid_t pid) |
| determines whether a given process is running at the time of the call | |
| static void | ThrowIfAlreadyRunningWith (File &pidFile) |
| quits if another Squid instance (that owns the given PID file) is running | |
| static void | RemoveInstance () |
| atexit() handler; removes the PID file created with Instance::WriteOurPid() | |
| static SBuf | PidFilenameHash () |
Variables | |
| static SBuf | TheFile |
| static SBuf | ThePidFileToRemove |
| ties Instance::WriteOurPid() scheduler and RemoveInstance(void) handler | |
|
static |
Definition at line 70 of file Instance.cc.
References CharacterSet::CR, debugs, CharacterSet::LF, File::readSmall(), TexcHere, TheFile, and ToSBuf().
Referenced by Instance::Other(), and ThrowIfAlreadyRunningWith().
Definition at line 53 of file Instance.cc.
References ToSBuf().
Referenced by PidFilename(), and RemoveInstance().
|
static |
Instance entry points are expected to call this first.
Definition at line 61 of file Instance.cc.
References PidFileDescription(), PidFilenameCalc(), and TheFile.
Referenced by Instance::Other(), Instance::ThrowIfAlreadyRunning(), and Instance::WriteOurPid().
|
static |
PidFilename() helper
Definition at line 31 of file Instance.cc.
References SBuf::append(), SquidConfig::chroot_dir, Chrooted, Config, debugs, and SquidConfig::pidFilename.
Referenced by PidFilename(), and PidFilenameHash().
|
static |
A hash that is likely to be unique across instances running on the same host because such concurrent instances should use unique PID filenames. All instances with disabled PID file maintenance have the same hash value.
Definition at line 231 of file Instance.cc.
References SBuf::appendf(), hash, PidFilenameCalc(), SQUID_MD5_DIGEST_LENGTH, SquidMD5Final(), SquidMD5Init(), and SquidMD5Update().
Referenced by Instance::NamePrefix().
|
static |
Definition at line 96 of file Instance.cc.
References debugs, pid, and xstrerr().
Referenced by ThrowIfAlreadyRunningWith().
|
static |
Definition at line 163 of file Instance.cc.
References SBuf::c_str(), SBuf::clear(), debugs, enter_suid(), Important, SBuf::isEmpty(), leave_suid(), PidFileDescription(), safeunlink(), Debug::StopCacheLogUse(), and ThePidFileToRemove.
Referenced by Instance::WriteOurPid().
|
static |
Definition at line 108 of file Instance.cc.
References debugs, GetOtherPid(), pid, ProcessIsRunning(), TexcHere, TheFile, and ToSBuf().
Referenced by Instance::ThrowIfAlreadyRunning(), and Instance::WriteOurPid().
|
static |
Describes the (last) instance PID file being processed. This hack shortens reporting code while keeping its messages consistent.
Definition at line 26 of file Instance.cc.
Referenced by GetOtherPid(), PidFilename(), Instance::ThrowIfAlreadyRunning(), ThrowIfAlreadyRunningWith(), and Instance::WriteOurPid().
|
static |
Definition at line 159 of file Instance.cc.
Referenced by RemoveInstance(), and Instance::WriteOurPid().