"Open errno: 0xb " When test the BerkeleyDB with VxWorks
592720Aug 13 2007 — edited Aug 24 2007This is my test program:
#include <sys/types.h>
#include <ioLib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <db.h>
#include <db_config.h>
#include <db_int.h>
int create(void)
{
int ret = 0;
int index;
DB *dbp;
DBC *dbcp;
DBT key, data;
char *database;
database = "host:/DB/rule.db";
if ((ret = db_create(&dbp, NULL, 0)) != 0) {
fprintf(stderr, "db_create: %s\n", db_strerror(ret));
exit (1);
}
if ((ret = dbp->set_pagesize(dbp, 1024)) != 0) {
dbp->err(dbp, ret, "set_pagesize");
return 1;
}
if ((ret = dbp->set_cachesize(dbp, 0, 32 * 1024, 0)) != 0) {
dbp->err(dbp, ret, "set_cachesize");
return 1;
}
if ((ret = dbp->open(dbp,NULL,database,NULL, DB_BTREE, DB_CREATE,
0664))!=0) {
dbp->err(dbp, ret, "%s:open", database);
return 1;
/*exit(1);*/
}
retrun 0;
}
when I run it under the simulator(VxSime) of Tornado2.2,it comes the error
information:
host:/DB/rule.db:open: errno = 0xb
but I could see the _db.rule.db in the directorty,
This question puzzled me for a long time.
Looking forward to your help.
thanks a lot!