LArSoft
v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
|
#include <sqlite3.h>
#include "TFile.h"
#include "TKey.h"
#include <cassert>
#include <cerrno>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <dlfcn.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <time.h>
#include <unistd.h>
Go to the source code of this file.
Classes | |
struct | unixFile |
struct | unix_syscall |
class | RootFileSentry |
Macros | |
#define | SQLITE_OPEN_WAL 0x00080000 /* VFS only */ |
#define | SQLITE_FCNTL_SIZE_HINT 5 |
#define | SQLITE_FCNTL_CHUNK_SIZE 6 |
#define | SQLITE_FCNTL_SYNC_OMITTED 8 |
#define | SQLITE_FCNTL_DB_UNCHANGED 0xca093fa0 |
#define | SQLITE_DEFAULT_SECTOR_SIZE 512 |
#define | UNUSED_PARAMETER(x) (void)(x) |
#define | UNUSED_PARAMETER2(x, y) UNUSED_PARAMETER(x), UNUSED_PARAMETER(y) |
#define | ArraySize(X) ((int)(sizeof(X) / sizeof(X[0]))) |
#define | _LARGE_FILE 1 |
#define | _FILE_OFFSET_BITS 64 |
#define | _LARGEFILE_SOURCE 1 |
#define | TKEYVFS_TRACE 0 |
#define | MEMPAGE 2048 |
#define | MAX_PATHNAME 512 |
#define | SQLITE_TEMP_FILE_PREFIX "etilqs_" |
#define | O_LARGEFILE 0 |
#define | O_NOFOLLOW 0 |
#define | O_BINARY 0 |
#define | SQLITE_CANTOPEN_BKPT sqlite3CantopenError(__LINE__) |
#define | osOpen ((int (*)(const char*, int, ...))aSyscall[0].pCurrent) |
#define | osClose ((int (*)(int))aSyscall[1].pCurrent) |
#define | osAccess ((int (*)(const char*, int))aSyscall[2].pCurrent) |
#define | osGetcwd ((char* (*)(char*, size_t))aSyscall[3].pCurrent) |
#define | osStat ((int (*)(const char*, struct stat*))aSyscall[4].pCurrent) |
#define | osFstat ((int (*)(int, struct stat*))aSyscall[5].pCurrent) |
#define | osFtruncate ((int (*)(int, off_t))aSyscall[6].pCurrent) |
#define | osFcntl ((int (*)(int, int, ...))aSyscall[7].pCurrent) |
#define | osRead ((ssize_t(*)(int, void*, size_t))aSyscall[8].pCurrent) |
#define | osPread ((ssize_t(*)(int, void*, size_t, off_t))aSyscall[9].pCurrent) |
#define | osPread64 ((ssize_t(*)(int, void*, size_t, off_t))aSyscall[10].pCurrent) |
#define | osWrite ((ssize_t(*)(int, const void*, size_t))aSyscall[11].pCurrent) |
#define | osPwrite ((ssize_t(*)(int, const void*, size_t, off_t))aSyscall[12].pCurrent) |
#define | osPwrite64 ((ssize_t(*)(int, const void*, size_t, off_t))aSyscall[13].pCurrent) |
#define | osFchmod ((int (*)(int, mode_t))aSyscall[14].pCurrent) |
#define | osFallocate ((int (*)(int, off_t, off_t))aSyscall[15].pCurrent) |
#define | unixLogError(a, b, c) unixLogErrorAtLine(a, b, c, __LINE__) |
#define | UNIXVFS(VFSNAME, FINDER) |
Typedefs | |
typedef sqlite_int64 | i64 |
typedef struct unixFile | unixFile |
typedef const sqlite3_io_methods *(* | finder_type) (const char *, unixFile *) |
Functions | |
static int | sqlite3CantopenError (int lineno) |
static int | sqlite3Strlen30 (const char *z) |
static const sqlite3_io_methods * | nolockIoFinderImpl (const char *z, unixFile *p) |
static int | unixLogErrorAtLine (int errcode, const char *zFunc, const char *zPath, int iLine) |
static int | robust_open (const char *z, int f, int m) |
static void | robust_close (unixFile *pFile, int h, int lineno) |
static int | unixGetTempname (int nBuf, char *zBuf) |
static int | fcntlSizeHint (unixFile *pFile, i64 nByte) |
static int | seekAndRead (unixFile *id, sqlite3_int64 offset, void *pBuf, int cnt) |
static int | seekAndWrite (unixFile *id, i64 offset, const void *pBuf, int cnt) |
static int | nolockClose (sqlite3_file *id) |
static int | unixRead (sqlite3_file *id, void *pBuf, int amt, sqlite3_int64 offset) |
static int | unixWrite (sqlite3_file *id, const void *pBuf, int amt, sqlite3_int64 offset) |
static int | unixTruncate (sqlite3_file *id, i64 nByte) |
static int | unixSync (sqlite3_file *id, int flags) |
static int | unixFileSize (sqlite3_file *id, i64 *pSize) |
static int | nolockLock (sqlite3_file *NotUsed, int NotUsed2) |
static int | nolockUnlock (sqlite3_file *NotUsed, int NotUsed2) |
static int | nolockCheckReservedLock (sqlite3_file *NotUsed, int *pResOut) |
static int | unixFileControl (sqlite3_file *id, int op, void *pArg) |
static int | unixSectorSize (sqlite3_file *NotUsed) |
static int | unixDeviceCharacteristics (sqlite3_file *NotUsed) |
static int | unixOpen (sqlite3_vfs *pVfs, const char *zPath, sqlite3_file *pFile, int flags, int *pOutFlags) |
static int | unixDelete (sqlite3_vfs *NotUsed, const char *zPath, int dirSync) |
static int | unixAccess (sqlite3_vfs *NotUsed, const char *zPath, int flags, int *pResOut) |
static int | unixFullPathname (sqlite3_vfs *pVfs, const char *zPath, int nOut, char *zOut) |
static void * | unixDlOpen (sqlite3_vfs *NotUsed, const char *zFilename) |
static void | unixDlError (sqlite3_vfs *NotUsed, int nBuf, char *zBufOut) |
static void | unixDlClose (sqlite3_vfs *NotUsed, void *pHandle) |
static int | unixRandomness (sqlite3_vfs *NotUsed, int nBuf, char *zBuf) |
static int | unixSleep (sqlite3_vfs *NotUsed, int microseconds) |
static int | unixCurrentTime (sqlite3_vfs *NotUsed, double *prNow) |
static int | unixGetLastError (sqlite3_vfs *NotUsed, int NotUsed2, char *NotUsed3) |
static int | unixCurrentTimeInt64 (sqlite3_vfs *NotUsed, sqlite3_int64 *piNow) |
static int | unixSetSystemCall (sqlite3_vfs *pNotUsed, const char *zName, sqlite3_syscall_ptr pNewFunc) |
static sqlite3_syscall_ptr | unixGetSystemCall (sqlite3_vfs *pNotUsed, const char *zName) |
static const char * | unixNextSystemCall (sqlite3_vfs *p, const char *zName) |
static int | closeUnixFile (sqlite3_file *id) |
int | tkeyvfs_init (void) |
int | tkeyvfs_open_v2 (const char *filename, sqlite3 **ppDb, int flags, TFile *rootFile ) |
Variables | |
static TFile * | gRootFile |
static void(*)(void) | unixDlSym (sqlite3_vfs *NotUsed, void *p, const char *zSym) |
static struct unix_syscall | aSyscall [] |
static const sqlite3_io_methods | nolockIoMethods |
static const sqlite3_io_methods *(*const | nolockIoFinder )(const char *, unixFile *p) |
#define _FILE_OFFSET_BITS 64 |
Definition at line 37 of file tkeyvfs.cc.
#define _LARGE_FILE 1 |
Definition at line 36 of file tkeyvfs.cc.
#define _LARGEFILE_SOURCE 1 |
Definition at line 38 of file tkeyvfs.cc.
Definition at line 32 of file tkeyvfs.cc.
Referenced by tkeyvfs_init(), and unixNextSystemCall().
#define MAX_PATHNAME 512 |
Definition at line 88 of file tkeyvfs.cc.
Referenced by unixFullPathname(), and unixOpen().
#define MEMPAGE 2048 |
Definition at line 83 of file tkeyvfs.cc.
Referenced by fcntlSizeHint(), seekAndWrite(), unixOpen(), and unixTruncate().
#define O_BINARY 0 |
Definition at line 137 of file tkeyvfs.cc.
#define O_LARGEFILE 0 |
Definition at line 127 of file tkeyvfs.cc.
#define O_NOFOLLOW 0 |
Definition at line 134 of file tkeyvfs.cc.
#define osAccess ((int (*)(const char*, int))aSyscall[2].pCurrent) |
#define osClose ((int (*)(int))aSyscall[1].pCurrent) |
Referenced by robust_close().
#define osFallocate ((int (*)(int, off_t, off_t))aSyscall[15].pCurrent) |
#define osFchmod ((int (*)(int, mode_t))aSyscall[14].pCurrent) |
#define osFcntl ((int (*)(int, int, ...))aSyscall[7].pCurrent) |
#define osFstat ((int (*)(int, struct stat*))aSyscall[5].pCurrent) |
#define osFtruncate ((int (*)(int, off_t))aSyscall[6].pCurrent) |
#define osGetcwd ((char* (*)(char*, size_t))aSyscall[3].pCurrent) |
#define osOpen ((int (*)(const char*, int, ...))aSyscall[0].pCurrent) |
Referenced by robust_open().
#define osPread ((ssize_t(*)(int, void*, size_t, off_t))aSyscall[9].pCurrent) |
#define osPread64 ((ssize_t(*)(int, void*, size_t, off_t))aSyscall[10].pCurrent) |
#define osPwrite ((ssize_t(*)(int, const void*, size_t, off_t))aSyscall[12].pCurrent) |
#define osPwrite64 ((ssize_t(*)(int, const void*, size_t, off_t))aSyscall[13].pCurrent) |
#define osRead ((ssize_t(*)(int, void*, size_t))aSyscall[8].pCurrent) |
Referenced by unixRandomness().
#define osStat ((int (*)(const char*, struct stat*))aSyscall[4].pCurrent) |
#define osWrite ((ssize_t(*)(int, const void*, size_t))aSyscall[11].pCurrent) |
#define SQLITE_CANTOPEN_BKPT sqlite3CantopenError(__LINE__) |
Definition at line 217 of file tkeyvfs.cc.
Referenced by unixOpen().
#define SQLITE_DEFAULT_SECTOR_SIZE 512 |
Definition at line 27 of file tkeyvfs.cc.
Referenced by unixSectorSize().
#define SQLITE_FCNTL_CHUNK_SIZE 6 |
Definition at line 23 of file tkeyvfs.cc.
Referenced by unixFileControl().
#define SQLITE_FCNTL_DB_UNCHANGED 0xca093fa0 |
Definition at line 26 of file tkeyvfs.cc.
Referenced by unixFileControl().
#define SQLITE_FCNTL_SIZE_HINT 5 |
Definition at line 22 of file tkeyvfs.cc.
Referenced by unixFileControl().
#define SQLITE_FCNTL_SYNC_OMITTED 8 |
Definition at line 24 of file tkeyvfs.cc.
Referenced by unixFileControl().
#define SQLITE_OPEN_WAL 0x00080000 /* VFS only */ |
Definition at line 21 of file tkeyvfs.cc.
#define SQLITE_TEMP_FILE_PREFIX "etilqs_" |
Definition at line 90 of file tkeyvfs.cc.
Referenced by unixGetTempname().
#define TKEYVFS_TRACE 0 |
Definition at line 69 of file tkeyvfs.cc.
#define unixLogError | ( | a, | |
b, | |||
c | |||
) | unixLogErrorAtLine(a, b, c, __LINE__) |
Definition at line 386 of file tkeyvfs.cc.
Referenced by unixOpen(), and unixTruncate().
#define UNIXVFS | ( | VFSNAME, | |
FINDER | |||
) |
Referenced by tkeyvfs_init().
Definition at line 29 of file tkeyvfs.cc.
Referenced by nolockIoFinderImpl(), nolockLock(), nolockUnlock(), unixAccess(), unixCurrentTime(), unixCurrentTimeInt64(), unixDelete(), unixDeviceCharacteristics(), unixDlClose(), unixDlError(), unixDlOpen(), unixFullPathname(), unixGetLastError(), unixGetSystemCall(), unixNextSystemCall(), unixRandomness(), unixSectorSize(), unixSetSystemCall(), and unixSleep().
#define UNUSED_PARAMETER2 | ( | x, | |
y | |||
) | UNUSED_PARAMETER(x), UNUSED_PARAMETER(y) |
Definition at line 30 of file tkeyvfs.cc.
Referenced by unixSync().
typedef const sqlite3_io_methods*(* finder_type) (const char *, unixFile *) |
Definition at line 368 of file tkeyvfs.cc.
typedef sqlite_int64 i64 |
Definition at line 34 of file tkeyvfs.cc.
Definition at line 120 of file tkeyvfs.cc.
|
static |
Definition at line 473 of file tkeyvfs.cc.
References unixFile::fileSize, unixFile::pBuf, unixFile::rootFile, unixFile::saveToRootFile, and unixFile::zPath.
Referenced by nolockClose().
Definition at line 590 of file tkeyvfs.cc.
References unixFile::bufAllocated, unixFile::fileSize, MEMPAGE, unixFile::pBuf, and unixFile::szChunk.
Referenced by unixFileControl().
|
static |
|
static |
|
static |
|
static |
Definition at line 964 of file tkeyvfs.cc.
References UNUSED_PARAMETER, and unixFile::zPath.
|
static |
Definition at line 981 of file tkeyvfs.cc.
References UNUSED_PARAMETER, and unixFile::zPath.
|
static |
Definition at line 443 of file tkeyvfs.cc.
References osClose, unixLogErrorAtLine(), and unixFile::zPath.
Referenced by unixRandomness().
|
static |
Definition at line 414 of file tkeyvfs.cc.
References osOpen.
Referenced by unixRandomness().
|
static |
Definition at line 642 of file tkeyvfs.cc.
References unixFile::fileSize.
Referenced by unixRead(), and unixWrite().
Definition at line 673 of file tkeyvfs.cc.
References unixFile::bufAllocated, unixFile::fileSize, MEMPAGE, and unixFile::szChunk.
Referenced by unixWrite().
|
static |
Definition at line 209 of file tkeyvfs.cc.
|
static |
int tkeyvfs_init | ( | void | ) |
Definition at line 1768 of file tkeyvfs.cc.
References ArraySize, aSyscall, nolockIoFinder, and UNIXVFS.
Referenced by art::completeRootHandlers(), and main().
int tkeyvfs_open_v2 | ( | const char * | filename, |
sqlite3 ** | ppDb, | ||
int | flags, | ||
TFile * | rootFile | ||
) |
Definition at line 1837 of file tkeyvfs.cc.
References unixFile::rootFile.
Referenced by art::SQLite3Wrapper::initDB(), and art::TKeyVFSOpenPolicy::open().
|
static |
|
static |
Definition at line 1570 of file tkeyvfs.cc.
References unixCurrentTimeInt64(), and UNUSED_PARAMETER.
|
static |
Definition at line 1615 of file tkeyvfs.cc.
References UNUSED_PARAMETER.
Referenced by unixCurrentTime().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 1018 of file tkeyvfs.cc.
References unixFile::eFileLock, fcntlSizeHint(), unixFile::lastErrno, SQLITE_FCNTL_CHUNK_SIZE, SQLITE_FCNTL_DB_UNCHANGED, SQLITE_FCNTL_SIZE_HINT, SQLITE_FCNTL_SYNC_OMITTED, and unixFile::zPath.
|
static |
Definition at line 938 of file tkeyvfs.cc.
References unixFile::fileSize, and unixFile::zPath.
|
static |
|
static |
|
static |
Definition at line 1690 of file tkeyvfs.cc.
References aSyscall, unix_syscall::pCurrent, and UNUSED_PARAMETER.
|
static |
Definition at line 549 of file tkeyvfs.cc.
References SQLITE_TEMP_FILE_PREFIX.
Referenced by unixOpen().
|
static |
|
static |
Definition at line 1719 of file tkeyvfs.cc.
References ArraySize, aSyscall, UNUSED_PARAMETER, and unix_syscall::zName.
|
static |
Definition at line 1171 of file tkeyvfs.cc.
References unixFile::bufAllocated, unixFile::fileSize, gRootFile, unixFile::lastErrno, MAX_PATHNAME, MEMPAGE, nolockIoMethods, unixFile::pBuf, unixFile::pMethod, unixFile::rootFile, unixFile::saveToRootFile, SQLITE_CANTOPEN_BKPT, unixGetTempname(), unixLogError, and unixFile::zPath.
|
static |
Definition at line 1498 of file tkeyvfs.cc.
References osRead, robust_close(), robust_open(), and UNUSED_PARAMETER.
|
static |
Definition at line 737 of file tkeyvfs.cc.
References unixFile::lastErrno, seekAndRead(), and unixFile::zPath.
|
static |
Definition at line 1117 of file tkeyvfs.cc.
References SQLITE_DEFAULT_SECTOR_SIZE, and UNUSED_PARAMETER.
|
static |
Definition at line 1638 of file tkeyvfs.cc.
References aSyscall, unix_syscall::pCurrent, unix_syscall::pDefault, and UNUSED_PARAMETER.
|
static |
|
static |
Definition at line 919 of file tkeyvfs.cc.
References UNUSED_PARAMETER2, and unixFile::zPath.
|
static |
Definition at line 837 of file tkeyvfs.cc.
References unixFile::bufAllocated, unixFile::fileSize, unixFile::inNormalWrite, unixFile::lastErrno, MEMPAGE, unixFile::pBuf, unixFile::szChunk, unixFile::transCntrChng, unixLogError, and unixFile::zPath.
|
static |
Definition at line 778 of file tkeyvfs.cc.
References unixFile::dbUpdate, unixFile::inNormalWrite, unixFile::lastErrno, seekAndRead(), seekAndWrite(), unixFile::transCntrChng, and unixFile::zPath.
|
static |
Referenced by tkeyvfs_init(), unixGetSystemCall(), unixNextSystemCall(), and unixSetSystemCall().
|
static |
Definition at line 76 of file tkeyvfs.cc.
Referenced by RootFileSentry::RootFileSentry(), unixOpen(), and RootFileSentry::~RootFileSentry().
|
static |
Definition at line 364 of file tkeyvfs.cc.
Referenced by tkeyvfs_init().
|
static |
Definition at line 334 of file tkeyvfs.cc.
Referenced by nolockIoFinderImpl(), and unixOpen().
|
static |
Definition at line 194 of file tkeyvfs.cc.
Referenced by unixDlError().