|
Squid Web Cache master
|
How should a file be opened/created? Should it be locked? More...
#include <File.h>
Public Member Functions | |
| FileOpeningConfig & | locked (unsigned int attempts=5) |
| protect concurrent accesses by attempting to obtain an appropriate lock | |
| FileOpeningConfig & | createdIfMissing () |
| when opening a file for writing, create it if it does not exist | |
| FileOpeningConfig & | openedByRoot () |
| enter_suid() to open the file; leaves suid ASAP after that | |
Static Public Member Functions | |
| static FileOpeningConfig | ReadOnly () |
| static FileOpeningConfig | ReadWrite () |
Private Attributes | |
| mode_t | creationMask = 0 |
| umask() parameter; the default is S_IWGRP|S_IWOTH | |
| int | openFlags = 0 |
| opening flags; 2nd open(2) parameter | |
| mode_t | openMode = 0644 |
| access mode; 3rd open(2) parameter | |
| int | flockMode = LOCK_UN |
| 2nd flock(2) parameter | |
| const unsigned int | retryGapUsec = 500000 |
| pause before each lock retry | |
| unsigned int | lockAttempts = 0 |
| how many times to try locking | |
| bool | openByRoot = false |
Friends | |
| class | File |
| FileOpeningConfig & FileOpeningConfig::createdIfMissing | ( | ) |
Definition at line 89 of file File.cc.
References creationMask, Must, and openFlags.
| FileOpeningConfig & FileOpeningConfig::locked | ( | unsigned int | attempts = 5 | ) |
Definition at line 81 of file File.cc.
References lockAttempts.
|
inline |
Definition at line 34 of file File.h.
References openByRoot.
|
static |
Definition at line 31 of file File.cc.
References flockMode, and openFlags.
Referenced by Instance::Other(), and Instance::ThrowIfAlreadyRunning().
|
static |
Definition at line 56 of file File.cc.
References flockMode, and openFlags.
Referenced by Instance::WriteOurPid().
|
private |
Definition at line 47 of file File.h.
Referenced by createdIfMissing(), and File::open().
|
private |
Definition at line 58 of file File.h.
Referenced by File::lockOnce(), ReadOnly(), and ReadWrite().
|
private |
Definition at line 61 of file File.h.
Referenced by File::lock(), and locked().
|
private |
Definition at line 62 of file File.h.
Referenced by openedByRoot().
|
private |
Definition at line 48 of file File.h.
Referenced by createdIfMissing(), File::open(), ReadOnly(), and ReadWrite().
|
private |
Definition at line 49 of file File.h.
Referenced by File::open().
|
private |
Definition at line 60 of file File.h.
Referenced by File::lock().