亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? os_unix.c

?? sqlite 3.3.8 支持加密的版本
?? C
?? 第 1 頁(yè) / 共 5 頁(yè)
字號(hào):
/*
** 2004 May 22
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This file contains code that is specific to Unix systems.
*/
#include "sqliteInt.h"
#include "os.h"
#if OS_UNIX              /* This file is used on unix only */

/* #define SQLITE_ENABLE_LOCKING_STYLE 0 */

/*
** These #defines should enable >2GB file support on Posix if the
** underlying operating system supports it.  If the OS lacks
** large file support, these should be no-ops.
**
** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch
** on the compiler command line.  This is necessary if you are compiling
** on a recent machine (ex: RedHat 7.2) but you want your code to work
** on an older machine (ex: RedHat 6.0).  If you compile on RedHat 7.2
** without this option, LFS is enable.  But LFS does not exist in the kernel
** in RedHat 6.0, so the code won't work.  Hence, for maximum binary
** portability you should omit LFS.
*/
#ifndef SQLITE_DISABLE_LFS
# define _LARGE_FILE       1
# ifndef _FILE_OFFSET_BITS
#   define _FILE_OFFSET_BITS 64
# endif
# define _LARGEFILE_SOURCE 1
#endif

/*
** standard include files.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <time.h>
#include <sys/time.h>
#include <errno.h>
#ifdef SQLITE_ENABLE_LOCKING_STYLE
#include <sys/ioctl.h>
#include <sys/param.h>
#include <sys/mount.h>
#endif /* SQLITE_ENABLE_LOCKING_STYLE */

/*
** If we are to be thread-safe, include the pthreads header and define
** the SQLITE_UNIX_THREADS macro.
*/
#if defined(THREADSAFE) && THREADSAFE
# include <pthread.h>
# define SQLITE_UNIX_THREADS 1
#endif

/*
** Default permissions when creating a new file
*/
#ifndef SQLITE_DEFAULT_FILE_PERMISSIONS
# define SQLITE_DEFAULT_FILE_PERMISSIONS 0644
#endif



/*
** The unixFile structure is subclass of OsFile specific for the unix
** protability layer.
*/
typedef struct unixFile unixFile;
struct unixFile {
  IoMethod const *pMethod;  /* Always the first entry */
  struct openCnt *pOpen;    /* Info about all open fd's on this inode */
  struct lockInfo *pLock;   /* Info about locks on this inode */
#ifdef SQLITE_ENABLE_LOCKING_STYLE
  void *lockingContext;     /* Locking style specific state */
#endif /* SQLITE_ENABLE_LOCKING_STYLE */
  int h;                    /* The file descriptor */
  unsigned char locktype;   /* The type of lock held on this fd */
  unsigned char isOpen;     /* True if needs to be closed */
  unsigned char fullSync;   /* Use F_FULLSYNC if available */
  int dirfd;                /* File descriptor for the directory */
  i64 offset;               /* Seek offset */
#ifdef SQLITE_UNIX_THREADS
  pthread_t tid;            /* The thread that "owns" this OsFile */
#endif
};

/*
** Provide the ability to override some OS-layer functions during
** testing.  This is used to simulate OS crashes to verify that 
** commits are atomic even in the event of an OS crash.
*/
#ifdef SQLITE_CRASH_TEST
  extern int sqlite3CrashTestEnable;
  extern int sqlite3CrashOpenReadWrite(const char*, OsFile**, int*);
  extern int sqlite3CrashOpenExclusive(const char*, OsFile**, int);
  extern int sqlite3CrashOpenReadOnly(const char*, OsFile**, int);
# define CRASH_TEST_OVERRIDE(X,A,B,C) \
    if(sqlite3CrashTestEnable){ return X(A,B,C); }
#else
# define CRASH_TEST_OVERRIDE(X,A,B,C)  /* no-op */
#endif


/*
** Include code that is common to all os_*.c files
*/
#include "os_common.h"

/*
** Do not include any of the File I/O interface procedures if the
** SQLITE_OMIT_DISKIO macro is defined (indicating that the database
** will be in-memory only)
*/
#ifndef SQLITE_OMIT_DISKIO


/*
** Define various macros that are missing from some systems.
*/
#ifndef O_LARGEFILE
# define O_LARGEFILE 0
#endif
#ifdef SQLITE_DISABLE_LFS
# undef O_LARGEFILE
# define O_LARGEFILE 0
#endif
#ifndef O_NOFOLLOW
# define O_NOFOLLOW 0
#endif
#ifndef O_BINARY
# define O_BINARY 0
#endif

/*
** The DJGPP compiler environment looks mostly like Unix, but it
** lacks the fcntl() system call.  So redefine fcntl() to be something
** that always succeeds.  This means that locking does not occur under
** DJGPP.  But it's DOS - what did you expect?
*/
#ifdef __DJGPP__
# define fcntl(A,B,C) 0
#endif

/*
** The threadid macro resolves to the thread-id or to 0.  Used for
** testing and debugging only.
*/
#ifdef SQLITE_UNIX_THREADS
#define threadid pthread_self()
#else
#define threadid 0
#endif

/*
** Set or check the OsFile.tid field.  This field is set when an OsFile
** is first opened.  All subsequent uses of the OsFile verify that the
** same thread is operating on the OsFile.  Some operating systems do
** not allow locks to be overridden by other threads and that restriction
** means that sqlite3* database handles cannot be moved from one thread
** to another.  This logic makes sure a user does not try to do that
** by mistake.
**
** Version 3.3.1 (2006-01-15):  OsFiles can be moved from one thread to
** another as long as we are running on a system that supports threads
** overriding each others locks (which now the most common behavior)
** or if no locks are held.  But the OsFile.pLock field needs to be
** recomputed because its key includes the thread-id.  See the 
** transferOwnership() function below for additional information
*/
#if defined(SQLITE_UNIX_THREADS)
# define SET_THREADID(X)   (X)->tid = pthread_self()
# define CHECK_THREADID(X) (threadsOverrideEachOthersLocks==0 && \
                            !pthread_equal((X)->tid, pthread_self()))
#else
# define SET_THREADID(X)
# define CHECK_THREADID(X) 0
#endif

/*
** Here is the dirt on POSIX advisory locks:  ANSI STD 1003.1 (1996)
** section 6.5.2.2 lines 483 through 490 specify that when a process
** sets or clears a lock, that operation overrides any prior locks set
** by the same process.  It does not explicitly say so, but this implies
** that it overrides locks set by the same process using a different
** file descriptor.  Consider this test case:
**
**       int fd1 = open("./file1", O_RDWR|O_CREAT, 0644);
**       int fd2 = open("./file2", O_RDWR|O_CREAT, 0644);
**
** Suppose ./file1 and ./file2 are really the same file (because
** one is a hard or symbolic link to the other) then if you set
** an exclusive lock on fd1, then try to get an exclusive lock
** on fd2, it works.  I would have expected the second lock to
** fail since there was already a lock on the file due to fd1.
** But not so.  Since both locks came from the same process, the
** second overrides the first, even though they were on different
** file descriptors opened on different file names.
**
** Bummer.  If you ask me, this is broken.  Badly broken.  It means
** that we cannot use POSIX locks to synchronize file access among
** competing threads of the same process.  POSIX locks will work fine
** to synchronize access for threads in separate processes, but not
** threads within the same process.
**
** To work around the problem, SQLite has to manage file locks internally
** on its own.  Whenever a new database is opened, we have to find the
** specific inode of the database file (the inode is determined by the
** st_dev and st_ino fields of the stat structure that fstat() fills in)
** and check for locks already existing on that inode.  When locks are
** created or removed, we have to look at our own internal record of the
** locks to see if another thread has previously set a lock on that same
** inode.
**
** The OsFile structure for POSIX is no longer just an integer file
** descriptor.  It is now a structure that holds the integer file
** descriptor and a pointer to a structure that describes the internal
** locks on the corresponding inode.  There is one locking structure
** per inode, so if the same inode is opened twice, both OsFile structures
** point to the same locking structure.  The locking structure keeps
** a reference count (so we will know when to delete it) and a "cnt"
** field that tells us its internal lock status.  cnt==0 means the
** file is unlocked.  cnt==-1 means the file has an exclusive lock.
** cnt>0 means there are cnt shared locks on the file.
**
** Any attempt to lock or unlock a file first checks the locking
** structure.  The fcntl() system call is only invoked to set a 
** POSIX lock if the internal lock structure transitions between
** a locked and an unlocked state.
**
** 2004-Jan-11:
** More recent discoveries about POSIX advisory locks.  (The more
** I discover, the more I realize the a POSIX advisory locks are
** an abomination.)
**
** If you close a file descriptor that points to a file that has locks,
** all locks on that file that are owned by the current process are
** released.  To work around this problem, each OsFile structure contains
** a pointer to an openCnt structure.  There is one openCnt structure
** per open inode, which means that multiple OsFiles can point to a single
** openCnt.  When an attempt is made to close an OsFile, if there are
** other OsFiles open on the same inode that are holding locks, the call
** to close() the file descriptor is deferred until all of the locks clear.
** The openCnt structure keeps a list of file descriptors that need to
** be closed and that list is walked (and cleared) when the last lock
** clears.
**
** First, under Linux threads, because each thread has a separate
** process ID, lock operations in one thread do not override locks
** to the same file in other threads.  Linux threads behave like
** separate processes in this respect.  But, if you close a file
** descriptor in linux threads, all locks are cleared, even locks
** on other threads and even though the other threads have different
** process IDs.  Linux threads is inconsistent in this respect.
** (I'm beginning to think that linux threads is an abomination too.)
** The consequence of this all is that the hash table for the lockInfo
** structure has to include the process id as part of its key because
** locks in different threads are treated as distinct.  But the 
** openCnt structure should not include the process id in its
** key because close() clears lock on all threads, not just the current
** thread.  Were it not for this goofiness in linux threads, we could
** combine the lockInfo and openCnt structures into a single structure.
**
** 2004-Jun-28:
** On some versions of linux, threads can override each others locks.
** On others not.  Sometimes you can change the behavior on the same
** system by setting the LD_ASSUME_KERNEL environment variable.  The
** POSIX standard is silent as to which behavior is correct, as far
** as I can tell, so other versions of unix might show the same
** inconsistency.  There is no little doubt in my mind that posix
** advisory locks and linux threads are profoundly broken.
**
** To work around the inconsistencies, we have to test at runtime 
** whether or not threads can override each others locks.  This test
** is run once, the first time any lock is attempted.  A static 
** variable is set to record the results of this test for future
** use.
*/

/*
** An instance of the following structure serves as the key used
** to locate a particular lockInfo structure given its inode.
**
** If threads cannot override each others locks, then we set the
** lockKey.tid field to the thread ID.  If threads can override
** each others locks then tid is always set to zero.  tid is omitted
** if we compile without threading support.
*/
struct lockKey {
  dev_t dev;       /* Device number */
  ino_t ino;       /* Inode number */
#ifdef SQLITE_UNIX_THREADS
  pthread_t tid;   /* Thread ID or zero if threads can override each other */
#endif
};

/*
** An instance of the following structure is allocated for each open
** inode on each thread with a different process ID.  (Threads have
** different process IDs on linux, but not on most other unixes.)
**
** A single inode can have multiple file descriptors, so each OsFile
** structure contains a pointer to an instance of this object and this
** object keeps a count of the number of OsFiles pointing to it.
*/
struct lockInfo {
  struct lockKey key;  /* The lookup key */
  int cnt;             /* Number of SHARED locks held */
  int locktype;        /* One of SHARED_LOCK, RESERVED_LOCK etc. */
  int nRef;            /* Number of pointers to this structure */
};

/*
** An instance of the following structure serves as the key used
** to locate a particular openCnt structure given its inode.  This
** is the same as the lockKey except that the thread ID is omitted.
*/
struct openKey {
  dev_t dev;   /* Device number */
  ino_t ino;   /* Inode number */
};

/*
** An instance of the following structure is allocated for each open
** inode.  This structure keeps track of the number of locks on that
** inode.  If a close is attempted against an inode that is holding
** locks, the close is deferred until all locks clear by adding the
** file descriptor to be closed to the pending list.
*/
struct openCnt {
  struct openKey key;   /* The lookup key */
  int nRef;             /* Number of pointers to this structure */
  int nLock;            /* Number of outstanding locks */
  int nPending;         /* Number of pending close() operations */
  int *aPending;        /* Malloced space holding fd's awaiting a close() */
};

/* 
** These hash tables map inodes and file descriptors (really, lockKey and
** openKey structures) into lockInfo and openCnt structures.  Access to 
** these hash tables must be protected by a mutex.
*/
static Hash lockHash = {SQLITE_HASH_BINARY, 0, 0, 0, 
    sqlite3ThreadSafeMalloc, sqlite3ThreadSafeFree, 0, 0};
static Hash openHash = {SQLITE_HASH_BINARY, 0, 0, 0, 
    sqlite3ThreadSafeMalloc, sqlite3ThreadSafeFree, 0, 0};

#ifdef SQLITE_ENABLE_LOCKING_STYLE
/*
** The locking styles are associated with the different file locking
** capabilities supported by different file systems.  
**
** POSIX locking style fully supports shared and exclusive byte-range locks 
** ADP locking only supports exclusive byte-range locks
** FLOCK only supports a single file-global exclusive lock
** DOTLOCK isn't a true locking style, it refers to the use of a special
**   file named the same as the database file with a '.lock' extension, this
**   can be used on file systems that do not offer any reliable file locking
** NO locking means that no locking will be attempted, this is only used for
**   read-only file systems currently
** UNSUPPORTED means that no locking will be attempted, this is only used for
**   file systems that are known to be unsupported
*/
typedef enum {
	posixLockingStyle = 0,       /* standard posix-advisory locks */
	afpLockingStyle,             /* use afp locks */
	flockLockingStyle,           /* use flock() */
	dotlockLockingStyle,         /* use <file>.lock files */
	noLockingStyle,              /* useful for read-only file system */
	unsupportedLockingStyle      /* indicates unsupported file system */
} sqlite3LockingStyle;
#endif /* SQLITE_ENABLE_LOCKING_STYLE */

#ifdef SQLITE_UNIX_THREADS
/*
** This variable records whether or not threads can override each others
** locks.
**
**    0:  No.  Threads cannot override each others locks.
**    1:  Yes.  Threads can override each others locks.
**   -1:  We don't know yet.
**
** On some systems, we know at compile-time if threads can override each
** others locks.  On those systems, the SQLITE_THREAD_OVERRIDE_LOCK macro
** will be set appropriately.  On other systems, we have to check at
** runtime.  On these latter systems, SQLTIE_THREAD_OVERRIDE_LOCK is
** undefined.
**
** This variable normally has file scope only.  But during testing, we make
** it a global so that the test code can change its value in order to verify
** that the right stuff happens in either case.
*/
#ifndef SQLITE_THREAD_OVERRIDE_LOCK

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一a一片一级一片| 久久精工是国产品牌吗| 成人午夜激情在线| 精品国产一区二区三区四区四| 中文字幕亚洲精品在线观看| 久久丁香综合五月国产三级网站| 欧美亚一区二区| 亚洲美女精品一区| 91在线国产福利| 中文字幕一区二区三区在线不卡| 国产乱一区二区| 欧美日韩国产高清一区| 午夜久久久久久电影| 在线观看成人小视频| 亚洲一区欧美一区| 色婷婷一区二区三区四区| 亚洲欧洲日韩一区二区三区| 懂色av一区二区夜夜嗨| 2020国产精品| 美国十次综合导航| 欧美videossexotv100| 狠狠色丁香久久婷婷综| 久久综合给合久久狠狠狠97色69| 狠狠久久亚洲欧美| 国产精品色婷婷| 日本久久电影网| 午夜精品一区在线观看| 欧美一区二区三区性视频| 国产中文字幕一区| 国产精品三级在线观看| 欧美性淫爽ww久久久久无| 午夜一区二区三区视频| 日韩一区二区三区视频在线观看| 久久电影网站中文字幕| 中文字幕 久热精品 视频在线| 成人av在线播放网站| 亚洲福利视频三区| 精品电影一区二区| 91香蕉国产在线观看软件| 五月天亚洲精品| 国产人久久人人人人爽| 欧美性受极品xxxx喷水| 国产在线麻豆精品观看| 亚洲精品成人天堂一二三| 日韩女优毛片在线| 91视频观看视频| 狠狠色丁香婷综合久久| 亚洲乱码中文字幕综合| 自拍偷拍国产精品| 欧美va亚洲va在线观看蝴蝶网| 91伊人久久大香线蕉| 精品在线播放午夜| 午夜精品视频在线观看| 成人免费一区二区三区视频| 精品国产污网站| 欧美三级视频在线观看| 91影视在线播放| thepron国产精品| 成人黄色电影在线| 奇米一区二区三区| 亚洲一区自拍偷拍| 亚洲欧洲韩国日本视频| 久久亚洲综合色| 中文字幕一区二区三区在线不卡| 日本韩国欧美一区二区三区| 亚洲成人一二三| 久久久三级国产网站| 91久久精品日日躁夜夜躁欧美| 日韩中文字幕av电影| 久久久久久久久免费| 欧美综合久久久| 狠狠色伊人亚洲综合成人| 亚洲一区二区高清| 久久理论电影网| 欧美日产在线观看| 粉嫩高潮美女一区二区三区| 午夜电影一区二区三区| 国产精品嫩草99a| 日韩三级在线免费观看| 91啪亚洲精品| 岛国一区二区在线观看| 久88久久88久久久| 亚洲超碰精品一区二区| 亚洲人成网站在线| 欧美激情资源网| 久久久久久久国产精品影院| 午夜婷婷国产麻豆精品| 国产美女在线观看一区| 欧美日韩成人在线一区| 国产成人一级电影| 久久超碰97中文字幕| 日韩高清在线观看| 亚洲高清免费观看 | 色就色 综合激情| 国产成人在线视频网站| 精品一区二区三区在线观看国产| 日韩精品福利网| 日韩成人免费看| 日韩经典中文字幕一区| 日韩不卡一区二区| 久久疯狂做爰流白浆xx| 国内精品久久久久影院一蜜桃| 美女网站在线免费欧美精品| 视频在线在亚洲| 免费欧美高清视频| 激情偷乱视频一区二区三区| 国产在线看一区| 成人h精品动漫一区二区三区| k8久久久一区二区三区| 91捆绑美女网站| 69久久99精品久久久久婷婷 | 91精品国产综合久久久久久久 | 99视频精品免费视频| 91福利区一区二区三区| 91精品一区二区三区久久久久久| 91麻豆精品国产综合久久久久久| 日韩免费观看高清完整版| 天天亚洲美女在线视频| 精品中文av资源站在线观看| 高清国产午夜精品久久久久久| 一本大道久久a久久综合婷婷| 欧美色图第一页| 国产欧美一区二区精品性色超碰| 国产精品不卡视频| 免费成人结看片| 99精品视频一区二区| 欧美电影免费观看高清完整版在线观看| 国产亚洲精品超碰| 日韩成人伦理电影在线观看| 成人久久久精品乱码一区二区三区| 91福利社在线观看| 亚洲国产精品激情在线观看| 婷婷丁香久久五月婷婷| 91日韩一区二区三区| 欧美国产日韩a欧美在线观看| 亚洲不卡一区二区三区| 91天堂素人约啪| 久久精品水蜜桃av综合天堂| 午夜欧美2019年伦理| 91视频.com| 国产精品高潮久久久久无| 国产一区二区三区免费观看 | 日韩美一区二区三区| 亚洲成人在线免费| 欧美午夜影院一区| 最新国产成人在线观看| 成人国产精品免费| 久久久久久久久伊人| 国内精品免费在线观看| 精品久久久久久久久久久久包黑料| 亚洲va国产天堂va久久en| 97精品电影院| 一区二区三区日韩欧美精品| 色综合久久中文综合久久牛| 亚洲三级在线免费| 色老汉一区二区三区| 亚洲va欧美va人人爽| 正在播放亚洲一区| 久久se精品一区二区| 精品动漫一区二区三区在线观看 | 色综合激情五月| 午夜精品视频一区| 欧美一区二区三区视频在线| 久久99精品视频| 日本一二三四高清不卡| 91浏览器在线视频| 天使萌一区二区三区免费观看| 欧美一区二区三区日韩| 国产麻豆午夜三级精品| 亚洲区小说区图片区qvod| 欧美美女视频在线观看| 国产一区欧美一区| 一区二区在线观看免费视频播放| 久久久久久久久久久电影| 成人免费视频播放| 亚洲v中文字幕| 国产精品丝袜黑色高跟| 欧美日韩国产精选| 成人av电影在线观看| 天堂在线亚洲视频| 亚洲日本中文字幕区| 日韩一区二区免费高清| 91色视频在线| 成人免费高清在线| 日韩av不卡在线观看| 中文字幕日韩一区| 欧美精品一区二区三区视频| 色呦呦国产精品| 99免费精品在线| 高清av一区二区| 久草这里只有精品视频| 亚洲五码中文字幕| 自拍偷拍亚洲综合| 欧美国产日韩精品免费观看| 日韩欧美久久久| 制服.丝袜.亚洲.另类.中文| 欧美影院午夜播放| 色狠狠一区二区三区香蕉| 成人动漫一区二区| 99久久综合色|