Go to the source code of this file.
Classes | |
struct | unixFile |
struct | lockKey |
struct | lockInfo |
struct | openKey |
struct | openCnt |
Defines | |
#define | SQLITE_ENABLE_LOCKING_STYLE 0 |
#define | _LARGE_FILE 1 |
#define | _FILE_OFFSET_BITS 64 |
#define | _LARGEFILE_SOURCE 1 |
#define | MAX_PATHNAME 512 |
#define | threadid 0 |
#define | SET_THREADID(X) |
#define | CHECK_THREADID(X) 0 |
#define | LOCKING_STYLE_POSIX 1 |
#define | LOCKING_STYLE_NONE 2 |
#define | LOCKING_STYLE_DOTFILE 3 |
#define | LOCKING_STYLE_FLOCK 4 |
#define | LOCKING_STYLE_AFP 5 |
#define | IS_LOCK_ERROR(x) ((x != SQLITE_OK) && (x != SQLITE_BUSY)) |
#define | transferOwnership(X) SQLITE_OK |
#define | fdatasync fsync |
#define | HAVE_FULLFSYNC 0 |
#define | IOMETHODS(xClose, xLock, xUnlock, xCheckReservedLock) |
#define | UNIXVFS(zVfsName, pVfsAppData) |
Typedefs | |
typedef struct unixFile | unixFile |
typedef void | nolockLockingContext |
Functions | |
static void | enterMutex (void) |
static void | leaveMutex (void) |
static void | releaseLockInfo (struct lockInfo *pLock) |
static void | releaseOpenCnt (struct openCnt *pOpen) |
static int | detectLockingStyle (sqlite3_vfs *pVfs, const char *filePath, int fd) |
static int | findLockInfo (int fd, struct lockInfo **ppLock, struct openCnt **ppOpen) |
static int | seekAndRead (unixFile *id, sqlite3_int64 offset, void *pBuf, int cnt) |
static int | unixRead (sqlite3_file *id, void *pBuf, int amt, sqlite3_int64 offset) |
static int | seekAndWrite (unixFile *id, i64 offset, const void *pBuf, int cnt) |
static int | unixWrite (sqlite3_file *id, const void *pBuf, int amt, sqlite3_int64 offset) |
static int | full_fsync (int fd, int fullSync, int dataOnly) |
static int | unixSync (sqlite3_file *id, int flags) |
static int | unixTruncate (sqlite3_file *id, i64 nByte) |
static int | unixFileSize (sqlite3_file *id, i64 *pSize) |
static int | sqliteErrorFromPosixError (int posixError, int sqliteIOErr) |
static int | unixCheckReservedLock (sqlite3_file *id, int *pResOut) |
static int | unixLock (sqlite3_file *id, int locktype) |
static int | unixUnlock (sqlite3_file *id, int locktype) |
static int | closeUnixFile (sqlite3_file *id) |
static int | unixClose (sqlite3_file *id) |
static int | nolockCheckReservedLock (sqlite3_file *id, int *pResOut) |
static int | nolockLock (sqlite3_file *id, int locktype) |
static int | nolockUnlock (sqlite3_file *id, int locktype) |
static int | nolockClose (sqlite3_file *id) |
static int | unixFileControl (sqlite3_file *id, int op, void *pArg) |
static int | unixSectorSize (sqlite3_file *id) |
static int | unixDeviceCharacteristics (sqlite3_file *id) |
static int | fillInUnixFile (sqlite3_vfs *pVfs, int h, int dirfd, sqlite3_file *pId, const char *zFilename, int noLock) |
static int | openDirectory (const char *zFilename, int *pFd) |
static int | getTempname (int nBuf, char *zBuf) |
static int | unixOpen (sqlite3_vfs *pVfs, const char *zPath, sqlite3_file *pFile, int flags, int *pOutFlags) |
static int | unixDelete (sqlite3_vfs *pVfs, const char *zPath, int dirSync) |
static int | unixAccess (sqlite3_vfs *pVfs, 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 *pVfs, const char *zFilename) |
static void | unixDlError (sqlite3_vfs *pVfs, int nBuf, char *zBufOut) |
static void * | unixDlSym (sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol) |
static void | unixDlClose (sqlite3_vfs *pVfs, void *pHandle) |
static int | unixRandomness (sqlite3_vfs *pVfs, int nBuf, char *zBuf) |
static int | unixSleep (sqlite3_vfs *pVfs, int microseconds) |
static int | unixCurrentTime (sqlite3_vfs *pVfs, double *prNow) |
static int | unixGetLastError (sqlite3_vfs *pVfs, int nBuf, char *zBuf) |
int | sqlite3_os_init (void) |
int | sqlite3_os_end (void) |
Variables | |
static struct lockInfo * | lockList = 0 |
static struct openCnt * | openList = 0 |
#define CHECK_THREADID | ( | X | ) | 0 |
Definition at line 192 of file os_unix.c.
Referenced by unixUnlock().
#define IOMETHODS | ( | xClose, | |||
xLock, | |||||
xUnlock, | |||||
xCheckReservedLock | ) |
{ \ 1, /* iVersion */ \ xClose, /* xClose */ \ unixRead, /* xRead */ \ unixWrite, /* xWrite */ \ unixTruncate, /* xTruncate */ \ unixSync, /* xSync */ \ unixFileSize, /* xFileSize */ \ xLock, /* xLock */ \ xUnlock, /* xUnlock */ \ xCheckReservedLock, /* xCheckReservedLock */ \ unixFileControl, /* xFileControl */ \ unixSectorSize, /* xSectorSize */ \ unixDeviceCharacteristics /* xDeviceCapabilities */ \ }
#define IS_LOCK_ERROR | ( | x | ) | ((x != SQLITE_OK) && (x != SQLITE_BUSY)) |
Definition at line 387 of file os_unix.c.
Referenced by unixLock(), and unixUnlock().
#define LOCKING_STYLE_AFP 5 |
Definition at line 381 of file os_unix.c.
Referenced by detectLockingStyle(), fillInUnixFile(), and sqlite3_os_init().
#define LOCKING_STYLE_DOTFILE 3 |
Definition at line 379 of file os_unix.c.
Referenced by detectLockingStyle(), fillInUnixFile(), and sqlite3_os_init().
#define LOCKING_STYLE_FLOCK 4 |
Definition at line 380 of file os_unix.c.
Referenced by detectLockingStyle(), fillInUnixFile(), and sqlite3_os_init().
#define LOCKING_STYLE_NONE 2 |
Definition at line 378 of file os_unix.c.
Referenced by detectLockingStyle(), fillInUnixFile(), and sqlite3_os_init().
#define LOCKING_STYLE_POSIX 1 |
Definition at line 377 of file os_unix.c.
Referenced by detectLockingStyle(), fillInUnixFile(), and sqlite3_os_init().
#define SET_THREADID | ( | X | ) |
Definition at line 191 of file os_unix.c.
Referenced by fillInUnixFile().
#define transferOwnership | ( | X | ) | SQLITE_OK |
Definition at line 861 of file os_unix.c.
Referenced by unixLock().
#define UNIXVFS | ( | zVfsName, | |||
pVfsAppData | ) |
{ \ 1, /* iVersion */ \ sizeof(unixFile), /* szOsFile */ \ MAX_PATHNAME, /* mxPathname */ \ 0, /* pNext */ \ zVfsName, /* zName */ \ (void *)pVfsAppData, /* pAppData */ \ unixOpen, /* xOpen */ \ unixDelete, /* xDelete */ \ unixAccess, /* xAccess */ \ unixFullPathname, /* xFullPathname */ \ unixDlOpen, /* xDlOpen */ \ unixDlError, /* xDlError */ \ unixDlSym, /* xDlSym */ \ unixDlClose, /* xDlClose */ \ unixRandomness, /* xRandomness */ \ unixSleep, /* xSleep */ \ unixCurrentTime, /* xCurrentTime */ \ unixGetLastError /* xGetLastError */ \ }
typedef void nolockLockingContext |
static int closeUnixFile | ( | sqlite3_file * | id | ) | [static] |
Definition at line 1640 of file os_unix.c.
References unixFile::dirfd, unixFile::h, OpenCounter, OSTRACE2, and SQLITE_OK.
Referenced by nolockClose(), and unixClose().
static int detectLockingStyle | ( | sqlite3_vfs * | pVfs, | |
const char * | filePath, | |||
int | fd | |||
) | [static] |
Definition at line 638 of file os_unix.c.
References LOCKING_STYLE_AFP, LOCKING_STYLE_DOTFILE, LOCKING_STYLE_FLOCK, LOCKING_STYLE_NONE, LOCKING_STYLE_POSIX, sqlite3_vfs::pAppData, and SQLITE_PTR_TO_INT.
Referenced by fillInUnixFile().
static void enterMutex | ( | void | ) | [static] |
Definition at line 392 of file os_unix.c.
References sqlite3_mutex_enter, sqlite3MutexAlloc, and SQLITE_MUTEX_STATIC_MASTER.
Referenced by fillInUnixFile(), unixCheckReservedLock(), unixClose(), unixDlError(), unixLock(), and unixUnlock().
static int fillInUnixFile | ( | sqlite3_vfs * | pVfs, | |
int | h, | |||
int | dirfd, | |||
sqlite3_file * | pId, | |||
const char * | zFilename, | |||
int | noLock | |||
) | [static] |
Definition at line 2346 of file os_unix.c.
References detectLockingStyle(), unixFile::dirfd, enterMutex(), findLockInfo(), unixFile::h, IOMETHODS, unixFile::lastErrno, leaveMutex(), LOCKING_STYLE_AFP, LOCKING_STYLE_DOTFILE, LOCKING_STYLE_FLOCK, LOCKING_STYLE_NONE, LOCKING_STYLE_POSIX, nolockCheckReservedLock(), nolockClose(), nolockLock(), nolockUnlock(), OpenCounter, OSTRACE3, unixFile::pLock, unixFile::pMethod, unixFile::pOpen, SET_THREADID, sqlite3_malloc(), sqlite3_snprintf(), SQLITE_NOMEM, SQLITE_OK, unixCheckReservedLock(), unixClose(), unixLock(), and unixUnlock().
Referenced by unixOpen().
Definition at line 694 of file os_unix.c.
References openCnt::aPending, lockInfo::cnt, openKey::dev, lockKey::dev, openKey::ino, lockKey::ino, openCnt::key, lockInfo::key, lockInfo::locktype, openCnt::nLock, openCnt::nPending, openCnt::nRef, lockInfo::nRef, openCnt::pNext, lockInfo::pNext, openCnt::pPrev, lockInfo::pPrev, releaseLockInfo(), sqlite3_malloc(), SQLITE_IOERR, SQLITE_NOLFS, and SQLITE_NOMEM.
Referenced by fillInUnixFile().
static int full_fsync | ( | int | fd, | |
int | fullSync, | |||
int | dataOnly | |||
) | [static] |
Definition at line 1017 of file os_unix.c.
References fdatasync, and SQLITE_OK.
Referenced by unixSync().
static int getTempname | ( | int | nBuf, | |
char * | zBuf | |||
) | [static] |
Definition at line 2508 of file os_unix.c.
References SimulateIOError, sqlite3_randomness(), sqlite3_snprintf(), sqlite3_temp_directory, SQLITE_ERROR, SQLITE_IOERR, SQLITE_OK, and SQLITE_TEMP_FILE_PREFIX.
Referenced by unixOpen().
static void leaveMutex | ( | void | ) | [static] |
Definition at line 395 of file os_unix.c.
References sqlite3_mutex_leave, sqlite3MutexAlloc, and SQLITE_MUTEX_STATIC_MASTER.
Referenced by fillInUnixFile(), unixCheckReservedLock(), unixClose(), unixDlError(), unixLock(), and unixUnlock().
static int nolockCheckReservedLock | ( | sqlite3_file * | id, | |
int * | pResOut | |||
) | [static] |
static int nolockClose | ( | sqlite3_file * | id | ) | [static] |
Definition at line 2299 of file os_unix.c.
References closeUnixFile().
Referenced by fillInUnixFile().
static int nolockLock | ( | sqlite3_file * | id, | |
int | locktype | |||
) | [static] |
static int nolockUnlock | ( | sqlite3_file * | id, | |
int | locktype | |||
) | [static] |
static int openDirectory | ( | const char * | zFilename, | |
int * | pFd | |||
) | [static] |
Definition at line 2482 of file os_unix.c.
References MAX_PATHNAME, O_BINARY, OSTRACE3, sqlite3_snprintf(), SQLITE_CANTOPEN, and SQLITE_OK.
Referenced by unixDelete(), and unixOpen().
static void releaseLockInfo | ( | struct lockInfo * | pLock | ) | [static] |
Definition at line 557 of file os_unix.c.
References lockInfo::nRef, lockInfo::pNext, lockInfo::pPrev, and sqlite3_free().
Referenced by findLockInfo(), and unixClose().
static void releaseOpenCnt | ( | struct openCnt * | pOpen | ) | [static] |
Definition at line 580 of file os_unix.c.
References openCnt::aPending, openCnt::nRef, openCnt::pNext, openCnt::pPrev, and sqlite3_free().
Referenced by unixClose().
static int seekAndRead | ( | unixFile * | id, | |
sqlite3_int64 | offset, | |||
void * | pBuf, | |||
int | cnt | |||
) | [static] |
Definition at line 874 of file os_unix.c.
References unixFile::h, OSTRACE5, SimulateIOError, TIMER_ELAPSED, TIMER_END, and TIMER_START.
Referenced by unixRead().
Definition at line 926 of file os_unix.c.
References unixFile::h, OSTRACE5, TIMER_ELAPSED, TIMER_END, and TIMER_START.
Referenced by unixWrite().
int sqlite3_os_init | ( | void | ) |
Definition at line 2956 of file os_unix.c.
References LOCKING_STYLE_AFP, LOCKING_STYLE_DOTFILE, LOCKING_STYLE_FLOCK, LOCKING_STYLE_NONE, LOCKING_STYLE_POSIX, sqlite3_vfs_register(), SQLITE_OK, and UNIXVFS.
static int sqliteErrorFromPosixError | ( | int | posixError, | |
int | sqliteIOErr | |||
) | [static] |
Definition at line 1178 of file os_unix.c.
References SQLITE_BUSY, SQLITE_IOERR_BLOCKED, SQLITE_IOERR_CHECKRESERVEDLOCK, SQLITE_IOERR_LOCK, SQLITE_IOERR_RDLOCK, SQLITE_IOERR_UNLOCK, SQLITE_OK, and SQLITE_PERM.
Referenced by unixCheckReservedLock(), unixLock(), and unixUnlock().
static int unixAccess | ( | sqlite3_vfs * | pVfs, | |
const char * | zPath, | |||
int | flags, | |||
int * | pResOut | |||
) | [static] |
Definition at line 2726 of file os_unix.c.
References SimulateIOError, SQLITE_ACCESS_EXISTS, SQLITE_ACCESS_READ, SQLITE_ACCESS_READWRITE, SQLITE_IOERR_ACCESS, and SQLITE_OK.
static int unixCheckReservedLock | ( | sqlite3_file * | id, | |
int * | pResOut | |||
) | [static] |
Definition at line 1239 of file os_unix.c.
References enterMutex(), unixFile::h, unixFile::lastErrno, leaveMutex(), lockInfo::locktype, OSTRACE4, unixFile::pLock, RESERVED_BYTE, SHARED_LOCK, SimulateIOError, SQLITE_IOERR_CHECKRESERVEDLOCK, SQLITE_OK, and sqliteErrorFromPosixError().
Referenced by fillInUnixFile().
static int unixClose | ( | sqlite3_file * | id | ) | [static] |
Definition at line 1659 of file os_unix.c.
References openCnt::aPending, closeUnixFile(), enterMutex(), unixFile::h, leaveMutex(), openCnt::nLock, NO_LOCK, openCnt::nPending, unixFile::pLock, unixFile::pOpen, releaseLockInfo(), releaseOpenCnt(), sqlite3_realloc(), SQLITE_OK, and unixUnlock().
Referenced by fillInUnixFile().
static int unixCurrentTime | ( | sqlite3_vfs * | pVfs, | |
double * | prNow | |||
) | [static] |
static int unixDelete | ( | sqlite3_vfs * | pVfs, | |
const char * | zPath, | |||
int | dirSync | |||
) | [static] |
Definition at line 2697 of file os_unix.c.
References openDirectory(), SimulateIOError, SQLITE_IOERR_DELETE, SQLITE_IOERR_DIR_FSYNC, and SQLITE_OK.
static int unixDeviceCharacteristics | ( | sqlite3_file * | id | ) | [static] |
static void unixDlClose | ( | sqlite3_vfs * | pVfs, | |
void * | pHandle | |||
) | [static] |
static void unixDlError | ( | sqlite3_vfs * | pVfs, | |
int | nBuf, | |||
char * | zBufOut | |||
) | [static] |
Definition at line 2835 of file os_unix.c.
References enterMutex(), leaveMutex(), and sqlite3_snprintf().
static void* unixDlOpen | ( | sqlite3_vfs * | pVfs, | |
const char * | zFilename | |||
) | [static] |
static void* unixDlSym | ( | sqlite3_vfs * | pVfs, | |
void * | pHandle, | |||
const char * | zSymbol | |||
) | [static] |
static int unixFileControl | ( | sqlite3_file * | id, | |
int | op, | |||
void * | pArg | |||
) | [static] |
Definition at line 2307 of file os_unix.c.
References SQLITE_ERROR, SQLITE_FCNTL_LOCKSTATE, and SQLITE_OK.
static int unixFileSize | ( | sqlite3_file * | id, | |
i64 * | pSize | |||
) | [static] |
Definition at line 1145 of file os_unix.c.
References SimulateIOError, SQLITE_IOERR_FSTAT, and SQLITE_OK.
static int unixFullPathname | ( | sqlite3_vfs * | pVfs, | |
const char * | zPath, | |||
int | nOut, | |||
char * | zOut | |||
) | [static] |
Definition at line 2762 of file os_unix.c.
References MAX_PATHNAME, sqlite3_vfs::mxPathname, SimulateIOError, sqlite3_snprintf(), SQLITE_CANTOPEN, SQLITE_ERROR, and SQLITE_OK.
static int unixGetLastError | ( | sqlite3_vfs * | pVfs, | |
int | nBuf, | |||
char * | zBuf | |||
) | [static] |
static int unixLock | ( | sqlite3_file * | id, | |
int | locktype | |||
) | [static] |
Definition at line 1302 of file os_unix.c.
References lockInfo::cnt, enterMutex(), EXCLUSIVE_LOCK, unixFile::h, IS_LOCK_ERROR, unixFile::lastErrno, leaveMutex(), lockInfo::locktype, unixFile::locktype, openCnt::nLock, NO_LOCK, OSTRACE3, OSTRACE4, OSTRACE7, PENDING_BYTE, PENDING_LOCK, unixFile::pLock, unixFile::pOpen, RESERVED_BYTE, RESERVED_LOCK, SHARED_FIRST, SHARED_LOCK, SHARED_SIZE, SQLITE_BUSY, SQLITE_IOERR_LOCK, SQLITE_IOERR_UNLOCK, SQLITE_OK, sqliteErrorFromPosixError(), and transferOwnership.
Referenced by fillInUnixFile().
static int unixOpen | ( | sqlite3_vfs * | pVfs, | |
const char * | zPath, | |||
sqlite3_file * | pFile, | |||
int | flags, | |||
int * | pOutFlags | |||
) | [static] |
Definition at line 2582 of file os_unix.c.
References fillInUnixFile(), getTempname(), MAX_PATHNAME, O_BINARY, O_LARGEFILE, O_NOFOLLOW, openDirectory(), SQLITE_CANTOPEN, SQLITE_DEFAULT_FILE_PERMISSIONS, SQLITE_OK, SQLITE_OPEN_CREATE, SQLITE_OPEN_DELETEONCLOSE, SQLITE_OPEN_EXCLUSIVE, SQLITE_OPEN_MAIN_DB, SQLITE_OPEN_MAIN_JOURNAL, SQLITE_OPEN_MASTER_JOURNAL, SQLITE_OPEN_READONLY, SQLITE_OPEN_READWRITE, SQLITE_OPEN_SUBJOURNAL, SQLITE_OPEN_TEMP_DB, SQLITE_OPEN_TEMP_JOURNAL, and SQLITE_OPEN_TRANSIENT_DB.
static int unixRandomness | ( | sqlite3_vfs * | pVfs, | |
int | nBuf, | |||
char * | zBuf | |||
) | [static] |
static int unixRead | ( | sqlite3_file * | id, | |
void * | pBuf, | |||
int | amt, | |||
sqlite3_int64 | offset | |||
) | [static] |
Definition at line 902 of file os_unix.c.
References seekAndRead(), SQLITE_IOERR_READ, SQLITE_IOERR_SHORT_READ, and SQLITE_OK.
static int unixSectorSize | ( | sqlite3_file * | id | ) | [static] |
Definition at line 2327 of file os_unix.c.
References SQLITE_DEFAULT_SECTOR_SIZE.
static int unixSleep | ( | sqlite3_vfs * | pVfs, | |
int | microseconds | |||
) | [static] |
static int unixSync | ( | sqlite3_file * | id, | |
int | flags | |||
) | [static] |
Definition at line 1079 of file os_unix.c.
References unixFile::dirfd, full_fsync(), unixFile::h, HAVE_FULLFSYNC, OSTRACE2, OSTRACE4, SimulateDiskfullError, SimulateIOError, SQLITE_FULL, SQLITE_IOERR_FSYNC, SQLITE_OK, SQLITE_SYNC_DATAONLY, SQLITE_SYNC_FULL, and SQLITE_SYNC_NORMAL.
static int unixTruncate | ( | sqlite3_file * | id, | |
i64 | nByte | |||
) | [static] |
Definition at line 1130 of file os_unix.c.
References SimulateIOError, SQLITE_IOERR_TRUNCATE, and SQLITE_OK.
static int unixUnlock | ( | sqlite3_file * | id, | |
int | locktype | |||
) | [static] |
Definition at line 1524 of file os_unix.c.
References openCnt::aPending, CHECK_THREADID, lockInfo::cnt, enterMutex(), unixFile::h, IS_LOCK_ERROR, unixFile::lastErrno, leaveMutex(), lockInfo::locktype, unixFile::locktype, openCnt::nLock, NO_LOCK, openCnt::nPending, OSTRACE7, PENDING_BYTE, unixFile::pLock, unixFile::pOpen, RESERVED_BYTE, SHARED_FIRST, SHARED_LOCK, SHARED_SIZE, SimulateIOError, SimulateIOErrorBenign, sqlite3_free(), SQLITE_IOERR_RDLOCK, SQLITE_IOERR_UNLOCK, SQLITE_MISUSE, SQLITE_OK, and sqliteErrorFromPosixError().
Referenced by fillInUnixFile(), and unixClose().
static int unixWrite | ( | sqlite3_file * | id, | |
const void * | pBuf, | |||
int | amt, | |||
sqlite3_int64 | offset | |||
) | [static] |
Definition at line 951 of file os_unix.c.
References seekAndWrite(), SimulateDiskfullError, SimulateIOError, SQLITE_FULL, SQLITE_IOERR_WRITE, and SQLITE_OK.
ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:50:00 2011 by Doxygen 1.6.1