How to start Berkeley DB with vxWoks5.5?(always come error) -
05-10-2006
, 08:30 AM
hello
I worked under the VxWorks with Tornado2.2.In my workspace I opened the BerkeleyDB22.wpj,to build the project to PENTIUM3gnu.Secondly I created my own project and build this to PENTIUM3gnu too.All Building is successfully,but when I run the test program it comes error.My target is a Pc.
Would you like to tell me how to begin a simple application with Berkeley DB using vxWorks5.5?
#include"sys/types.h"
#include"vxWorks.h"
#include"taskLib.h"
#include"stdio.h"
#include"stdlib.h"
#include"string.h"
#include"db.h"
#include"pthread.h"
#define DATABASE "host:F:/demo.db"
STATUS print_error(int ret)
{
if(ret!=0)
{
printf("ERROR:%s\n",db_strerror(ret));
}
}
STATUS db_function()
{
DB *dbp;
DBT key;
DBT data;
int ret;
FILE *fp;
memset(&key,0,sizeof(key));
memset(&data,0,sizeof(data));
key.data="sport";
key.size=strlen("sport")+1;
data.data="football";
data.size=strlen("football")+1;
ret=db_create(&dbp,NULL,0);
print_error(ret);
dbp->set_errfile(dbp, stderr);
ret=dbp->open(dbp,NULL,DATABASE,NULL,DB_BTREE,DB_CREATE,06 64);
print_error(ret);
logMsg("00 task is working\n",0,0,0,0,0,0);
ret=dbp->put(dbp,NULL,&key,&data,DB_NOOVERWRITE);
logMsg("01 task is working\n",0,0,0,0,0,0);
print_error(ret);
ret=dbp->get(dbp,NULL,&key,&data,0);
print_error(ret);
logMsg("02 task is working\n",0,0,0,0,0,0);
ret=dbp->close(dbp,0);
print_error(ret);
printf("OK\n");
logMsg("task is working\n",0,0,0,0,0,0);
}
ERROR from target:
host:F:/_dbdemo.tmp:errno=0xd0003
host:F:/demo.db:errno=0xd0003
close:errno=0xd0003
close:errno=0xd0003
0xfebbe18(s1u0):memPartFree:Invalid block 0xffff0f0 in Partition 0x3ab2f0
what'wrong?
Would you like to tell me how to start a simple application under Tornado2.2 with Berkeley DB?Thanks a lot!!! |