📄 ucos.h
字号:
/*
** This header file (together with is companion C source-code file
** "os.c") attempt to abstract the underlying operating system so that
** the eDb library will work on both POSIX and windows systems.
*/
#ifndef _eDb_OS_H_
#define _eDb_OS_H_
#define off_t unsigned int
/*
** Temporary files are named starting with this prefix followed by 16 random
** alphanumeric characters, and no file extension. They are stored in the
** OS's standard temporary file directory, and are deleted prior to exit.
** If eDb is being embedded in another program, you may wish to change the
** prefix to reflect your program's name, so that if your program exits
** prematurely, old temporary files can be easily identified. This can be done
** using -DTEMP_FILE_PREFIX=myprefix_ on the compiler command line.
*/
#ifndef TEMP_FILE_PREFIX
#define TEMP_FILE_PREFIX "eDb_"
#endif
typedef struct OsFile OsFile;
struct OsFile {
FILE *h; /* Handle for accessing the file */
int locked; /* 0: unlocked, <0: write lock, >0: read lock */
};
#define MAX_PATH 50
#define eDb_TEMPNAME_SIZE (MAX_PATH+50)
#define eDb_MIN_SLEEP_MS 1
int eDbOsDelete(const char*);
int eDbOsFileExists(const char*);
int eDbOsFileRename(const char*, const char*);
int eDbOsOpenReadWrite(const char*, OsFile*, int*);
int eDbOsOpenExclusive(const char*, OsFile*, int);
int eDbOsOpenReadOnly(const char*, OsFile*);
int eDbOsOpenDirectory(const char*, OsFile*);
int eDbOsTempFileName(char*);
int eDbOsClose(OsFile*);
int eDbOsRead(OsFile*, void*, int amt);
int eDbOsWrite(OsFile*, const void*, int amt);
int eDbOsSeek(OsFile*, off_t offset);
int eDbOsSync(OsFile*);
int eDbOsTruncate(OsFile*, off_t size);
int eDbOsFileSize(OsFile*, off_t *pSize);
int eDbOsReadLock(OsFile*);
int eDbOsWriteLock(OsFile*);
int eDbOsUnlock(OsFile*);
int eDbOsRandomSeed(char*);
int eDbOsSleep(int ms);
int eDbOsCurrentTime(double*);
void eDbOsEnterMutex(void);
void eDbOsLeaveMutex(void);
char *eDbOsFullPathname(const char*);
void eDbRandomness(int N, void *pBuf);
#ifndef itoa
char *itoa(int, char *,int);
#endif
#endif /* _eDb_OS_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -