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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? os_os2.c

?? 嵌入式數據系統軟件!
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*** 2006 Feb 14**** 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 OS/2.*/#include "sqliteInt.h"#if OS_OS2/*** A Note About Memory Allocation:**** This driver uses malloc()/free() directly rather than going through** the SQLite-wrappers sqlite3_malloc()/sqlite3_free().  Those wrappers** are designed for use on embedded systems where memory is scarce and** malloc failures happen frequently.  OS/2 does not typically run on** embedded systems, and when it does the developers normally have bigger** problems to worry about than running out of memory.  So there is not** a compelling need to use the wrappers.**** But there is a good reason to not use the wrappers.  If we use the** wrappers then we will get simulated malloc() failures within this** driver.  And that causes all kinds of problems for our tests.  We** could enhance SQLite to deal with simulated malloc failures within** the OS driver, but the code to deal with those failure would not** be exercised on Linux (which does not need to malloc() in the driver)** and so we would have difficulty writing coverage tests for that** code.  Better to leave the code out, we think.**** The point of this discussion is as follows:  When creating a new** OS layer for an embedded system, if you use this file as an example,** avoid the use of malloc()/free().  Those routines work ok on OS/2** desktops but not so well in embedded systems.*//*** Macros used to determine whether or not to use threads.*/#if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE# define SQLITE_OS2_THREADS 1#endif/*** Include code that is common to all os_*.c files*/#include "os_common.h"/*** The os2File structure is subclass of sqlite3_file specific for the OS/2** protability layer.*/typedef struct os2File os2File;struct os2File {  const sqlite3_io_methods *pMethod;  /* Always the first entry */  HFILE h;                  /* Handle for accessing the file */  int delOnClose;           /* True if file is to be deleted on close */  char* pathToDel;          /* Name of file to delete on close */  unsigned char locktype;   /* Type of lock currently held on this file */};/******************************************************************************* The next group of routines implement the I/O methods specified** by the sqlite3_io_methods object.******************************************************************************//*** Close a file.*/int os2Close( sqlite3_file *id ){  APIRET rc = NO_ERROR;  os2File *pFile;  if( id && (pFile = (os2File*)id) != 0 ){    OSTRACE2( "CLOSE %d\n", pFile->h );    rc = DosClose( pFile->h );    pFile->locktype = NO_LOCK;    if( pFile->delOnClose != 0 ){      rc = DosForceDelete( (PSZ)pFile->pathToDel );    }    if( pFile->pathToDel ){      free( pFile->pathToDel );    }    id = 0;    OpenCounter( -1 );  }  return rc == NO_ERROR ? SQLITE_OK : SQLITE_IOERR;}/*** Read data from a file into a buffer.  Return SQLITE_OK if all** bytes were read successfully and SQLITE_IOERR if anything goes** wrong.*/int os2Read(  sqlite3_file *id,               /* File to read from */  void *pBuf,                     /* Write content into this buffer */  int amt,                        /* Number of bytes to read */  sqlite3_int64 offset            /* Begin reading at this offset */){  ULONG fileLocation = 0L;  ULONG got;  os2File *pFile = (os2File*)id;  assert( id!=0 );  SimulateIOError( return SQLITE_IOERR_READ );  OSTRACE3( "READ %d lock=%d\n", pFile->h, pFile->locktype );  if( DosSetFilePtr(pFile->h, offset, FILE_BEGIN, &fileLocation) != NO_ERROR ){    return SQLITE_IOERR;  }  if( DosRead( pFile->h, pBuf, amt, &got ) != NO_ERROR ){    return SQLITE_IOERR_READ;  }  if( got == (ULONG)amt )    return SQLITE_OK;  else {    memset(&((char*)pBuf)[got], 0, amt-got);    return SQLITE_IOERR_SHORT_READ;  }}/*** Write data from a buffer into a file.  Return SQLITE_OK on success** or some other error code on failure.*/int os2Write(  sqlite3_file *id,               /* File to write into */  const void *pBuf,               /* The bytes to be written */  int amt,                        /* Number of bytes to write */  sqlite3_int64 offset            /* Offset into the file to begin writing at */){  ULONG fileLocation = 0L;  APIRET rc = NO_ERROR;  ULONG wrote;  os2File *pFile = (os2File*)id;  assert( id!=0 );  SimulateIOError( return SQLITE_IOERR_WRITE );  SimulateDiskfullError( return SQLITE_FULL );  OSTRACE3( "WRITE %d lock=%d\n", pFile->h, pFile->locktype );  if( DosSetFilePtr(pFile->h, offset, FILE_BEGIN, &fileLocation) != NO_ERROR ){    return SQLITE_IOERR;  }  assert( amt>0 );  while( amt > 0 &&         (rc = DosWrite( pFile->h, (PVOID)pBuf, amt, &wrote )) &&         wrote > 0  ){    amt -= wrote;    pBuf = &((char*)pBuf)[wrote];  }  return ( rc != NO_ERROR || amt > (int)wrote ) ? SQLITE_FULL : SQLITE_OK;}/*** Truncate an open file to a specified size*/int os2Truncate( sqlite3_file *id, i64 nByte ){  APIRET rc = NO_ERROR;  ULONG filePosition = 0L;  os2File *pFile = (os2File*)id;  OSTRACE3( "TRUNCATE %d %lld\n", pFile->h, nByte );  SimulateIOError( return SQLITE_IOERR_TRUNCATE );  rc = DosSetFilePtr( pFile->h, nByte, FILE_BEGIN, &filePosition );  if( rc != NO_ERROR ){    return SQLITE_IOERR;  }  rc = DosSetFilePtr( pFile->h, 0L, FILE_END, &filePosition );  return rc == NO_ERROR ? SQLITE_OK : SQLITE_IOERR;}#ifdef SQLITE_TEST/*** Count the number of fullsyncs and normal syncs.  This is used to test** that syncs and fullsyncs are occuring at the right times.*/int sqlite3_sync_count = 0;int sqlite3_fullsync_count = 0;#endif/*** Make sure all writes to a particular file are committed to disk.*/int os2Sync( sqlite3_file *id, int flags ){  os2File *pFile = (os2File*)id;  OSTRACE3( "SYNC %d lock=%d\n", pFile->h, pFile->locktype );#ifdef SQLITE_TEST  if( flags & SQLITE_SYNC_FULL){    sqlite3_fullsync_count++;  }  sqlite3_sync_count++;#endif  return DosResetBuffer( pFile->h ) == NO_ERROR ? SQLITE_OK : SQLITE_IOERR;}/*** Determine the current size of a file in bytes*/int os2FileSize( sqlite3_file *id, sqlite3_int64 *pSize ){  APIRET rc = NO_ERROR;  FILESTATUS3 fsts3FileInfo;  memset(&fsts3FileInfo, 0, sizeof(fsts3FileInfo));  assert( id!=0 );  SimulateIOError( return SQLITE_IOERR );  rc = DosQueryFileInfo( ((os2File*)id)->h, FIL_STANDARD, &fsts3FileInfo, sizeof(FILESTATUS3) );  if( rc == NO_ERROR ){    *pSize = fsts3FileInfo.cbFile;    return SQLITE_OK;  }else{    return SQLITE_IOERR;  }}/*** Acquire a reader lock.*/static int getReadLock( os2File *pFile ){  FILELOCK  LockArea,            UnlockArea;  APIRET res;  memset(&LockArea, 0, sizeof(LockArea));  memset(&UnlockArea, 0, sizeof(UnlockArea));  LockArea.lOffset = SHARED_FIRST;  LockArea.lRange = SHARED_SIZE;  UnlockArea.lOffset = 0L;  UnlockArea.lRange = 0L;  res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 1L );  OSTRACE3( "GETREADLOCK %d res=%d\n", pFile->h, res );  return res;}/*** Undo a readlock*/static int unlockReadLock( os2File *id ){  FILELOCK  LockArea,            UnlockArea;  APIRET res;  memset(&LockArea, 0, sizeof(LockArea));  memset(&UnlockArea, 0, sizeof(UnlockArea));  LockArea.lOffset = 0L;  LockArea.lRange = 0L;  UnlockArea.lOffset = SHARED_FIRST;  UnlockArea.lRange = SHARED_SIZE;  res = DosSetFileLocks( id->h, &UnlockArea, &LockArea, 2000L, 1L );  OSTRACE3( "UNLOCK-READLOCK file handle=%d res=%d?\n", id->h, res );  return res;}/*** Lock the file with the lock specified by parameter locktype - one** of the following:****     (1) SHARED_LOCK**     (2) RESERVED_LOCK**     (3) PENDING_LOCK**     (4) EXCLUSIVE_LOCK**** Sometimes when requesting one lock state, additional lock states** are inserted in between.  The locking might fail on one of the later** transitions leaving the lock state different from what it started but** still short of its goal.  The following chart shows the allowed** transitions and the inserted intermediate states:****    UNLOCKED -> SHARED**    SHARED -> RESERVED**    SHARED -> (PENDING) -> EXCLUSIVE**    RESERVED -> (PENDING) -> EXCLUSIVE**    PENDING -> EXCLUSIVE**** This routine will only increase a lock.  The os2Unlock() routine** erases all locks at once and returns us immediately to locking level 0.** It is not possible to lower the locking level one step at a time.  You** must go straight to locking level 0.*/int os2Lock( sqlite3_file *id, int locktype ){  int rc = SQLITE_OK;       /* Return code from subroutines */  APIRET res = NO_ERROR;    /* Result of an OS/2 lock call */  int newLocktype;       /* Set pFile->locktype to this value before exiting */  int gotPendingLock = 0;/* True if we acquired a PENDING lock this time */  FILELOCK  LockArea,            UnlockArea;  os2File *pFile = (os2File*)id;  memset(&LockArea, 0, sizeof(LockArea));  memset(&UnlockArea, 0, sizeof(UnlockArea));  assert( pFile!=0 );  OSTRACE4( "LOCK %d %d was %d\n", pFile->h, locktype, pFile->locktype );  /* If there is already a lock of this type or more restrictive on the  ** os2File, do nothing. Don't use the end_lock: exit path, as  ** sqlite3OsEnterMutex() hasn't been called yet.  */  if( pFile->locktype>=locktype ){    OSTRACE3( "LOCK %d %d ok (already held)\n", pFile->h, locktype );    return SQLITE_OK;  }  /* Make sure the locking sequence is correct  */  assert( pFile->locktype!=NO_LOCK || locktype==SHARED_LOCK );  assert( locktype!=PENDING_LOCK );  assert( locktype!=RESERVED_LOCK || pFile->locktype==SHARED_LOCK );  /* Lock the PENDING_LOCK byte if we need to acquire a PENDING lock or  ** a SHARED lock.  If we are acquiring a SHARED lock, the acquisition of  ** the PENDING_LOCK byte is temporary.  */  newLocktype = pFile->locktype;  if( pFile->locktype==NO_LOCK      || (locktype==EXCLUSIVE_LOCK && pFile->locktype==RESERVED_LOCK)  ){    int cnt = 3;    LockArea.lOffset = PENDING_BYTE;    LockArea.lRange = 1L;    UnlockArea.lOffset = 0L;    UnlockArea.lRange = 0L;    while( cnt-->0 && ( res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 1L) )                      != NO_ERROR    ){      /* Try 3 times to get the pending lock.  The pending lock might be      ** held by another reader process who will release it momentarily.      */      OSTRACE2( "LOCK could not get a PENDING lock. cnt=%d\n", cnt );      DosSleep(1);    }    if( res == NO_ERROR){      gotPendingLock = 1;      OSTRACE3( "LOCK %d pending lock boolean set.  res=%d\n", pFile->h, res );

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜久久久影院| 久久99精品国产.久久久久| 五月天中文字幕一区二区| 久久成人免费网站| 色综合天天综合网国产成人综合天| 91精品国产福利| 亚洲综合一二区| 国产 欧美在线| 欧美一区二区三区免费观看视频| 中文字幕综合网| 国产盗摄女厕一区二区三区| 91精品国产一区二区三区| 自拍av一区二区三区| 国产激情一区二区三区| 日韩情涩欧美日韩视频| 亚洲国产日韩a在线播放| 9久草视频在线视频精品| 久久久一区二区三区| 日本视频免费一区| 欧美日韩在线播放一区| 亚洲精品你懂的| 色综合久久久久久久| 中文字幕一区在线观看视频| 国产成人8x视频一区二区| 久久无码av三级| 国产一区二区三区四区五区美女| 日韩一区二区免费视频| 五月综合激情网| 欧美精品第1页| 日本不卡的三区四区五区| 欧美剧情片在线观看| 国产综合色精品一区二区三区| 国产精品的网站| 风间由美一区二区av101| 久久综合久久综合久久| 精品无人码麻豆乱码1区2区| 精品久久久久久无| 国产精品一区专区| 国产亚洲福利社区一区| 成人国产精品免费观看视频| 中文字幕一区二区三区蜜月| 色综合天天综合网天天看片| 亚洲影院在线观看| 制服丝袜成人动漫| 久久99久久99| 国产亚洲va综合人人澡精品| jlzzjlzz亚洲女人18| 亚洲美女屁股眼交3| 91福利在线观看| 麻豆一区二区三| 久久久午夜精品| 97se亚洲国产综合自在线观| 亚洲国产精品影院| 日韩三级视频中文字幕| 福利电影一区二区三区| 一区二区三区国产豹纹内裤在线| 欧美日韩精品一区二区三区四区| 男人的天堂亚洲一区| 国产欧美日韩亚州综合| 91成人免费电影| 麻豆精品精品国产自在97香蕉| 国产片一区二区| 欧美亚洲精品一区| 看电影不卡的网站| 国产精品成人免费在线| 欧美视频一区在线观看| 国产精品综合在线视频| 亚洲蜜桃精久久久久久久| 精品国产91九色蝌蚪| 91一区一区三区| 蜜桃精品在线观看| 中文字幕一区二区不卡| 日韩三级免费观看| 色菇凉天天综合网| 国产呦萝稀缺另类资源| 亚洲一区二区在线免费观看视频| 日韩欧美国产高清| 欧美午夜不卡视频| 成人免费毛片aaaaa**| 日韩国产高清影视| 亚洲免费观看在线视频| 久久这里只有精品首页| 欧美日韩国产电影| 91性感美女视频| 国产一区二三区好的| 午夜精品久久久久久久久| 国产精品电影院| 2017欧美狠狠色| 欧美精品18+| 欧美影视一区在线| 97aⅴ精品视频一二三区| 韩国精品主播一区二区在线观看| 亚洲v日本v欧美v久久精品| 中文字幕一区视频| 国产无人区一区二区三区| 欧美xxxxxxxx| 欧美一级理论性理论a| 欧美午夜免费电影| 色综合天天做天天爱| 99久久777色| av电影天堂一区二区在线观看| 国内精品国产成人国产三级粉色 | 亚洲午夜免费视频| 国产精品少妇自拍| 国产日韩成人精品| 久久久美女毛片| 精品盗摄一区二区三区| 日韩一区二区三区四区| 7777精品伊人久久久大香线蕉最新版| 一本色道久久综合亚洲精品按摩| 高清不卡一区二区在线| 懂色av一区二区三区蜜臀| 国产在线观看一区二区| 国产一区二区三区四区五区入口 | 在线视频一区二区免费| 91在线观看下载| 一本色道久久综合亚洲精品按摩| 91女厕偷拍女厕偷拍高清| 色婷婷综合久久久| 欧美日韩中字一区| 7799精品视频| 欧美大胆一级视频| 久久只精品国产| 国产精品美女一区二区三区| 国产精品成人一区二区艾草| 亚洲乱码一区二区三区在线观看| 一区二区在线观看免费| 亚洲最新视频在线播放| 手机精品视频在线观看| 蜜桃久久久久久久| 成人一级视频在线观看| 91激情五月电影| 日韩一区二区三区在线视频| 26uuu国产在线精品一区二区| 久久久久久久久久久久久夜| 国产精品第13页| 亚洲国产wwwccc36天堂| 三级亚洲高清视频| 国精产品一区一区三区mba桃花 | 欧美一区二区三区啪啪| 久久综合成人精品亚洲另类欧美| 中文字幕免费一区| 亚洲一线二线三线视频| 美洲天堂一区二卡三卡四卡视频 | 激情综合网av| 91在线丨porny丨国产| 欧美精品久久一区| 久久久噜噜噜久久人人看 | 一区二区三区在线视频观看| 午夜久久久久久久久久一区二区| 黑人巨大精品欧美一区| 99久久伊人久久99| 日韩丝袜情趣美女图片| 日韩一区欧美一区| 日日嗨av一区二区三区四区| 黄色成人免费在线| 欧美这里有精品| 久久久精品国产免大香伊| 亚洲观看高清完整版在线观看| 国产乱一区二区| 欧美日韩精品一区二区三区 | 久久久一区二区三区| 亚洲一区二区在线免费看| 国产成人欧美日韩在线电影 | 91极品美女在线| 精品对白一区国产伦| 亚洲精品中文在线影院| 国产精品亚洲а∨天堂免在线| 欧美性淫爽ww久久久久无| 欧美国产成人精品| 麻豆极品一区二区三区| 欧美日韩一区二区在线观看 | 色悠悠久久综合| 精品国产成人系列| 石原莉奈在线亚洲二区| 在线观看日韩国产| 国产精品天美传媒| 久久99精品久久久久婷婷| 欧美亚洲另类激情小说| 亚洲欧洲日韩女同| 国产精品白丝jk白祙喷水网站| 在线播放91灌醉迷j高跟美女 | 91精品一区二区三区久久久久久| 久久人人97超碰com| 国产欧美视频一区二区| 亚洲中国最大av网站| 亚洲精品ww久久久久久p站| 最新不卡av在线| 首页国产欧美久久| 在线免费亚洲电影| 国产精品久久久久aaaa樱花| 亚洲图片有声小说| 91视频一区二区三区| 亚洲成人精品影院| 欧美电影免费观看高清完整版| 国产伦精品一区二区三区免费| 国产精品成人网| 欧美精品自拍偷拍| 国产精品一品视频| 亚洲美女视频一区|