Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
7442414a
R
rt-thread
项目概览
BaiXuePrincess
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
7442414a
编写于
12月 22, 2013
作者:
G
geniusgogo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ARMCC complier is usable.
上级
26e0137f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
220 addition
and
35 deletion
+220
-35
components/external/SQLite-3.8.1/SQLiteLib/sqlite3.c
components/external/SQLite-3.8.1/SQLiteLib/sqlite3.c
+143
-18
components/external/SQLite-3.8.1/src/os_rtthread.c
components/external/SQLite-3.8.1/src/os_rtthread.c
+77
-17
未找到文件。
components/external/SQLite-3.8.1/SQLiteLib/sqlite3.c
浏览文件 @
7442414a
...
...
@@ -25,6 +25,71 @@
#ifndef SQLITE_API
# define SQLITE_API
#endif
/************** Begin file sqlite_config_rtthread.h **************************/
#ifndef _SQLITE_CONFIG_RTTHREAD_H_
#define _SQLITE_CONFIG_RTTHREAD_H_
/*
* SQLite compile macro
*/
#ifndef SQLITE_MINIMUM_FILE_DESCRIPTOR
#define SQLITE_MINIMUM_FILE_DESCRIPTOR 0
#endif
#ifndef SQLITE_OMIT_LOAD_EXTENSION
#define SQLITE_OMIT_LOAD_EXTENSION 1
#endif
//#ifndef #define SQLITE_OMIT_WAL
#define SQLITE_OMIT_WAL
//#endif
#ifndef SQLITE_RTTHREAD_NO_WIDE
#define SQLITE_RTTHREAD_NO_WIDE 1
#endif
#ifndef SQLITE_ENABLE_LOCKING_STYLE
#define SQLITE_ENABLE_LOCKING_STYLE 0
#endif
#ifndef SQLITE_DISABLE_LOCKING_STYLE
#define SQLITE_DISABLE_LOCKING_STYLE 1
#endif
#ifndef SQLITE_TEMP_STORE
#define SQLITE_TEMP_STORE 1
#endif
#ifndef SQLITE_THREADSAFE
#define SQLITE_THREADSAFE 1
#endif
#ifndef HAVE_READLINE
#define HAVE_READLINE 0
#endif
#ifndef NDEBUG
#define NDEBUG
#endif
#ifndef _HAVE_SQLITE_CONFIG_H
#define _HAVE_SQLITE_CONFIG_H
#endif
#ifndef BUILD_sqlite
#define BUILD_sqlite
#endif
#ifndef SQLITE_OS_OTHER
#define SQLITE_OS_OTHER 1
#endif
#ifndef SQLITE_OS_RTTHREAD
#define SQLITE_OS_RTTHREAD 1
#endif
#endif
/************** End of sqlite_config_rtthread.h ******************************/
/************** Begin file sqlite3.h *****************************************/
/*
** 2001 September 15
...
...
@@ -22649,6 +22714,7 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){
#if SQLITE_OS_RTTHREAD /* This file is used for rt-thread only */
/* #include <rtthread.h> */
#include <dfs_posix.h>
/*
** Include code that is common to all os_*.c files
...
...
@@ -22863,6 +22929,51 @@ SQLITE_API int sqlite3_open_file_count = 0;
/************** End of os_common.h *******************************************/
/************** Continuing where we left off in os_rtthread.c ****************/
#ifndef RT_USING_NEWLIB
#ifndef EINTR
#define EINTR 4 /* Interrupted system call */
#endif
#ifndef ENOLCK
#define ENOLCK 46 /* No record locks available */
#endif
#ifndef EACCES
#define EACCES 13 /* Permission denied */
#endif
#ifndef EPERM
#define EPERM 1 /* Operation not permitted */
#endif
#ifndef ETIMEDOUT
#define ETIMEDOUT 145 /* Connection timed out */
#endif
#ifndef ENOTCONN
#define ENOTCONN 134 /* Transport endpoint is not connected */
#endif
#if defined(__GNUC__) || defined(__ADSPBLACKFIN__)
int _gettimeofday(struct timeval *tp, void *ignore) __attribute__((weak));
int _gettimeofday(struct timeval *tp, void *ignore)
#elif defined(__CC_ARM)
__weak int _gettimeofday(struct timeval *tp, void *ignore)
#elif defined(__IAR_SYSTEMS_ICC__)
#if __VER__ > 540
__weak
#endif
int _gettimeofday(struct timeval *tp, void *ignore)
#else
int _gettimeofday(struct timeval *tp, void *ignore)
#endif
{
return 0;
}
#endif /* RT_USING_NEWLIB */
/*
** Compiling and using WAL mode requires several APIs that are not
** available in rt-thread.
...
...
@@ -23019,7 +23130,7 @@ static int sqlite3_os_type = 0;
# define SYSCALL sqlite3_syscall_ptr
#endif
#include <dfs_posix.h>
/* #include <dfs_posix.h> */
static int _Access(const char *pathname, int mode)
{
...
...
@@ -23110,10 +23221,10 @@ static struct rtthread_syscall {
#define osFstat ((int(*)(int,struct stat*))aSyscall[5].pCurrent)
{ "read", (sqlite3_syscall_ptr)read, 0 },
#define osRead ((
ssize_
t(*)(int,void*,size_t))aSyscall[6].pCurrent)
#define osRead ((
in
t(*)(int,void*,size_t))aSyscall[6].pCurrent)
{ "write", (sqlite3_syscall_ptr)write, 0 },
#define osWrite ((
ssize_
t(*)(int,const void*,size_t))aSyscall[7].pCurrent)
#define osWrite ((
in
t(*)(int,const void*,size_t))aSyscall[7].pCurrent)
{ "unlink", (sqlite3_syscall_ptr)unlink, 0 },
#define osUnlink ((int(*)(const char*))aSyscall[8].pCurrent)
...
...
@@ -23465,9 +23576,9 @@ static int sqliteErrorFromPosixError(int posixError, int sqliteIOErr) {
return SQLITE_OK;
#endif
case EAGAIN:
case
DFS_STATUS_
EAGAIN:
case ETIMEDOUT:
case EBUSY:
case
DFS_STATUS_
EBUSY:
case EINTR:
case ENOLCK:
/* random NFS retry error, unless during file system support
...
...
@@ -23506,17 +23617,17 @@ static int sqliteErrorFromPosixError(int posixError, int sqliteIOErr) {
/* invalid fd, unless during file system support introspection, in which
* it actually means what it says */
#endif
case EIO:
case EBADF:
case EINVAL:
case
DFS_STATUS_
EIO:
case
DFS_STATUS_
EBADF:
case
DFS_STATUS_
EINVAL:
case ENOTCONN:
case ENODEV:
case ENXIO:
case ENOENT:
case
DFS_STATUS_
ENODEV:
case
DFS_STATUS_
ENXIO:
case
DFS_STATUS_
ENOENT:
#ifdef ESTALE /* ESTALE is not defined on Interix systems */
case ESTALE:
#endif
case ENOSYS:
case
DFS_STATUS_
ENOSYS:
/* these should force the client to close the file and reconnect */
default:
...
...
@@ -23573,11 +23684,14 @@ static void verifyDbFile(rtthreadFile *pFile){
pFile->ctrlFlags |= UNIXFILE_WARNED;
return;
}
#warning " struct \"stat\" has no field \"st_nlink\""
#ifndef RT_USING_SQLITE
if( buf.st_nlink==0 && (pFile->ctrlFlags & UNIXFILE_DELETE)==0 ){
sqlite3_log(SQLITE_WARNING, "file unlinked while open: %s", pFile->zPath);
pFile->ctrlFlags |= UNIXFILE_WARNED;
return;
}
#endif
}
/*
...
...
@@ -23760,7 +23874,7 @@ static int dotlockLock(sqlite3_file *id, int eFileLock) {
if( rc<0 ){
/* failed to open/create the lock directory */
int tErrno = errno;
if( EEXIST == tErrno ){
if(
DFS_STATUS_
EEXIST == tErrno ){
rc = SQLITE_BUSY;
} else {
rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK);
...
...
@@ -23811,11 +23925,11 @@ static int dotlockUnlock(sqlite3_file *id, int eFileLock) {
/* To fully unlock the database, delete the lock file */
assert( eFileLock==NO_LOCK );
rc = osRmdir(zLockFile);
if( rc<0 && errno==ENOTDIR ) rc = osUnlink(zLockFile);
if( rc<0 && errno==
DFS_STATUS_
ENOTDIR ) rc = osUnlink(zLockFile);
if( rc<0 ){
int tErrno = errno;
rc = 0;
if( ENOENT != tErrno ){
if(
DFS_STATUS_
ENOENT != tErrno ){
rc = SQLITE_IOERR_UNLOCK;
}
if( IS_LOCK_ERROR(rc) ){
...
...
@@ -24258,7 +24372,7 @@ static int rtthreadWrite(
SimulateDiskfullError(( wrote=0, amt=1 ));
if( amt>0 ){
if( wrote<0 && pFile->lastErrno!=ENOSPC ){
if( wrote<0 && pFile->lastErrno!=
DFS_STATUS_
ENOSPC ){
/* lastErrno set by seekAndWrite */
return SQLITE_IOERR_WRITE;
}else{
...
...
@@ -25090,7 +25204,7 @@ static int rtthreadOpen(
fd = robust_open(zName, openFlags, openMode);
OSTRACE(("OPENX %-3d %s 0%o\n", fd, zName, openFlags));
if( fd<0 && errno!=EISDIR && isReadWrite && !isExclusive ){
if( fd<0 && errno!=
DFS_STATUS_
EISDIR && isReadWrite && !isExclusive ){
/* Failed to open the file for read/write access. Try read-only. */
flags &= ~(SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE);
openFlags &= ~(O_RDWR|O_CREAT);
...
...
@@ -25148,7 +25262,7 @@ static int rtthreadDelete(
UNUSED_PARAMETER(NotUsed);
SimulateIOError(return SQLITE_IOERR_DELETE);
if( osUnlink(zPath)==(-1) ){
if( errno==ENOENT ){
if( errno==
DFS_STATUS_
ENOENT ){
rc = SQLITE_IOERR_DELETE_NOENT;
}else{
rc = rtthreadLogError(SQLITE_IOERR_DELETE, "unlink", zPath);
...
...
@@ -25179,6 +25293,17 @@ static int rtthreadDelete(
**
** Otherwise return 0.
*/
#ifndef F_OK
# define F_OK 0
#endif
#ifndef R_OK
# define R_OK 4
#endif
#ifndef W_OK
# define W_OK 2
#endif
static int rtthreadAccess(
sqlite3_vfs *NotUsed, /* The VFS containing this xAccess method */
const char *zPath, /* Path of the file to examine */
components/external/SQLite-3.8.1/src/os_rtthread.c
浏览文件 @
7442414a
...
...
@@ -16,12 +16,58 @@
#if SQLITE_OS_RTTHREAD
/* This file is used for rt-thread only */
#include <rtthread.h>
#include <dfs_posix.h>
/*
** Include code that is common to all os_*.c files
*/
#include "os_common.h"
#ifndef RT_USING_NEWLIB
#ifndef EINTR
#define EINTR 4
/* Interrupted system call */
#endif
#ifndef ENOLCK
#define ENOLCK 46
/* No record locks available */
#endif
#ifndef EACCES
#define EACCES 13
/* Permission denied */
#endif
#ifndef EPERM
#define EPERM 1
/* Operation not permitted */
#endif
#ifndef ETIMEDOUT
#define ETIMEDOUT 145
/* Connection timed out */
#endif
#ifndef ENOTCONN
#define ENOTCONN 134
/* Transport endpoint is not connected */
#endif
#if defined(__GNUC__) || defined(__ADSPBLACKFIN__)
int
_gettimeofday
(
struct
timeval
*
tp
,
void
*
ignore
)
__attribute__
((
weak
));
int
_gettimeofday
(
struct
timeval
*
tp
,
void
*
ignore
)
#elif defined(__CC_ARM)
__weak
int
_gettimeofday
(
struct
timeval
*
tp
,
void
*
ignore
)
#elif defined(__IAR_SYSTEMS_ICC__)
#if __VER__ > 540
__weak
#endif
int
_gettimeofday
(
struct
timeval
*
tp
,
void
*
ignore
)
#else
int
_gettimeofday
(
struct
timeval
*
tp
,
void
*
ignore
)
#endif
{
return
0
;
}
#endif
/* RT_USING_NEWLIB */
/*
** Compiling and using WAL mode requires several APIs that are not
** available in rt-thread.
...
...
@@ -269,10 +315,10 @@ static struct rtthread_syscall {
#define osFstat ((int(*)(int,struct stat*))aSyscall[5].pCurrent)
{
"read"
,
(
sqlite3_syscall_ptr
)
read
,
0
},
#define osRead ((
ssize_
t(*)(int,void*,size_t))aSyscall[6].pCurrent)
#define osRead ((
in
t(*)(int,void*,size_t))aSyscall[6].pCurrent)
{
"write"
,
(
sqlite3_syscall_ptr
)
write
,
0
},
#define osWrite ((
ssize_
t(*)(int,const void*,size_t))aSyscall[7].pCurrent)
#define osWrite ((
in
t(*)(int,const void*,size_t))aSyscall[7].pCurrent)
{
"unlink"
,
(
sqlite3_syscall_ptr
)
unlink
,
0
},
#define osUnlink ((int(*)(const char*))aSyscall[8].pCurrent)
...
...
@@ -624,9 +670,9 @@ static int sqliteErrorFromPosixError(int posixError, int sqliteIOErr) {
return SQLITE_OK;
#endif
case
EAGAIN
:
case
DFS_STATUS_
EAGAIN
:
case
ETIMEDOUT
:
case
EBUSY
:
case
DFS_STATUS_
EBUSY
:
case
EINTR
:
case
ENOLCK
:
/* random NFS retry error, unless during file system support
...
...
@@ -665,17 +711,17 @@ static int sqliteErrorFromPosixError(int posixError, int sqliteIOErr) {
/* invalid fd, unless during file system support introspection, in which
* it actually means what it says */
#endif
case
EIO
:
case
EBADF
:
case
EINVAL
:
case
DFS_STATUS_
EIO
:
case
DFS_STATUS_
EBADF
:
case
DFS_STATUS_
EINVAL
:
case
ENOTCONN
:
case
ENODEV
:
case
ENXIO
:
case
ENOENT
:
case
DFS_STATUS_
ENODEV
:
case
DFS_STATUS_
ENXIO
:
case
DFS_STATUS_
ENOENT
:
#ifdef ESTALE
/* ESTALE is not defined on Interix systems */
case
ESTALE
:
#endif
case
ENOSYS
:
case
DFS_STATUS_
ENOSYS
:
/* these should force the client to close the file and reconnect */
default:
...
...
@@ -732,11 +778,14 @@ static void verifyDbFile(rtthreadFile *pFile){
pFile
->
ctrlFlags
|=
UNIXFILE_WARNED
;
return
;
}
#warning " struct \"stat\" has no field \"st_nlink\""
#ifndef RT_USING_SQLITE
if
(
buf
.
st_nlink
==
0
&&
(
pFile
->
ctrlFlags
&
UNIXFILE_DELETE
)
==
0
){
sqlite3_log
(
SQLITE_WARNING
,
"file unlinked while open: %s"
,
pFile
->
zPath
);
pFile
->
ctrlFlags
|=
UNIXFILE_WARNED
;
return
;
}
#endif
}
/*
...
...
@@ -919,7 +968,7 @@ static int dotlockLock(sqlite3_file *id, int eFileLock) {
if
(
rc
<
0
){
/* failed to open/create the lock directory */
int
tErrno
=
errno
;
if
(
EEXIST
==
tErrno
){
if
(
DFS_STATUS_
EEXIST
==
tErrno
){
rc
=
SQLITE_BUSY
;
}
else
{
rc
=
sqliteErrorFromPosixError
(
tErrno
,
SQLITE_IOERR_LOCK
);
...
...
@@ -970,11 +1019,11 @@ static int dotlockUnlock(sqlite3_file *id, int eFileLock) {
/* To fully unlock the database, delete the lock file */
assert
(
eFileLock
==
NO_LOCK
);
rc
=
osRmdir
(
zLockFile
);
if
(
rc
<
0
&&
errno
==
ENOTDIR
)
rc
=
osUnlink
(
zLockFile
);
if
(
rc
<
0
&&
errno
==
DFS_STATUS_
ENOTDIR
)
rc
=
osUnlink
(
zLockFile
);
if
(
rc
<
0
){
int
tErrno
=
errno
;
rc
=
0
;
if
(
ENOENT
!=
tErrno
){
if
(
DFS_STATUS_
ENOENT
!=
tErrno
){
rc
=
SQLITE_IOERR_UNLOCK
;
}
if
(
IS_LOCK_ERROR
(
rc
)
){
...
...
@@ -1417,7 +1466,7 @@ static int rtthreadWrite(
SimulateDiskfullError
((
wrote
=
0
,
amt
=
1
));
if
(
amt
>
0
){
if
(
wrote
<
0
&&
pFile
->
lastErrno
!=
ENOSPC
){
if
(
wrote
<
0
&&
pFile
->
lastErrno
!=
DFS_STATUS_
ENOSPC
){
/* lastErrno set by seekAndWrite */
return
SQLITE_IOERR_WRITE
;
}
else
{
...
...
@@ -2249,7 +2298,7 @@ static int rtthreadOpen(
fd
=
robust_open
(
zName
,
openFlags
,
openMode
);
OSTRACE
((
"OPENX %-3d %s 0%o
\n
"
,
fd
,
zName
,
openFlags
));
if
(
fd
<
0
&&
errno
!=
EISDIR
&&
isReadWrite
&&
!
isExclusive
){
if
(
fd
<
0
&&
errno
!=
DFS_STATUS_
EISDIR
&&
isReadWrite
&&
!
isExclusive
){
/* Failed to open the file for read/write access. Try read-only. */
flags
&=
~
(
SQLITE_OPEN_READWRITE
|
SQLITE_OPEN_CREATE
);
openFlags
&=
~
(
O_RDWR
|
O_CREAT
);
...
...
@@ -2307,7 +2356,7 @@ static int rtthreadDelete(
UNUSED_PARAMETER
(
NotUsed
);
SimulateIOError
(
return
SQLITE_IOERR_DELETE
);
if
(
osUnlink
(
zPath
)
==
(
-
1
)
){
if
(
errno
==
ENOENT
){
if
(
errno
==
DFS_STATUS_
ENOENT
){
rc
=
SQLITE_IOERR_DELETE_NOENT
;
}
else
{
rc
=
rtthreadLogError
(
SQLITE_IOERR_DELETE
,
"unlink"
,
zPath
);
...
...
@@ -2338,6 +2387,17 @@ static int rtthreadDelete(
**
** Otherwise return 0.
*/
#ifndef F_OK
# define F_OK 0
#endif
#ifndef R_OK
# define R_OK 4
#endif
#ifndef W_OK
# define W_OK 2
#endif
static
int
rtthreadAccess
(
sqlite3_vfs
*
NotUsed
,
/* The VFS containing this xAccess method */
const
char
*
zPath
,
/* Path of the file to examine */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录