Fix compiler warnings when compiling under VxWorks 7.

FossilOrigin-Name: 55c21521a64703d7050c7f8975538f4cfae95eb7
This commit is contained in:
drh 2015-03-03 19:56:20 +00:00
parent 4a4b138965
commit 91eb93c797
4 changed files with 43 additions and 29 deletions

View File

@ -1,5 +1,5 @@
C Enhance\sSQLITE_ALLOW_URI_AUTHORITITY\sto\selide\s//localhost/\sand\sto\sdeal\nwith\sdodgy\sURIs\sthat\scontain\stoo\smany\s"/"\scharacters.
D 2015-03-03T16:58:56.782
C Fix\scompiler\swarnings\swhen\scompiling\sunder\sVxWorks\s7.
D 2015-03-03T19:56:20.675
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 2f643d6968dfc0b82d2e546a0525a39079f9e928
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -214,7 +214,7 @@ F src/os.c 8fd25588eeba74068d41102d26810e216999b6c8
F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf
F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa
F src/os_unix.c 190c726a2881b0b0366cba0906eec80baf6c6781
F src/os_unix.c 35510fa3a2f38b076a9628557c1ead63bbb49cdc
F src/os_win.c 8223e7db5b7c4a81d8b161098ac3959400434cdb
F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca
F src/pager.c 4120a49ecd37697e28f5ed807f470b9c0b88410c
@ -231,7 +231,7 @@ F src/random.c ba2679f80ec82c4190062d756f22d0c358180696
F src/resolve.c f4d79e31ffa5820c2e3d1740baa5e9b190425f2b
F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e
F src/select.c e46cef4c224549b439384c88fc7f57ba064dad54
F src/shell.c e2e5b63a759d304c1ada5b77dc5a518dc8e5396c
F src/shell.c cce82ca26392578a4a1ee927dfe55ea3411c7c92
F src/sqlite.h.in 62d3997824038cc32335b04aaa18cc8f4c19e9be
F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad
F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d
@ -1240,7 +1240,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P debba6f161090bf9db1458fb3767d80d8362a73f
R c0b7adf9c28144985d9fdda7fbb149ba
P 39b566a2d0916c57f3fac756c6d6af149b44781d
R 9a933a4520ccec36872b9bf9ae4c7dcf
U drh
Z 3f9b4ad7f0949adf7d85c9b9b903f5a0
Z d802fbee836547f901f82efaa92d78f9

View File

@ -1 +1 @@
39b566a2d0916c57f3fac756c6d6af149b44781d
55c21521a64703d7050c7f8975538f4cfae95eb7

View File

@ -137,6 +137,10 @@
*/
#define MAX_PATHNAME 512
/* Always cast the getpid() return type for compatibility with
** kernel modules in VxWorks. */
#define osGetpid(X) (pid_t)getpid()
/*
** 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
@ -1529,7 +1533,8 @@ static int unixLock(sqlite3_file *id, int eFileLock){
assert( pFile );
OSTRACE(("LOCK %d %s was %s(%s,%d) pid=%d (unix)\n", pFile->h,
azFileLock(eFileLock), azFileLock(pFile->eFileLock),
azFileLock(pFile->pInode->eFileLock), pFile->pInode->nShared , getpid()));
azFileLock(pFile->pInode->eFileLock), pFile->pInode->nShared,
osGetpid()));
/* If there is already a lock of this type or more restrictive on the
** unixFile, do nothing. Don't use the end_lock: exit path, as
@ -1737,7 +1742,7 @@ static int posixUnlock(sqlite3_file *id, int eFileLock, int handleNFSUnlock){
assert( pFile );
OSTRACE(("UNLOCK %d %d was %d(%d,%d) pid=%d (unix)\n", pFile->h, eFileLock,
pFile->eFileLock, pFile->pInode->eFileLock, pFile->pInode->nShared,
getpid()));
osGetpid()));
assert( eFileLock<=SHARED_LOCK );
if( pFile->eFileLock<=eFileLock ){
@ -2164,7 +2169,7 @@ static int dotlockUnlock(sqlite3_file *id, int eFileLock) {
assert( pFile );
OSTRACE(("UNLOCK %d %d was %d pid=%d (dotlock)\n", pFile->h, eFileLock,
pFile->eFileLock, getpid()));
pFile->eFileLock, osGetpid()));
assert( eFileLock<=SHARED_LOCK );
/* no-op if possible */
@ -2383,7 +2388,7 @@ static int flockUnlock(sqlite3_file *id, int eFileLock) {
assert( pFile );
OSTRACE(("UNLOCK %d %d was %d pid=%d (flock)\n", pFile->h, eFileLock,
pFile->eFileLock, getpid()));
pFile->eFileLock, osGetpid()));
assert( eFileLock<=SHARED_LOCK );
/* no-op if possible */
@ -2551,7 +2556,7 @@ static int semXUnlock(sqlite3_file *id, int eFileLock) {
assert( pFile );
assert( pSem );
OSTRACE(("UNLOCK %d %d was %d pid=%d (sem)\n", pFile->h, eFileLock,
pFile->eFileLock, getpid()));
pFile->eFileLock, osGetpid()));
assert( eFileLock<=SHARED_LOCK );
/* no-op if possible */
@ -2765,7 +2770,7 @@ static int afpLock(sqlite3_file *id, int eFileLock){
assert( pFile );
OSTRACE(("LOCK %d %s was %s(%s,%d) pid=%d (afp)\n", pFile->h,
azFileLock(eFileLock), azFileLock(pFile->eFileLock),
azFileLock(pInode->eFileLock), pInode->nShared , getpid()));
azFileLock(pInode->eFileLock), pInode->nShared , osGetpid()));
/* If there is already a lock of this type or more restrictive on the
** unixFile, do nothing. Don't use the afp_end_lock: exit path, as
@ -2951,7 +2956,7 @@ static int afpUnlock(sqlite3_file *id, int eFileLock) {
assert( pFile );
OSTRACE(("UNLOCK %d %d was %d(%d,%d) pid=%d (afp)\n", pFile->h, eFileLock,
pFile->eFileLock, pFile->pInode->eFileLock, pFile->pInode->nShared,
getpid()));
osGetpid()));
assert( eFileLock<=SHARED_LOCK );
if( pFile->eFileLock<=eFileLock ){
@ -4621,7 +4626,7 @@ static int unixShmLock(
}
sqlite3_mutex_leave(pShmNode->mutex);
OSTRACE(("SHM-LOCK shmid-%d, pid-%d got %03x,%03x\n",
p->id, getpid(), p->sharedMask, p->exclMask));
p->id, osGetpid(), p->sharedMask, p->exclMask));
return rc;
}
@ -5718,8 +5723,8 @@ static int unixOpen(
** the same instant might all reset the PRNG. But multiple resets
** are harmless.
*/
if( randomnessPid!=getpid() ){
randomnessPid = getpid();
if( randomnessPid!=osGetpid() ){
randomnessPid = osGetpid();
sqlite3_randomness(0,0);
}
@ -6110,7 +6115,7 @@ static int unixRandomness(sqlite3_vfs *NotUsed, int nBuf, char *zBuf){
** tests repeatable.
*/
memset(zBuf, 0, nBuf);
randomnessPid = getpid();
randomnessPid = osGetpid();
#if !defined(SQLITE_TEST)
{
int fd, got;
@ -6431,7 +6436,7 @@ static int proxyGetLockPath(const char *dbPath, char *lPath, size_t maxLen){
{
if( !confstr(_CS_DARWIN_USER_TEMP_DIR, lPath, maxLen) ){
OSTRACE(("GETLOCKPATH failed %s errno=%d pid=%d\n",
lPath, errno, getpid()));
lPath, errno, osGetpid()));
return SQLITE_IOERR_LOCK;
}
len = strlcat(lPath, "sqliteplocks", maxLen);
@ -6453,7 +6458,7 @@ static int proxyGetLockPath(const char *dbPath, char *lPath, size_t maxLen){
}
lPath[i+len]='\0';
strlcat(lPath, ":auto:", maxLen);
OSTRACE(("GETLOCKPATH proxy lock path=%s pid=%d\n", lPath, getpid()));
OSTRACE(("GETLOCKPATH proxy lock path=%s pid=%d\n", lPath, osGetpid()));
return SQLITE_OK;
}
@ -6480,7 +6485,7 @@ static int proxyCreateLockPath(const char *lockPath){
if( err!=EEXIST ) {
OSTRACE(("CREATELOCKPATH FAILED creating %s, "
"'%s' proxy lock path=%s pid=%d\n",
buf, strerror(err), lockPath, getpid()));
buf, strerror(err), lockPath, osGetpid()));
return err;
}
}
@ -6489,7 +6494,7 @@ static int proxyCreateLockPath(const char *lockPath){
}
buf[i] = lockPath[i];
}
OSTRACE(("CREATELOCKPATH proxy lock path=%s pid=%d\n", lockPath, getpid()));
OSTRACE(("CREATELOCKPATH proxy lock path=%s pid=%d\n", lockPath, osGetpid()));
return 0;
}
@ -6794,7 +6799,8 @@ static int proxyTakeConch(unixFile *pFile){
int forceNewLockPath = 0;
OSTRACE(("TAKECONCH %d for %s pid=%d\n", conchFile->h,
(pCtx->lockProxyPath ? pCtx->lockProxyPath : ":auto:"), getpid()));
(pCtx->lockProxyPath ? pCtx->lockProxyPath : ":auto:"),
osGetpid()));
rc = proxyGetHostID(myHostID, &pError);
if( (rc&0xff)==SQLITE_IOERR ){
@ -7004,7 +7010,7 @@ static int proxyReleaseConch(unixFile *pFile){
conchFile = pCtx->conchFile;
OSTRACE(("RELEASECONCH %d for %s pid=%d\n", conchFile->h,
(pCtx->lockProxyPath ? pCtx->lockProxyPath : ":auto:"),
getpid()));
osGetpid()));
if( pCtx->conchHeld>0 ){
rc = conchFile->pMethod->xUnlock((sqlite3_file*)conchFile, NO_LOCK);
}
@ -7146,7 +7152,7 @@ static int proxyTransformUnixFile(unixFile *pFile, const char *path) {
}
OSTRACE(("TRANSPROXY %d for %s pid=%d\n", pFile->h,
(lockPath ? lockPath : ":auto:"), getpid()));
(lockPath ? lockPath : ":auto:"), osGetpid()));
pCtx = sqlite3_malloc( sizeof(*pCtx) );
if( pCtx==0 ){

View File

@ -177,11 +177,19 @@ static sqlite3_int64 timeOfDay(void){
return t;
}
#if !defined(_WIN32) && !defined(WIN32) && !defined(_WRS_KERNEL) \
&& !defined(__minux)
#if !defined(_WIN32) && !defined(WIN32) && !defined(__minux)
#include <sys/time.h>
#include <sys/resource.h>
/* VxWorks does not support getrusage() as far as we can determine */
#if defined(_WRS_KERNEL) || defined(__RTP__)
struct rusage {
struct timeval ru_utime; /* user CPU time used */
struct timeval ru_stime; /* system CPU time used */
};
#define getrusage(A,B) memset(B,0,sizeof(*B))
#endif
/* Saved resource information for the beginning of an operation */
static struct rusage sBegin; /* CPU time at start */
static sqlite3_int64 iBegin; /* Wall-clock time at start */
@ -207,8 +215,8 @@ static double timeDiff(struct timeval *pStart, struct timeval *pEnd){
*/
static void endTimer(void){
if( enableTimer ){
struct rusage sEnd;
sqlite3_int64 iEnd = timeOfDay();
struct rusage sEnd;
getrusage(RUSAGE_SELF, &sEnd);
printf("Run Time: real %.3f user %f sys %f\n",
(iEnd - iBegin)*0.001,