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 More... | |
FileOpeningConfig & | createdIfMissing () |
when opening a file for writing, create it if it does not exist More... | |
FileOpeningConfig & | openedByRoot () |
enter_suid() to open the file; leaves suid ASAP after that More... | |
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 More... | |
int | openFlags = 0 |
opening flags; 2nd open(2) parameter More... | |
mode_t | openMode = 0644 |
access mode; 3rd open(2) parameter More... | |
int | flockMode = LOCK_UN |
2nd flock(2) parameter More... | |
const unsigned int | retryGapUsec = 500000 |
pause before each lock retry More... | |
unsigned int | lockAttempts = 0 |
how many times to try locking More... | |
bool | openByRoot = false |
Friends | |
class | File |
Detailed Description
Member Function Documentation
◆ createdIfMissing()
FileOpeningConfig & FileOpeningConfig::createdIfMissing | ( | ) |
Definition at line 90 of file File.cc.
References creationMask, Must, and openFlags.
◆ locked()
FileOpeningConfig & FileOpeningConfig::locked | ( | unsigned int | attempts = 5 | ) |
Definition at line 82 of file File.cc.
References lockAttempts.
◆ openedByRoot()
|
inline |
Definition at line 34 of file File.h.
References openByRoot.
◆ ReadOnly()
|
static |
Definition at line 32 of file File.cc.
References flockMode, and openFlags.
Referenced by Instance::Other(), and Instance::ThrowIfAlreadyRunning().
◆ ReadWrite()
|
static |
Definition at line 57 of file File.cc.
References flockMode, and openFlags.
Referenced by Instance::WriteOurPid().
Friends And Related Function Documentation
◆ File
Member Data Documentation
◆ creationMask
|
private |
Definition at line 47 of file File.h.
Referenced by createdIfMissing(), and File::open().
◆ flockMode
|
private |
Definition at line 58 of file File.h.
Referenced by File::lockOnce(), ReadOnly(), and ReadWrite().
◆ lockAttempts
|
private |
Definition at line 61 of file File.h.
Referenced by File::lock(), and locked().
◆ openByRoot
|
private |
Definition at line 62 of file File.h.
Referenced by openedByRoot().
◆ openFlags
|
private |
Definition at line 48 of file File.h.
Referenced by createdIfMissing(), File::open(), ReadOnly(), and ReadWrite().
◆ openMode
|
private |
Definition at line 49 of file File.h.
Referenced by File::open().
◆ retryGapUsec
|
private |
Definition at line 60 of file File.h.
Referenced by File::lock().
The documentation for this class was generated from the following files: