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

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

?? os_os2.c

?? 一個小型嵌入式數據庫SQLite的源碼,C語言
?? C
?? 第 1 頁 / 共 2 頁
字號:
  ** 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.      */      TRACE2( "could not get a PENDING lock. cnt=%d\n", cnt );      DosSleep(1);    }    gotPendingLock = res;  }  /* Acquire a shared lock  */  if( locktype==SHARED_LOCK && res ){    assert( pFile->locktype==NO_LOCK );    res = getReadLock(pFile);    if( res == NO_ERROR ){      newLocktype = SHARED_LOCK;    }  }  /* Acquire a RESERVED lock  */  if( locktype==RESERVED_LOCK && res ){    assert( pFile->locktype==SHARED_LOCK );    LockArea.lOffset = RESERVED_BYTE;    LockArea.lRange = 1L;    UnlockArea.lOffset = 0L;    UnlockArea.lRange = 0L;    res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 1L );    if( res == NO_ERROR ){      newLocktype = RESERVED_LOCK;    }  }  /* Acquire a PENDING lock  */  if( locktype==EXCLUSIVE_LOCK && res ){    newLocktype = PENDING_LOCK;    gotPendingLock = 0;  }  /* Acquire an EXCLUSIVE lock  */  if( locktype==EXCLUSIVE_LOCK && res ){    assert( pFile->locktype>=SHARED_LOCK );    res = unlockReadLock(pFile);    TRACE2( "unreadlock = %d\n", res );    LockArea.lOffset = SHARED_FIRST;    LockArea.lRange = SHARED_SIZE;    UnlockArea.lOffset = 0L;    UnlockArea.lRange = 0L;    res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 1L );    if( res == NO_ERROR ){      newLocktype = EXCLUSIVE_LOCK;    }else{      TRACE2( "error-code = %d\n", res );    }  }  /* If we are holding a PENDING lock that ought to be released, then  ** release it now.  */  if( gotPendingLock && locktype==SHARED_LOCK ){    LockArea.lOffset = 0L;    LockArea.lRange = 0L;    UnlockArea.lOffset = PENDING_BYTE;    UnlockArea.lRange = 1L;    DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 1L );  }  /* Update the state of the lock has held in the file descriptor then  ** return the appropriate result code.  */  if( res == NO_ERROR ){    rc = SQLITE_OK;  }else{    TRACE4( "LOCK FAILED %d trying for %d but got %d\n", pFile->h,           locktype, newLocktype );    rc = SQLITE_BUSY;  }  pFile->locktype = newLocktype;  return rc;}/*** This routine checks if there is a RESERVED lock held on the specified** file by this or any other process. If such a lock is held, return** non-zero, otherwise zero.*/int os2CheckReservedLock( OsFile *id ){  APIRET rc = NO_ERROR;  os2File *pFile = (os2File*)id;  assert( pFile!=0 );  if( pFile->locktype>=RESERVED_LOCK ){    rc = 1;    TRACE3( "TEST WR-LOCK %d %d (local)\n", pFile->h, rc );  }else{    FILELOCK  LockArea,              UnlockArea;    memset(&LockArea, 0, sizeof(LockArea));    memset(&UnlockArea, 0, sizeof(UnlockArea));    LockArea.lOffset = RESERVED_BYTE;    LockArea.lRange = 1L;    UnlockArea.lOffset = 0L;    UnlockArea.lRange = 0L;    rc = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 1L );    if( rc == NO_ERROR ){      LockArea.lOffset = 0L;      LockArea.lRange = 0L;      UnlockArea.lOffset = RESERVED_BYTE;      UnlockArea.lRange = 1L;      rc = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 1L );    }    TRACE3( "TEST WR-LOCK %d %d (remote)\n", pFile->h, rc );  }  return rc;}/*** Lower the locking level on file descriptor id to locktype.  locktype** must be either NO_LOCK or SHARED_LOCK.**** If the locking level of the file descriptor is already at or below** the requested locking level, this routine is a no-op.**** It is not possible for this routine to fail if the second argument** is NO_LOCK.  If the second argument is SHARED_LOCK then this routine** might return SQLITE_IOERR;*/int os2Unlock( OsFile *id, int locktype ){  int type;  APIRET rc = SQLITE_OK;  os2File *pFile = (os2File*)id;  FILELOCK  LockArea,            UnlockArea;  memset(&LockArea, 0, sizeof(LockArea));  memset(&UnlockArea, 0, sizeof(UnlockArea));  assert( pFile!=0 );  assert( locktype<=SHARED_LOCK );  TRACE4( "UNLOCK %d to %d was %d\n", pFile->h, locktype, pFile->locktype );  type = pFile->locktype;  if( type>=EXCLUSIVE_LOCK ){    LockArea.lOffset = 0L;    LockArea.lRange = 0L;    UnlockArea.lOffset = SHARED_FIRST;    UnlockArea.lRange = SHARED_SIZE;    DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 1L );    if( locktype==SHARED_LOCK && getReadLock(pFile) != NO_ERROR ){      /* This should never happen.  We should always be able to      ** reacquire the read lock */      rc = SQLITE_IOERR;    }  }  if( type>=RESERVED_LOCK ){    LockArea.lOffset = 0L;    LockArea.lRange = 0L;    UnlockArea.lOffset = RESERVED_BYTE;    UnlockArea.lRange = 1L;    DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 1L );  }  if( locktype==NO_LOCK && type>=SHARED_LOCK ){    unlockReadLock(pFile);  }  if( type>=PENDING_LOCK ){    LockArea.lOffset = 0L;    LockArea.lRange = 0L;    UnlockArea.lOffset = PENDING_BYTE;    UnlockArea.lRange = 1L;    DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 2000L, 1L );  }  pFile->locktype = locktype;  return rc;}/*** Turn a relative pathname into a full pathname.  Return a pointer** to the full pathname stored in space obtained from sqliteMalloc().** The calling function is responsible for freeing this space once it** is no longer needed.*/char *sqlite3Os2FullPathname( const char *zRelative ){  char *zFull = 0;  if( strchr(zRelative, ':') ){    sqlite3SetString( &zFull, zRelative, (char*)0 );  }else{    char zBuff[SQLITE_TEMPNAME_SIZE - 2] = {0};    char zDrive[1] = {0};    ULONG cbzFullLen = SQLITE_TEMPNAME_SIZE;    ULONG ulDriveNum = 0;    ULONG ulDriveMap = 0;    DosQueryCurrentDisk( &ulDriveNum, &ulDriveMap );    DosQueryCurrentDir( 0L, zBuff, &cbzFullLen );    zFull = sqliteMalloc( cbzFullLen );    sprintf( zDrive, "%c", (char)('A' + ulDriveNum - 1) );    sqlite3SetString( &zFull, zDrive, ":\\", zBuff, "\\", zRelative, (char*)0 );  }  return zFull;}/*** The fullSync option is meaningless on os2, or correct me if I'm wrong.  This is a no-op.** From os_unix.c: Change the value of the fullsync flag in the given file descriptor.** From os_unix.c: ((unixFile*)id)->fullSync = v;*/static void os2SetFullSync( OsFile *id, int v ){  return;}/*** Return the underlying file handle for an OsFile*/static int os2FileHandle( OsFile *id ){  return (int)((os2File*)id)->h;}/*** Return an integer that indices the type of lock currently held** by this handle.  (Used for testing and analysis only.)*/static int os2LockState( OsFile *id ){  return ((os2File*)id)->locktype;}/*** This vector defines all the methods that can operate on an OsFile** for os2.*/static const IoMethod sqlite3Os2IoMethod = {  os2Close,  os2OpenDirectory,  os2Read,  os2Write,  os2Seek,  os2Truncate,  os2Sync,  os2SetFullSync,  os2FileHandle,  os2FileSize,  os2Lock,  os2Unlock,  os2LockState,  os2CheckReservedLock,};/*** Allocate memory for an OsFile.  Initialize the new OsFile** to the value given in pInit and return a pointer to the new** OsFile.  If we run out of memory, close the file and return NULL.*/int allocateOs2File( os2File *pInit, OsFile **pld ){  os2File *pNew;  pNew = sqliteMalloc( sizeof(*pNew) );  if( pNew==0 ){    DosClose( pInit->h );    *pld = 0;    return SQLITE_NOMEM;  }else{    *pNew = *pInit;    pNew->pMethod = &sqlite3Os2IoMethod;    pNew->locktype = NO_LOCK;    *pld = (OsFile*)pNew;    OpenCounter(+1);    return SQLITE_OK;  }}#endif /* SQLITE_OMIT_DISKIO *//***************************************************************************** Everything above deals with file I/O.  Everything that follows deals** with other miscellanous aspects of the operating system interface****************************************************************************//*** Get information to seed the random number generator.  The seed** is written into the buffer zBuf[256].  The calling function must** supply a sufficiently large buffer.*/int sqlite3Os2RandomSeed( char *zBuf ){  /* We have to initialize zBuf to prevent valgrind from reporting  ** errors.  The reports issued by valgrind are incorrect - we would  ** prefer that the randomness be increased by making use of the  ** uninitialized space in zBuf - but valgrind errors tend to worry  ** some users.  Rather than argue, it seems easier just to initialize  ** the whole array and silence valgrind, even if that means less randomness  ** in the random seed.  **  ** When testing, initializing zBuf[] to zero is all we do.  That means  ** that we always use the same random number sequence. This makes the  ** tests repeatable.  */  memset( zBuf, 0, 256 );  DosGetDateTime( (PDATETIME)zBuf );  return SQLITE_OK;}/*** Sleep for a little while.  Return the amount of time slept.*/int sqlite3Os2Sleep( int ms ){  DosSleep( ms );  return ms;}/*** Static variables used for thread synchronization*/static int inMutex = 0;#ifdef SQLITE_OS2_THREADSstatic ULONG mutexOwner;#endif/*** The following pair of routines implement mutual exclusion for** multi-threaded processes.  Only a single thread is allowed to** executed code that is surrounded by EnterMutex() and LeaveMutex().**** SQLite uses only a single Mutex.  There is not much critical** code and what little there is executes quickly and without blocking.*/void sqlite3Os2EnterMutex(){  PTIB ptib;#ifdef SQLITE_OS2_THREADS  DosEnterCritSec();  DosGetInfoBlocks( &ptib, NULL );  mutexOwner = ptib->tib_ptib2->tib2_ultid;#endif  assert( !inMutex );  inMutex = 1;}void sqlite3Os2LeaveMutex(){  PTIB ptib;  assert( inMutex );  inMutex = 0;#ifdef SQLITE_OS2_THREADS  DosGetInfoBlocks( &ptib, NULL );  assert( mutexOwner == ptib->tib_ptib2->tib2_ultid );  DosExitCritSec();#endif}/*** Return TRUE if the mutex is currently held.**** If the thisThreadOnly parameter is true, return true if and only if the** calling thread holds the mutex.  If the parameter is false, return** true if any thread holds the mutex.*/int sqlite3Os2InMutex( int thisThreadOnly ){#ifdef SQLITE_OS2_THREADS  PTIB ptib;  DosGetInfoBlocks( &ptib, NULL );  return inMutex>0 && (thisThreadOnly==0 || mutexOwner==ptib->tib_ptib2->tib2_ultid);#else  return inMutex>0;#endif}/*** The following variable, if set to a non-zero value, becomes the result** returned from sqlite3OsCurrentTime().  This is used for testing.*/#ifdef SQLITE_TESTint sqlite3_current_time = 0;#endif/*** Find the current time (in Universal Coordinated Time).  Write the** current time and date as a Julian Day number into *prNow and** return 0.  Return 1 if the time and date cannot be found.*/int sqlite3Os2CurrentTime( double *prNow ){  double now;  USHORT second, minute, hour,         day, month, year;  DATETIME dt;  DosGetDateTime( &dt );  second = (USHORT)dt.seconds;  minute = (USHORT)dt.minutes + dt.timezone;  hour = (USHORT)dt.hours;  day = (USHORT)dt.day;  month = (USHORT)dt.month;  year = (USHORT)dt.year;  /* Calculations from http://www.astro.keele.ac.uk/~rno/Astronomy/hjd.html     http://www.astro.keele.ac.uk/~rno/Astronomy/hjd-0.1.c */  /* Calculate the Julian days */  now = day - 32076 +    1461*(year + 4800 + (month - 14)/12)/4 +    367*(month - 2 - (month - 14)/12*12)/12 -    3*((year + 4900 + (month - 14)/12)/100)/4;  /* Add the fractional hours, mins and seconds */  now += (hour + 12.0)/24.0;  now += minute/1440.0;  now += second/86400.0;  *prNow = now;#ifdef SQLITE_TEST  if( sqlite3_current_time ){    *prNow = sqlite3_current_time/86400.0 + 2440587.5;  }#endif  return 0;}/*** Remember the number of thread-specific-data blocks allocated.** Use this to verify that we are not leaking thread-specific-data.** Ticket #1601*/#ifdef SQLITE_TESTint sqlite3_tsd_count = 0;# define TSD_COUNTER_INCR InterlockedIncrement( &sqlite3_tsd_count )# define TSD_COUNTER_DECR InterlockedDecrement( &sqlite3_tsd_count )#else# define TSD_COUNTER_INCR  /* no-op */# define TSD_COUNTER_DECR  /* no-op */#endif/*** If called with allocateFlag>1, then return a pointer to thread** specific data for the current thread.  Allocate and zero the** thread-specific data if it does not already exist necessary.**** If called with allocateFlag==0, then check the current thread** specific data.  Return it if it exists.  If it does not exist,** then return NULL.**** If called with allocateFlag<0, check to see if the thread specific** data is allocated and is all zero.  If it is then deallocate it.** Return a pointer to the thread specific data or NULL if it is** unallocated or gets deallocated.*/ThreadData *sqlite3Os2ThreadSpecificData( int allocateFlag ){  static ThreadData **s_ppTsd = NULL;  static const ThreadData zeroData = {0, 0, 0};  ThreadData *pTsd;  if( !s_ppTsd ){    sqlite3OsEnterMutex();    if( !s_ppTsd ){      PULONG pul;      APIRET rc = DosAllocThreadLocalMemory(1, &pul);      if( rc != NO_ERROR ){        sqlite3OsLeaveMutex();        return 0;      }      s_ppTsd = (ThreadData **)pul;    }    sqlite3OsLeaveMutex();  }  pTsd = *s_ppTsd;  if( allocateFlag>0 ){    if( !pTsd ){      pTsd = sqlite3OsMalloc( sizeof(zeroData) );      if( pTsd ){        *pTsd = zeroData;        *s_ppTsd = pTsd;        TSD_COUNTER_INCR;      }    }  }else if( pTsd!=0 && allocateFlag<0              && memcmp( pTsd, &zeroData, sizeof(ThreadData) )==0 ){    sqlite3OsFree(pTsd);    *s_ppTsd = NULL;    TSD_COUNTER_DECR;    pTsd = 0;  }  return pTsd;}#endif /* OS_OS2 */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人综合自拍| 一区二区三区免费观看| 欧美mv和日韩mv的网站| 国产老肥熟一区二区三区| 日韩国产一区二| 亚洲综合色网站| 久久精品国产99国产| 波多野结衣91| 国产精品一区二区三区四区| 久久这里只有精品6| 亚洲在线中文字幕| 国产精品一二三区| 91精品国产色综合久久ai换脸| 色综合中文字幕国产 | 免费看日韩a级影片| 99久久精品国产导航| 欧美精品一区二区三区蜜桃 | 久久久高清一区二区三区| 亚洲国产cao| 日韩电影在线免费看| 欧美一二三四在线| 午夜精品久久久久久久99樱桃| 国产91色综合久久免费分享| 欧美肥妇free| 亚洲激情在线激情| 成人午夜精品一区二区三区| 国产精品系列在线观看| 国产欧美日韩中文久久| 国产精品久久久久久久久久免费看| 亚洲国产精品自拍| 精品国产乱码久久久久久久| 99久久久久免费精品国产| 亚洲国产日韩综合久久精品| 色综合久久综合网欧美综合网| 欧美日韩中文国产| 夜夜操天天操亚洲| 久久夜色精品国产欧美乱极品| 日韩成人一级大片| 欧美日韩国产精选| 视频一区在线播放| 狠狠狠色丁香婷婷综合久久五月| 51午夜精品国产| 天堂av在线一区| 中文字幕精品一区二区精品绿巨人 | 亚洲成人动漫在线观看| 日本精品裸体写真集在线观看| 中文字幕日韩欧美一区二区三区| 日韩主播视频在线| 日本一区二区不卡视频| 欧美一区三区二区| 欧美亚洲国产一卡| 五月天一区二区| 欧美精品久久天天躁| 蜜臀av性久久久久蜜臀aⅴ流畅 | 精品国产精品网麻豆系列| 色吧成人激情小说| 成人国产免费视频| 依依成人综合视频| 欧美国产成人在线| 色婷婷亚洲一区二区三区| 亚洲制服丝袜一区| 91麻豆精品国产| 欧美三级中文字幕| 久久99九九99精品| 国产精品美女一区二区在线观看| 午夜私人影院久久久久| 中文字幕亚洲不卡| 欧美日韩日日骚| 欧美制服丝袜第一页| 综合色天天鬼久久鬼色| 国产在线精品一区二区不卡了 | 三级不卡在线观看| 精品国产麻豆免费人成网站| 91精品国产福利| 在线不卡欧美精品一区二区三区| 在线观看成人免费视频| 精品一区二区国语对白| 国产精品伦一区二区三级视频| 欧洲生活片亚洲生活在线观看| 91麻豆成人久久精品二区三区| 日韩电影一区二区三区四区| 欧美激情一区二区三区四区| 欧美午夜寂寞影院| 国产精品一二三四五| 丝袜诱惑亚洲看片| 国产精品的网站| 欧美一级日韩免费不卡| 欧美大肚乱孕交hd孕妇| 日本精品一级二级| 欧美在线观看视频在线| 欧美日韩一区二区三区四区| 69堂精品视频| 精品国产乱码久久久久久1区2区 | 亚洲综合av网| 精品国产髙清在线看国产毛片| 日韩一区二区三区在线| 日韩欧美在线一区二区三区| 欧美不卡视频一区| 欧美激情一二三区| 精品第一国产综合精品aⅴ| 久久久噜噜噜久久中文字幕色伊伊| 2020国产精品久久精品美国| 亚洲国产精品高清| 久久综合给合久久狠狠狠97色69| 国产日韩一级二级三级| 亚洲视频免费看| 丝袜美腿亚洲一区二区图片| 亚洲综合成人网| 久久99精品久久久久久动态图| 成人一区二区三区在线观看 | 一区二区三区在线视频观看| 日韩黄色片在线观看| 一区二区三区中文字幕| 免费高清成人在线| 成人黄色小视频在线观看| 国内精品免费**视频| 99久久精品情趣| 欧美日韩国产中文| 欧美国产精品中文字幕| 亚洲国产日韩在线一区模特 | 91丝袜美腿高跟国产极品老师 | 免费日韩伦理电影| www.在线欧美| 成人午夜大片免费观看| 欧美视频一区在线| 国产午夜精品一区二区三区嫩草 | 欧洲一区在线观看| 久久综合999| www激情久久| 国产日产欧美一区二区三区 | 精品欧美一区二区三区精品久久| 欧美精品在线观看播放| 国产日韩欧美电影| 日精品一区二区| 91色综合久久久久婷婷| 久久综合色天天久久综合图片| 久久综合久久综合久久综合| 久久婷婷国产综合国色天香| 久久久www免费人成精品| 午夜视频在线观看一区二区三区| 成人av免费在线观看| 91免费版在线| 欧美日韩视频第一区| 国产精品青草综合久久久久99| 美国精品在线观看| 国产成人亚洲综合a∨猫咪| 欧美剧情片在线观看| 亚洲免费av在线| 久久久91精品国产一区二区精品 | 日韩小视频在线观看专区| 欧美一区二区三区喷汁尤物| 精品va天堂亚洲国产| 亚洲一区在线观看网站| 色综合久久66| 中文字幕一区在线观看视频| 国产一区二区三区高清播放| 日韩一区二区三免费高清| 久久婷婷色综合| 激情综合网av| 日韩免费在线观看| 日本va欧美va精品| 69堂成人精品免费视频| 亚洲va天堂va国产va久| 精品系列免费在线观看| 日韩一级免费观看| ●精品国产综合乱码久久久久| 国产一区二区三区久久久| 欧美变态口味重另类| 亚洲精选免费视频| 狠狠色综合色综合网络| 91丨国产丨九色丨pron| 综合网在线视频| 欧美午夜宅男影院| 久久久国产精品麻豆| 亚洲国产精品久久久久婷婷884 | 亚洲卡通动漫在线| 欧洲在线/亚洲| 三级在线观看一区二区| 欧美成人一区二区三区| 国产一区激情在线| 国产欧美1区2区3区| 婷婷中文字幕一区三区| 777久久久精品| 久久国产成人午夜av影院| 国产日韩欧美在线一区| av在线一区二区三区| 精品国产污污免费网站入口 | 狠狠色综合播放一区二区| 久久午夜羞羞影院免费观看| 成人性生交大片免费看中文| 日韩理论片中文av| 国产成人三级在线观看| 国产精品丝袜一区| 欧美日韩一级大片网址| 日本aⅴ精品一区二区三区| 欧美日韩色一区| 樱花草国产18久久久久| 日韩三级电影网址| 日日摸夜夜添夜夜添国产精品| 26uuu亚洲综合色|