drh | e3c4137 | 2001-09-17 20:25:58 +0000 | [diff] [blame^] | 1 | /* |
| 2 | ** 2001 September 16 |
| 3 | ** |
| 4 | ** The author disclaims copyright to this source code. In place of |
| 5 | ** a legal notice, here is a blessing: |
| 6 | ** |
| 7 | ** May you do good and not evil. |
| 8 | ** May you find forgiveness for yourself and forgive others. |
| 9 | ** May you share freely, never taking more than you give. |
| 10 | ** |
| 11 | ****************************************************************************** |
| 12 | ** |
| 13 | ** This header file (together with is companion C source-code file |
| 14 | ** "os.c") attempt to abstract the underlying operating system so that |
| 15 | ** the SQLite library will work on both POSIX and windows systems. |
| 16 | */ |
| 17 | #ifndef _SQLITE_OS_H_ |
| 18 | #define _SQLITE_OS_H_ |
| 19 | |
| 20 | /* |
| 21 | ** A handle for an open file is stored in an OsFile object. |
| 22 | */ |
| 23 | #if OS_UNIX |
| 24 | typedef int OsFile; |
| 25 | # define SQLITE_TEMPNAME_SIZE 200 |
| 26 | #endif |
| 27 | |
| 28 | #if OS_WIN |
| 29 | typedef HANDLE OsFile; |
| 30 | # define SQLITE_TEMPNAME_SIZE (MAX_PATH+1) |
| 31 | #endif |
| 32 | |
| 33 | int sqliteOsOpenReadWrite(char*, OsFile*, int*); |
| 34 | int sqliteOsOpenExclusive(char*, OsFile*); |
| 35 | int sqliteOsTempFileName(char*); |
| 36 | int sqliteOsClose(OsFile); |
| 37 | int sqliteOsRead(OsFile, int amt, void*); |
| 38 | int sqliteOsWrite(OsFile, int amt, void*); |
| 39 | int sqliteOsSeek(OsFile, int offset); |
| 40 | int sqliteOsSync(OsFile); |
| 41 | int sqliteOsTruncate(OsFile, int size); |
| 42 | int sqliteOsFileSize(OsFile, int *pSize); |
| 43 | int sqliteOsLock(OsFile, int wrlock); |
| 44 | int sqliteOsUnlock(OsFile); |
| 45 | int sqliteOsRandomSeed(int amt, char*); |
| 46 | int sqliteSleep(int ms); |
| 47 | |
| 48 | |
| 49 | |
| 50 | #endif /* _SQLITE_OS_H_ */ |