How to start a demo (BerkeleyDB.4.4.20----build_vxworks)under vxworks5.5? -
05-10-2006
, 10:03 PM
Hello,I have a question :
My host: Windows xp
My target: VxSim
I added BerkeleyDB22.wpj to my workspace and set a new build to SIMNTgnu,then I create my own project test.wpj building to SIMNTgnu.After that ,I downloaded them to vxSim successfully. when I spawn a task in WindSh like this :sp db_function
Errors come here:
__fop_file_setup: Retry limit (100) exceeded
ERROR:errno = 0x11
0x1cb92b8 (s1u0): 00 task is working
DB->put: method not permitted before handle's open method
0x1cb92b8 (s1u0): 01 task is working
ERROR:errno = 0x16
DB->get: method not permitted before handle's open method
ERROR:errno = 0x16
0x1cb92b8 (s1u0): 02 task is working
OK
0x1cb92b8 (s1u0): task is working
test.c
#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"
/*#define DATABASE "demo.db"*/
/*void print()
{
printf("hello kkkkk\n");
}*/
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);
/*if((fp=fopen(DATABASE,"w+"))==NULL)
{
printf("can not open file\n");
} */
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);
}
Where is the problem?
Would you like to tell me a simple application like this ? |