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

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

?? ucos.c

?? 在VC6環(huán)境下開發(fā)
?? C
字號(hào):
/*
** This file contains code that is specific to particular operating
** systems.  The purpose of this file is to provide a uniform abstraction
** on which the rest of eDb can operate.
*/

#include "eDbInit.h"
/*
** Macros for performance tracing.  Normally turned off
*/
#define TIMER_START
#define TIMER_END
#define SEEK(X)
#define TRACE1(X)
#define TRACE2(X,Y)
#define TRACE3(X,Y,Z)
#define TRACE4(X,Y,Z,A)
#define TRACE5(X,Y,Z,A,B)

/*
** If we compile with the eDb_TEST macro set, then the following block
** of code will give us the ability to simulate a disk I/O error.  This
** is used for testing the I/O recovery logic.
*/
#ifdef eDb_TEST
int eDb_io_error_pending = 0;
#define SimulateIOError(A)  \
   if( eDb_io_error_pending ) \
     if( eDb_io_error_pending-- == 1 ){ local_ioerr(); return A; }
static void local_ioerr(){
  eDb_io_error_pending = 0;  /* Really just a place to set a breakpoint */
}
#else
#define SimulateIOError(A)
#endif

/*
** When testing, keep a count of the number of open files.
*/
#ifdef eDb_TEST
int eDb_open_file_count = 0;
#define OpenCounter(X)  eDb_open_file_count+=(X)
#else
#define OpenCounter(X)
#endif


/*
** Delete the named file
*/
int eDbOsDelete(const char *zFilename){
	DeleteFile((char *)zFilename);
	return eDb_OK;
}

/*
** Return TRUE if the named file exists.
*/
int eDbOsFileExists(const char *zFilename){
	return FileExist((char *)zFilename);
}

/*
** Attempt to open a file for both reading and writing.  If that
** fails, try opening it read-only.  If the file does not exist,
** try to create it.
**
** On success, a handle for the open file is written to *id
** and *pReadonly is set to 0 if the file was opened for reading and
** writing or 1 if the file was opened read-only.  The function returns
** eDb_OK.
**
** On failure, the function returns eDb_CANTOPEN and leaves
** *id and *pReadonly unchanged.
*/
int eDbOsOpenReadWrite(const char *zFilename,OsFile *id,int *pReadonly){	
	if(FileExist((char *)zFilename) == 0){
		CreateFile((char *)zFilename);
	}
	id->h = OpenFile((char *)zFilename,FILEMODE_READ|FILEMODE_WRITE);
	id->locked = 0;
	*pReadonly = 0;
	return eDb_OK;
}


/*
** Attempt to open a new file for exclusive access by this process.
** The file will be opened for both reading and writing.  To avoid
** a potential security problem, we do not allow the file to have
** previously existed.  Nor do we allow the file to be a symbolic
** link.
**
** If delFlag is true, then make arrangements to automatically delete
** the file when it is closed.
**
** On success, write the file handle into *id and return eDb_OK.
**
** On failure, return eDb_CANTOPEN.
*/
int eDbOsOpenExclusive(const char *zFilename, OsFile *id, int delFlag){	
	if(FileExist((char *)zFilename) == 0){
		CreateFile((char *)zFilename);
	}
	id->h = OpenFile((char *)zFilename,FILEMODE_READ|FILEMODE_WRITE);
	id->locked = 0;
	delFlag = delFlag;
	return eDb_OK;
}

/*
** Attempt to open a new file for read-only access.
**
** On success, write the file handle into *id and return eDb_OK.
**
** On failure, return eDb_CANTOPEN.
*/
int eDbOsOpenReadOnly(const char *zFilename, OsFile *id){
	if(FileExist((char *)zFilename) == 0){
		CreateFile((char *)zFilename);
	}
	id->h = OpenFile((char *)zFilename,FILEMODE_READ);
	id->locked = 0;
	return eDb_OK;
}

/*
** Attempt to open a file descriptor for the directory that contains a
** file.  This file descriptor can be used to fsync() the directory
** in order to make sure the creation of a new file is actually written
** to disk.
**
** This routine is only meaningful for Unix.  It is a no-op under
** windows since windows does not support hard links.
**
** On success, a handle for a previously open file is at *id is
** updated with the new directory file descriptor and eDb_OK is
** returned.
**
** On failure, the function returns eDb_CANTOPEN and leaves
** *id unchanged.
*/
int eDbOsOpenDirectory(const char *zDirname,OsFile *id){
	return eDb_OK;
}

/*
** Create a temporary file name in zBuf.  zBuf must be big enough to
** hold at least eDb_TEMPNAME_SIZE characters.
*/
void eDbRandomness(int N, void *pBuf);
int eDbOsTempFileName(char *zBuf){

	return eDb_OK; 
}

/*
** Close a file.
*/
int eDbOsClose(OsFile *id){
	CloseFile(id->h);
	id->locked = 0;
	return eDb_OK;
}

/*
** Read data from a file into a buffer.  Return eDb_OK if all
** bytes were read successfully and eDb_IOERR if anything goes
** wrong.
*/
int eDbOsRead(OsFile *id, void *pBuf, int amt){
	int n = ReadFile(id->h,(u8 *)pBuf,amt);
	if(n == amt)
		return eDb_OK;
	else
		return eDb_ERROR;
}

/*
** Write data from a buffer into a file.  Return eDb_OK on success
** or some other error code on failure.
*/
int eDbOsWrite(OsFile *id, const void *pBuf, int amt){	
	int n = WriteFile(id->h,(u8 *)pBuf,amt);
	if(n == amt)
		return eDb_OK;
	else
		return eDb_ERROR;
}

/*
** Move the read/write pointer in a file.
*/
int eDbOsSeek(OsFile *id, off_t offset){
	SeekFile(id->h,offset,FILESEEK_SET);
	return eDb_OK;
}

/*
** Make sure all writes to a particular file are committed to disk.
**
** Under Unix, also make sure that the directory entry for the file
** has been created by fsync-ing the directory that contains the file.
** If we do not do this and we encounter a power failure, the directory
** entry for the journal might not exist after we reboot.  The next
** eDb to access the file will not know that the journal exists (because
** the directory entry for the journal was never created) and the transaction
** will not roll back - possibly leading to database corruption.
*/
int eDbOsSync(OsFile *id){
	FlushFile(id->h);
	return eDb_OK;
}

/*
** Truncate an open file to a specified size
*/
int eDbOsTruncate(OsFile *id, off_t nByte){
	return eDb_OK;
}

/*
** Determine the current size of a file in bytes
*/
int eDbOsFileSize(OsFile *id, off_t *pSize){
	*pSize = FileSize(id->h);
	return eDb_OK;
}
int eDbOsReadLock(OsFile *id){
	return eDb_OK;
}

/*
** Change the lock status to be an exclusive or write lock.  Return
** eDb_OK on success and eDb_BUSY on a failure.  If this
** library was compiled with large file support (LFS) but LFS is not
** available on the host, then an eDb_NOLFS is returned.
*/
int eDbOsWriteLock(OsFile *id){	
	return eDb_OK;
}

/*
** Unlock the given file descriptor.  If the file descriptor was
** not previously locked, then this routine is a no-op.  If this
** library was compiled with large file support (LFS) but LFS is not
** available on the host, then an eDb_NOLFS is returned.
*/
int eDbOsUnlock(OsFile *id){	
	return eDb_OK;
}

/*
** 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 eDbOsRandomSeed(char *zBuf){
	int i;
	for(i=0;i<256;i++)
		zBuf[i] = i%128;
	return eDb_OK;
}

/*
** Sleep for a little while.  Return the amount of time slept.
*/
int eDbOsSleep(int ms){
	return ms;
}

/*
** Static variables used for thread synchronization
*/
static int inMutex = 0;
void eDbOsEnterMutex(){
	inMutex = 1;
}
void eDbOsLeaveMutex(){
	inMutex = 0;
}

/*
** Turn a relative pathname into a full pathname.  Return a pointer
** to the full pathname stored in space obtained from eDbMalloc().
** The calling function is responsible for freeing this space once it
** is no longer needed.
*/
char *eDbOsFullPathname(const char *zRelative){	
	char *pName = eDbStrDup(zRelative);
	return pName;	
}

/*
** The following variable, if set to a now-zero value, become the result
** returned from eDbOsCurrentTime().  This is used for testing.
*/
#ifdef eDb_TEST
	int eDb_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 eDbOsCurrentTime(double *prNow){
	return 0;
}


/*
** Get a single 8-bit random value from the RC4 PRNG.  The Mutex
** must be held while executing this routine.
**
** Why not just use a library random generator like lrand48() for this?
** Because the OP_NewRecno opcode in the VDBE depends on having a very
** good source of random numbers.  The lrand48() library function may
** well be good enough.  But maybe not.  Or maybe lrand48() has some
** subtle problems on some systems that could cause problems.  It is hard
** to know.  To minimize the risk of problems due to bad lrand48()
** implementations, eDb uses this random number generator based
** on RC4, which we know works very well.
*/
static int randomByte(){
	unsigned char t;

  /* All threads share a single random number generator.
  ** This structure is the current state of the generator.
  */
	static struct {
		unsigned char isInit;          /* True if initialized */
		unsigned char i, j;            /* State variables */
		unsigned char s[256];          /* State variables */
	} prng;

  /* Initialize the state of the random number generator once,
  ** the first time this routine is called.  The seed value does
  ** not need to contain a lot of randomness since we are not
  ** trying to do secure encryption or anything like that...
  **
  ** Nothing in this file or anywhere else in eDb does any kind of
  ** encryption.  The RC4 algorithm is being used as a PRNG (pseudo-random
  ** number generator) not as an encryption device.
  */
	if( !prng.isInit ){
		int i;
		char k[256];
		prng.j = 0;
		prng.i = 0;
		eDbOsRandomSeed(k);
		for(i=0; i<256; i++){
			prng.s[i] = i;
		}
		for(i=0; i<256; i++){
			prng.j += prng.s[i] + k[i];
			t = prng.s[prng.j];
			prng.s[prng.j] = prng.s[i];
			prng.s[i] = t;
		}
		prng.isInit = 1;
	}

	/* Generate and return single random byte
	*/
	prng.i++;
	t = prng.s[prng.i];
	prng.j += t;
	prng.s[prng.i] = prng.s[prng.j];
	prng.s[prng.j] = t;
	t += prng.s[prng.i];
	return prng.s[t];
}

/*
** Return N random bytes.
*/
void eDbRandomness(int N, void *pBuf){
	unsigned char *zBuf = pBuf;
	eDbOsEnterMutex();
	while( N-- ){
		*(zBuf++) = randomByte();
	}
	eDbOsLeaveMutex();
}

#ifndef itoa
char *itoa(int n, char *str,int rad){
	extern int sprintf(char *str,const char *format,...);
	switch(rad){
		case 10:
			sprintf(str,"%d",n);
			break;
		case 16:
			sprintf(str,"%x",n);
			break;
		case 8:
			sprintf(str,"%o",n);
			break;
		default:
			sprintf(str,"%d",n);			
	}
	
	return 0;
}
#endif

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91香蕉视频在线| 欧美在线综合视频| 午夜激情久久久| 国产欧美日韩另类视频免费观看| 在线观看不卡一区| 国产精品一卡二| 天天综合网 天天综合色| 国产日韩欧美不卡在线| 9191成人精品久久| 欧洲精品一区二区| 成人丝袜18视频在线观看| 蜜桃免费网站一区二区三区| 自拍偷拍国产精品| 国产色婷婷亚洲99精品小说| 欧美一区日韩一区| 日本二三区不卡| 国产激情视频一区二区在线观看 | 成人app下载| 免费在线观看成人| 亚洲国产精品人人做人人爽| 国产精品夫妻自拍| 中文字幕久久午夜不卡| 精品免费一区二区三区| 欧美日韩dvd在线观看| 91片在线免费观看| 99久久夜色精品国产网站| 国产高清不卡一区二区| 精品夜夜嗨av一区二区三区| 日韩二区三区在线观看| 亚洲一二三区视频在线观看| 亚洲欧洲综合另类| 亚洲欧美另类图片小说| 国产精品丝袜一区| 精品国产制服丝袜高跟| 欧美三级日韩三级| 91小视频免费看| 亚洲永久精品大片| 亚洲精品免费在线| 最新国产の精品合集bt伙计| 久久你懂得1024| 日韩精品一区二区三区swag| 欧美色网站导航| 成人a免费在线看| 豆国产96在线|亚洲| 国产乱码精品一品二品| 国产曰批免费观看久久久| 日本va欧美va欧美va精品| 亚洲成人动漫av| 久久久精品中文字幕麻豆发布| 欧美综合久久久| 国产一区二区0| 国产美女视频91| 国产在线不卡一区| 国产福利不卡视频| 国产精品综合av一区二区国产馆| 六月婷婷色综合| 久久99国产精品麻豆| 久久国产免费看| 国内精品写真在线观看| 国产伦精品一区二区三区视频青涩 | 国产女同互慰高潮91漫画| 91精品国产aⅴ一区二区| 日本丰满少妇一区二区三区| 成人手机电影网| 99国产精品国产精品久久| 成人av在线资源网| 99re8在线精品视频免费播放| 不卡的av网站| 97精品国产露脸对白| 日本韩国欧美在线| 欧美日韩精品免费观看视频| 欧美日韩成人一区二区| 欧美电影精品一区二区| 日韩免费看网站| 中文字幕va一区二区三区| 国产精品美女久久久久久久久| 亚洲天堂精品在线观看| 亚洲国产综合色| 免费成人深夜小野草| 国产美女娇喘av呻吟久久| 成人黄页毛片网站| 欧美私人免费视频| 日韩美女主播在线视频一区二区三区| 欧美一区二区成人| 国产亚洲1区2区3区| 国产女人18水真多18精品一级做| 国产视频一区二区三区在线观看| 久久久精品一品道一区| 国产精品污www在线观看| 一区二区三区日韩在线观看| 毛片不卡一区二区| 高清不卡一区二区| 在线观看视频一区| 久久天堂av综合合色蜜桃网| 亚洲欧美在线视频| 亚洲超丰满肉感bbw| 九九视频精品免费| 91免费视频网| 91精品国产综合久久精品app| 精品日韩在线观看| 一区二区三区免费网站| 日韩av电影免费观看高清完整版在线观看 | 一区二区不卡在线播放 | 麻豆成人久久精品二区三区红 | 亚洲曰韩产成在线| 国产一区二区三区在线观看免费 | 黄色精品一二区| 成人av资源在线观看| 91麻豆精品国产自产在线观看一区| 国产亚洲精品7777| 日日摸夜夜添夜夜添精品视频 | 国产sm精品调教视频网站| 欧美色图免费看| 日本一区二区三区在线观看| 亚洲自拍都市欧美小说| 国产成a人亚洲| 91麻豆精品国产91久久久久| 中文字幕不卡的av| 国产自产2019最新不卡| 91玉足脚交白嫩脚丫在线播放| 精品国偷自产国产一区| 久久久美女毛片| 亚洲国产日韩在线一区模特| 国产精品亚洲第一| 制服丝袜亚洲精品中文字幕| 国产精品久久三| 偷窥少妇高潮呻吟av久久免费| 国产成人av网站| 欧美一区二区视频在线观看2022| 国产精品网曝门| 国产一区欧美日韩| 欧美日韩成人综合| 亚洲午夜日本在线观看| 色呦呦日韩精品| 中文在线一区二区| 久久精品国产一区二区三 | 91精品在线观看入口| 亚洲激情av在线| 不卡欧美aaaaa| 国产精品美女久久久久久久久| 亚洲成av人综合在线观看| 97se亚洲国产综合自在线不卡 | 久久精品99国产精品日本| 91福利视频网站| 国产精品麻豆欧美日韩ww| 国产一区二区在线观看免费| 精品欧美黑人一区二区三区| 麻豆中文一区二区| 在线视频观看一区| 亚洲精品国产无天堂网2021| 成人综合在线观看| 中文天堂在线一区| 成人美女视频在线看| 国产精品美女久久福利网站| va亚洲va日韩不卡在线观看| 国产精品每日更新| 92国产精品观看| 国产三级久久久| 国产精品99久久久久久久女警| 欧洲中文字幕精品| 亚洲综合一二区| 欧美性感一类影片在线播放| 一区二区三区国产豹纹内裤在线| 欧美性一区二区| 首页亚洲欧美制服丝腿| 精品女同一区二区| 粉嫩av一区二区三区在线播放| 国产午夜精品久久久久久久 | 亚洲视频一二区| 色综合欧美在线视频区| 亚洲一区成人在线| 日韩一级完整毛片| 韩国一区二区三区| 精品久久五月天| 成人精品一区二区三区中文字幕 | 欧美一级久久久久久久大片| 视频一区欧美精品| 欧美精品一区二区三区一线天视频| 国产综合久久久久久鬼色 | 成人a级免费电影| 亚洲伦在线观看| 欧美日韩高清影院| 国产一区二区精品久久99| 久久久久久久久岛国免费| 不卡一区中文字幕| 亚洲成a人在线观看| 欧美肥妇bbw| 国产精品一区二区免费不卡| 中文字幕在线不卡一区| 91精品综合久久久久久| 国产精品99久久久久久宅男| 亚洲视频一区二区在线| 欧美日韩在线免费视频| 国产剧情一区在线| 亚洲一区二区三区四区在线 | 精品国产乱码久久久久久牛牛| 国产成人欧美日韩在线电影| 一区二区三区成人在线视频| 精品国产乱子伦一区| 色视频欧美一区二区三区|