summaryrefslogtreecommitdiff
path: root/rpmdb
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2002-08-03 22:31:39 +0000
committerjbj <devnull@localhost>2002-08-03 22:31:39 +0000
commit00375ca2bf6017f6fb652558776fb588e9df142f (patch)
treef1f75e2bcab8556463ace89066ab8b62255bc69b /rpmdb
parentf5c9fd111bf2d68bff373738310bfc355577233b (diff)
downloadlibrpm-tizen-00375ca2bf6017f6fb652558776fb588e9df142f.tar.gz
librpm-tizen-00375ca2bf6017f6fb652558776fb588e9df142f.tar.bz2
librpm-tizen-00375ca2bf6017f6fb652558776fb588e9df142f.zip
Remove dbi_tear_down, now that rpmdb's are closed on signals.
lclint fiddles. CVS patchset: 5596 CVS date: 2002/08/03 22:31:39
Diffstat (limited to 'rpmdb')
-rw-r--r--rpmdb/db3.c2
-rw-r--r--rpmdb/dbconfig.c10
-rw-r--r--rpmdb/rpmdb.c73
-rw-r--r--rpmdb/rpmdb.h13
4 files changed, 57 insertions, 41 deletions
diff --git a/rpmdb/db3.c b/rpmdb/db3.c
index a50051359..bbd18969e 100644
--- a/rpmdb/db3.c
+++ b/rpmdb/db3.c
@@ -185,7 +185,7 @@ static int db_fini(dbiIndex dbi, const char * dbhome,
rpmMessage(RPMMESS_DEBUG, _("closed db environment %s/%s\n"),
dbhome, dbfile);
- if (rpmdb->db_remove_env || dbi->dbi_tear_down) {
+ if (rpmdb->db_remove_env) {
int xx;
/*@-moduncon@*/ /* FIX: annotate db3 methods */
diff --git a/rpmdb/dbconfig.c b/rpmdb/dbconfig.c
index 0d8781d23..ede58d826 100644
--- a/rpmdb/dbconfig.c
+++ b/rpmdb/dbconfig.c
@@ -25,6 +25,9 @@ struct _dbiIndex db3dbi;
/*@unchecked@*/
static int dbi_use_cursors;
+/*@unchecked@*/
+static int dbi_tear_down;
+
/*@-compmempass -immediatetrans -exportlocal -exportheadervar@*/
/** \ingroup db3
*/
@@ -128,7 +131,7 @@ struct poptOption rdbOptions[] = {
{ "verify", 0,POPT_ARG_NONE, &db3dbi.dbi_verify_on_close, 0,
NULL, NULL },
- { "teardown", 0,POPT_ARG_NONE, &db3dbi.dbi_tear_down, 0,
+ { "teardown", 0,POPT_ARG_NONE, &dbi_tear_down, 0,
NULL, NULL },
{ "usecursors",0,POPT_ARG_NONE, &dbi_use_cursors, 0,
NULL, NULL },
@@ -429,9 +432,8 @@ dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag)
if (!dbi->dbi_use_dbenv) { /* db3 dbenv is always used now. */
dbi->dbi_use_dbenv = 1;
dbi->dbi_eflags |= (DB_INIT_MPOOL|DB_JOINENV);
- dbi->dbi_mp_mmapsize = 8 * 1024 * 1024;
- dbi->dbi_mp_size = 512 * 1024;
- dbi->dbi_tear_down = 1;
+ dbi->dbi_mp_mmapsize = 16 * 1024 * 1024;
+ dbi->dbi_mp_size = 1 * 1024 * 1024;
}
if ((dbi->dbi_bt_flags | dbi->dbi_h_flags) & DB_DUP)
diff --git a/rpmdb/rpmdb.c b/rpmdb/rpmdb.c
index 7e433e47e..33d8f4e8a 100644
--- a/rpmdb/rpmdb.c
+++ b/rpmdb/rpmdb.c
@@ -632,13 +632,13 @@ dbiIndexSet dbiFreeIndexSet(dbiIndexSet set) {
static sigset_t caught;
/* forward ref */
-static void handler(int signum)
- /*@globals caught @*/
- /*@modifies caught @*/;
+static void handler(int signum);
/**
*/
-struct sigtbl_s {
+/*@unchecked@*/
+/*@-fullinitblock@*/
+static struct sigtbl_s {
int signum;
int active;
struct sigaction act;
@@ -650,11 +650,14 @@ struct sigtbl_s {
{ SIGQUIT, 0, { {handler} } },
{ -1, 0, { {NULL} } },
};
+/*@=fullinitblock@*/
/**
*/
+/*@-incondefs@*/
static void handler(int signum)
- /*@*/
+ /*@globals caught, satbl @*/
+ /*@modifies caught @*/
{
struct sigtbl_s * tbl;
@@ -663,17 +666,18 @@ static void handler(int signum)
continue;
if (!tbl->active)
continue;
- sigaddset(&caught, signum);
+ (void) sigaddset(&caught, signum);
break;
}
}
+/*@=incondefs@*/
/**
* Enable all signal handlers
*/
static int enableSignals(void)
/*@globals caught, satbl, fileSystem @*/
- /*@modifies *oldMask, caught, satbl, fileSystem @*/
+ /*@modifies caught, satbl, fileSystem @*/
{
struct sigtbl_s * tbl;
sigset_t newMask, oldMask;
@@ -685,22 +689,23 @@ static int enableSignals(void)
for(tbl = satbl; tbl->signum >= 0; tbl++) {
if (tbl->active++ > 0)
continue;
- sigdelset(&caught, tbl->signum);
+ (void) sigdelset(&caught, tbl->signum);
rc = sigaction(tbl->signum, &tbl->act, &tbl->oact);
if (rc) break;
}
return sigprocmask(SIG_SETMASK, &oldMask, NULL);
}
-rpmdb dbrock;
+/*@unchecked@*/
+static rpmdb dbrock;
/**
* Check for signals.
*/
/*@mayexit@*/
static int checkSignals(void)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/
+ /*@globals dbrock, satbl, fileSystem @*/
+ /*@modifies dbrock, fileSystem @*/
{
struct sigtbl_s * tbl;
sigset_t newMask, oldMask;
@@ -718,11 +723,13 @@ static int checkSignals(void)
if (terminate) {
rpmdb db;
rpmMessage(RPMMESS_WARNING, "Exiting on signal ...\n");
+/*@-newreftrans@*/
while ((db = dbrock) != NULL) {
- dbrock = db->db_next;
+/*@i@*/ dbrock = db->db_next;
db->db_next = NULL;
(void) rpmdbClose(db);
}
+/*@=newreftrans@*/
exit(EXIT_FAILURE);
}
return sigprocmask(SIG_SETMASK, &oldMask, NULL);
@@ -732,8 +739,8 @@ static int checkSignals(void)
* Disable all signal handlers
*/
static int disableSignals(void)
- /*@globals caught, fileSystem @*/
- /*@modifies db, caught, fileSystem @*/
+ /*@globals satbl, fileSystem @*/
+ /*@modifies satbl, fileSystem @*/
{
struct sigtbl_s * tbl;
sigset_t newMask, oldMask;
@@ -755,9 +762,9 @@ static int disableSignals(void)
/**
* Block all signals, returning previous signal mask.
*/
-static int blockSignals(rpmdb db, /*@out@*/ sigset_t * oldMask)
- /*@globals caught, satbl, fileSystem @*/
- /*@modifies *oldMask, caught, satbl, fileSystem @*/
+static int blockSignals(/*@unused@*/ rpmdb db, /*@out@*/ sigset_t * oldMask)
+ /*@globals satbl, fileSystem @*/
+ /*@modifies *oldMask, satbl, fileSystem @*/
{
struct sigtbl_s * tbl;
sigset_t newMask;
@@ -776,11 +783,11 @@ static int blockSignals(rpmdb db, /*@out@*/ sigset_t * oldMask)
* Restore signal mask.
*/
/*@mayexit@*/
-static int unblockSignals(rpmdb db, sigset_t * oldMask)
- /*@globals caught, fileSystem @*/
- /*@modifies db, caught, fileSystem @*/
+static int unblockSignals(/*@unused@*/ rpmdb db, sigset_t * oldMask)
+ /*@globals dbrock, fileSystem @*/
+ /*@modifies dbrock, fileSystem @*/
{
- checkSignals();
+ (void) checkSignals();
return sigprocmask(SIG_SETMASK, oldMask, NULL);
}
@@ -844,7 +851,10 @@ int rpmdbCloseDBI(rpmdb db, int rpmtag)
}
/* XXX query.c, rpminstall.c, verify.c */
+/*@-incondefs@*/
int rpmdbClose(rpmdb db)
+ /*@globals dbrock @*/
+ /*@modifies dbrock @*/
{
rpmdb * prev, next;
int dbix;
@@ -876,13 +886,15 @@ int rpmdbClose(rpmdb db)
db->db_bits = PBM_FREE(db->db_bits);
db->_dbi = _free(db->_dbi);
+/*@-newreftrans@*/
prev = &dbrock;
while ((next = *prev) != NULL && next != db)
prev = &next->db_next;
if (next) {
- *prev = next->db_next;
+/*@i@*/ *prev = next->db_next;
next->db_next = NULL;
}
+/*@=newreftrans@*/
/*@-refcounttrans@*/ db = _free(db); /*@=refcounttrans@*/
/*@=usereleased@*/
@@ -891,6 +903,7 @@ exit:
(void) disableSignals();
return rc;
}
+/*@=incondefs@*/
int rpmdbSync(rpmdb db)
{
@@ -966,9 +979,9 @@ static int openDatabase(/*@null@*/ const char * prefix,
/*@null@*/ const char * dbpath,
int _dbapi, /*@null@*/ /*@out@*/ rpmdb *dbp,
int mode, int perms, int flags)
- /*@globals rpmGlobalMacroContext,
- fileSystem @*/
- /*@modifies *dbp, fileSystem @*/
+ /*@globals dbrock, rpmGlobalMacroContext,
+ fileSystem, internalState @*/
+ /*@modifies dbrock, *dbp, fileSystem, internalState @*/
/*@requires maxSet(dbp) >= 0 @*/
{
rpmdb db;
@@ -1088,9 +1101,11 @@ exit:
if (rc || justCheck || dbp == NULL)
xx = rpmdbClose(db);
else {
- db->db_next = dbrock;
+/*@-assignexpose -newreftrans@*/
+/*@i@*/ db->db_next = dbrock;
dbrock = db;
- *dbp = db;
+/*@i@*/ *dbp = db;
+/*@=assignexpose =newreftrans@*/
}
return rc;
@@ -1741,7 +1756,7 @@ rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi)
mi->mi_db = rpmdbUnlink(mi->mi_db, "matchIterator");
mi = _free(mi);
- checkSignals();
+ (void) checkSignals();
return mi;
}
@@ -2470,7 +2485,7 @@ rpmdbMatchIterator rpmdbInitIterator(rpmdb db, rpmTag rpmtag,
if (db == NULL)
return NULL;
- checkSignals();
+ (void) checkSignals();
/* XXX HACK to remove rpmdbFindByLabel/findMatches from the API */
if (rpmtag == RPMDBI_LABEL) {
diff --git a/rpmdb/rpmdb.h b/rpmdb/rpmdb.h
index 875f1d669..ea2a85c83 100644
--- a/rpmdb/rpmdb.h
+++ b/rpmdb/rpmdb.h
@@ -294,7 +294,6 @@ struct _dbiIndex {
int dbi_api; /*!< Berkeley API type */
int dbi_verify_on_close;
- int dbi_tear_down; /*!< tear down dbenv on close */
int dbi_use_dbenv; /*!< use db environment? */
int dbi_permit_dups; /*!< permit duplicate entries? */
int dbi_no_fsync; /*!< no-op fsync for db */
@@ -840,8 +839,8 @@ rpmdb XrpmdbLink (rpmdb db, const char * msg,
*/
int rpmdbOpen (/*@null@*/ const char * prefix, /*@null@*/ /*@out@*/ rpmdb * dbp,
int mode, int perms)
- /*@globals fileSystem @*/
- /*@modifies *dbp, fileSystem @*/;
+ /*@globals fileSystem, internalState @*/
+ /*@modifies *dbp, fileSystem, internalState @*/;
/** \ingroup rpmdb
* Initialize database.
@@ -850,8 +849,8 @@ int rpmdbOpen (/*@null@*/ const char * prefix, /*@null@*/ /*@out@*/ rpmdb * dbp,
* @return 0 on success
*/
int rpmdbInit(/*@null@*/ const char * prefix, int perms)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+ /*@globals fileSystem, internalState @*/
+ /*@modifies fileSystem, internalState @*/;
/** \ingroup rpmdb
* Verify database components.
@@ -859,8 +858,8 @@ int rpmdbInit(/*@null@*/ const char * prefix, int perms)
* @return 0 on success
*/
int rpmdbVerify(/*@null@*/ const char * prefix)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+ /*@globals fileSystem, internalState @*/
+ /*@modifies fileSystem, internalState @*/;
/**
* Close a single database index.