|
Squid Web Cache master
|
code related to Squid Instance and PID file management
Functions | |
| void | ThrowIfAlreadyRunning () |
| void | WriteOurPid () |
| creates a PID file; throws on error | |
| pid_t | Other () |
| SBuf | NamePrefix (const char *head, const char *tail=nullptr) |
| SBuf Instance::NamePrefix | ( | const char * | head, |
| const char * | tail = nullptr |
||
| ) |
A service_name-derived string that is likely to be unique across all Squid instances concurrently running on the same host (as long as they do not disable PID file maintenance).
| head | is used at the beginning of the generated name |
| tail | is used at the end of the generated name (when not nil) |
Definition at line 253 of file Instance.cc.
References SBuf::append(), head, PidFilenameHash(), and service_name.
Referenced by Ipc::Port::CoordinatorAddr(), and Ipc::Port::MakeAddr().
| pid_t Instance::Other | ( | ) |
Definition at line 129 of file Instance.cc.
References GetOtherPid(), PidFilename(), FileOpeningConfig::ReadOnly(), and TexcHere.
Referenced by sendSignal().
| void Instance::ThrowIfAlreadyRunning | ( | ) |
Usually throws if another Squid instance is running. False positives are highly unlikely, but the caller must tolerate false negatives well: We may not detect another running instance and, hence, may not throw. Does nothing if PID file maintenance is disabled.
Definition at line 140 of file Instance.cc.
References debugs, File::Optional(), PidFilename(), FileOpeningConfig::ReadOnly(), TheFile, and ThrowIfAlreadyRunningWith().
Referenced by SquidMain().
| void Instance::WriteOurPid | ( | ) |
Creates or updates the PID file for the current process. Does nothing if PID file maintenance is disabled.
Definition at line 187 of file Instance.cc.
References debugs, Important, Must, PidFilename(), SBuf::Printf(), FileOpeningConfig::ReadWrite(), RemoveInstance(), File::synchronize(), TheFile, ThePidFileToRemove, ThrowIfAlreadyRunningWith(), File::truncate(), and File::writeAll().
Referenced by SquidMain(), and watch_child().