Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
天中雨水
rt-thread
提交
10aad536
R
rt-thread
项目概览
天中雨水
/
rt-thread
该项目与 Fork 源项目分叉
Fork自
RT-Thread / rt-thread
通知
2
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
10aad536
编写于
11月 17, 2013
作者:
xpxyr
提交者:
geniusgogo
11月 30, 2013
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix declarative referential integrity
上级
7e7f0fb5
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
76 addition
and
69 deletion
+76
-69
components/external/SQLite-3.8.1/src/os_rtt.c
components/external/SQLite-3.8.1/src/os_rtt.c
+76
-69
未找到文件。
components/external/SQLite-3.8.1/src/os_rtt.c
浏览文件 @
10aad536
...
...
@@ -290,6 +290,76 @@ static struct rtt_syscall {
#define osAccess ((int(*)(const char*, int))aSyscall[12].pCurrent)
};
/* End of the overrideable system calls */
/*
**
** This function - unixLogError_x(), is only ever called via the macro
** unixLogError().
**
** It is invoked after an error occurs in an OS function and errno has been
** set. It logs a message using sqlite3_log() containing the current value of
** errno and, if possible, the human-readable equivalent from strerror() or
** strerror_r().
**
** The first argument passed to the macro should be the error code that
** will be returned to SQLite (e.g. SQLITE_IOERR_DELETE, SQLITE_CANTOPEN).
** The two subsequent arguments should be the name of the OS function that
** failed (e.g. "unlink", "open") and the associated file-system path,
** if any.
*/
#define rttLogError(a,b,c) rttLogErrorAtLine(a,b,c,__LINE__)
static
int
rttLogErrorAtLine
(
int
errcode
,
/* SQLite error code */
const
char
*
zFunc
,
/* Name of OS function that failed */
const
char
*
zPath
,
/* File path associated with error */
int
iLine
/* Source line number where error occurred */
){
char
*
zErr
;
/* Message from strerror() or equivalent */
int
iErrno
=
errno
;
/* Saved syscall error number */
/* If this is not a threadsafe build (SQLITE_THREADSAFE==0), then use
** the strerror() function to obtain the human-readable error message
** equivalent to errno. Otherwise, use strerror_r().
*/
#if SQLITE_THREADSAFE && defined(HAVE_STRERROR_R)
char
aErr
[
80
];
memset
(
aErr
,
0
,
sizeof
(
aErr
));
zErr
=
aErr
;
/* If STRERROR_R_CHAR_P (set by autoconf scripts) or __USE_GNU is defined,
** assume that the system provides the GNU version of strerror_r() that
** returns a pointer to a buffer containing the error message. That pointer
** may point to aErr[], or it may point to some static storage somewhere.
** Otherwise, assume that the system provides the POSIX version of
** strerror_r(), which always writes an error message into aErr[].
**
** If the code incorrectly assumes that it is the POSIX version that is
** available, the error message will often be an empty string. Not a
** huge problem. Incorrectly concluding that the GNU version is available
** could lead to a segfault though.
*/
#if defined(STRERROR_R_CHAR_P) || defined(__USE_GNU)
zErr
=
# endif
strerror_r
(
iErrno
,
aErr
,
sizeof
(
aErr
)
-
1
);
#elif SQLITE_THREADSAFE
/* This is a threadsafe build, but strerror_r() is not available. */
zErr
=
""
;
#else
/* Non-threadsafe build, use strerror(). */
zErr
=
strerror
(
iErrno
);
#endif
if
(
zPath
==
0
)
zPath
=
""
;
sqlite3_log
(
errcode
,
"os_rtt.c:%d: (%d) %s(%s) - %s"
,
iLine
,
iErrno
,
zFunc
,
zPath
,
zErr
);
return
errcode
;
}
/*
** Do not accept any file descriptor less than this value, in order to avoid
** opening database file using file descriptors that are commonly used for
...
...
@@ -613,75 +683,6 @@ static int sqliteErrorFromPosixError(int posixError, int sqliteIOErr) {
}
}
/*
**
** This function - unixLogError_x(), is only ever called via the macro
** unixLogError().
**
** It is invoked after an error occurs in an OS function and errno has been
** set. It logs a message using sqlite3_log() containing the current value of
** errno and, if possible, the human-readable equivalent from strerror() or
** strerror_r().
**
** The first argument passed to the macro should be the error code that
** will be returned to SQLite (e.g. SQLITE_IOERR_DELETE, SQLITE_CANTOPEN).
** The two subsequent arguments should be the name of the OS function that
** failed (e.g. "unlink", "open") and the associated file-system path,
** if any.
*/
#define rttLogError(a,b,c) rttLogErrorAtLine(a,b,c,__LINE__)
static
int
rttLogErrorAtLine
(
int
errcode
,
/* SQLite error code */
const
char
*
zFunc
,
/* Name of OS function that failed */
const
char
*
zPath
,
/* File path associated with error */
int
iLine
/* Source line number where error occurred */
){
char
*
zErr
;
/* Message from strerror() or equivalent */
int
iErrno
=
errno
;
/* Saved syscall error number */
/* If this is not a threadsafe build (SQLITE_THREADSAFE==0), then use
** the strerror() function to obtain the human-readable error message
** equivalent to errno. Otherwise, use strerror_r().
*/
#if SQLITE_THREADSAFE && defined(HAVE_STRERROR_R)
char
aErr
[
80
];
memset
(
aErr
,
0
,
sizeof
(
aErr
));
zErr
=
aErr
;
/* If STRERROR_R_CHAR_P (set by autoconf scripts) or __USE_GNU is defined,
** assume that the system provides the GNU version of strerror_r() that
** returns a pointer to a buffer containing the error message. That pointer
** may point to aErr[], or it may point to some static storage somewhere.
** Otherwise, assume that the system provides the POSIX version of
** strerror_r(), which always writes an error message into aErr[].
**
** If the code incorrectly assumes that it is the POSIX version that is
** available, the error message will often be an empty string. Not a
** huge problem. Incorrectly concluding that the GNU version is available
** could lead to a segfault though.
*/
#if defined(STRERROR_R_CHAR_P) || defined(__USE_GNU)
zErr
=
# endif
strerror_r
(
iErrno
,
aErr
,
sizeof
(
aErr
)
-
1
);
#elif SQLITE_THREADSAFE
/* This is a threadsafe build, but strerror_r() is not available. */
zErr
=
""
;
#else
/* Non-threadsafe build, use strerror(). */
zErr
=
strerror
(
iErrno
);
#endif
if
(
zPath
==
0
)
zPath
=
""
;
sqlite3_log
(
errcode
,
"os_rtt.c:%d: (%d) %s(%s) - %s"
,
iLine
,
iErrno
,
zFunc
,
zPath
,
zErr
);
return
errcode
;
}
static
int
robust_ftruncate
(
int
h
,
sqlite3_int64
sz
){
int
rc
;
rc
=
-
1
;
...
...
@@ -832,6 +833,12 @@ static int nolockClose(sqlite3_file *id) {
*/
#define DOTLOCK_SUFFIX ".lock"
/*
** Only set the lastErrno if the error code is a real error and not
** a normal expected return code of SQLITE_BUSY or SQLITE_OK
*/
#define IS_LOCK_ERROR(x) (((x) != SQLITE_OK) && ((x) != SQLITE_BUSY))
/*
** 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, set *pResOut
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录