2 RCS File: /v/rpm/cvs/rpm/rpmdb/db3.c,v
3 rcsdiff -q -kk '-r1.64.2.3' '-r1.64.2.4' -u '/v/rpm/cvs/rpm/rpmdb/db3.c,v' 2>/dev/null
4 --- db3.c 2007/06/10 17:12:34 1.64.2.3
5 +++ db3.c 2007/07/27 18:51:24 1.64.2.4
17 - * Check that posix mutexes are shared.
18 - * @return 0 == shared.
20 -static int db3_pthread_nptl(void)
23 - pthread_mutex_t mutex;
24 - pthread_mutexattr_t mutexattr, *mutexattrp = NULL;
25 - pthread_cond_t cond;
26 - pthread_condattr_t condattr, *condattrp = NULL;
29 - ret = pthread_mutexattr_init(&mutexattr);
31 - ret = pthread_mutexattr_setpshared(&mutexattr, PTHREAD_PROCESS_SHARED);
32 - mutexattrp = &mutexattr;
36 - ret = pthread_mutex_init(&mutex, mutexattrp);
37 - if (mutexattrp != NULL)
38 - pthread_mutexattr_destroy(mutexattrp);
41 - (void) pthread_mutex_destroy(&mutex);
43 - ret = pthread_condattr_init(&condattr);
45 - ret = pthread_condattr_setpshared(&condattr, PTHREAD_PROCESS_SHARED);
46 - condattrp = &condattr;
50 - ret = pthread_cond_init(&cond, condattrp);
52 - if (condattrp != NULL)
53 - (void)pthread_condattr_destroy(condattrp);
55 - (void) pthread_cond_destroy(&cond);
61 #if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 5)
63 * Is process/thread still alive?
65 /* 4.1: dbenv->set_data_dir(???) */
66 /* 4.1: dbenv->set_encrypt(???) */
68 - dbenv->set_errcall(dbenv, rpmdb->db_errcall);
69 + dbenv->set_errcall(dbenv, (void *)rpmdb->db_errcall);
70 dbenv->set_errfile(dbenv, rpmdb->db_errfile);
71 dbenv->set_errpfx(dbenv, rpmdb->db_errpfx);
75 xx = dbenv->set_verbose(dbenv, DB_VERB_WAITSFOR,
76 (dbi->dbi_verbose & DB_VERB_WAITSFOR));
77 +#if defined(DB_VERB_FILEOPS)
78 + xx = dbenv->set_verbose(dbenv, DB_VERB_FILEOPS,
79 + (dbi->dbi_verbose & DB_VERB_FILEOPS));
81 +#if defined(DB_VERB_FILEOPS_ALL)
82 + xx = dbenv->set_verbose(dbenv, DB_VERB_FILEOPS_ALL,
83 + (dbi->dbi_verbose & DB_VERB_FILEOPS_ALL));
86 if (dbi->dbi_mmapsize) {
87 xx = dbenv->set_mp_mmapsize(dbenv, dbi->dbi_mmapsize);
90 if (dbcp) *dbcp = NULL;
92 +#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 6)
93 + rc = dbcursor->dup(dbcursor, dbcp, flags);
94 + rc = cvtdberr(dbi, "dbcursor->dup", rc, _debug);
96 rc = dbcursor->c_dup(dbcursor, dbcp, flags);
97 rc = cvtdberr(dbi, "dbcursor->c_dup", rc, _debug);
99 /*@-nullstate @*/ /* FIX: *dbcp can be NULL */
104 /* XXX db3copen error pathways come through here. */
105 if (dbcursor != NULL) {
106 +#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 6)
107 + rc = dbcursor->close(dbcursor);
108 + rc = cvtdberr(dbi, "dbcursor->close", rc, _debug);
110 rc = dbcursor->c_close(dbcursor);
111 rc = cvtdberr(dbi, "dbcursor->c_close", rc, _debug);
117 rc = db->put(db, dbi->dbi_txnid, key, data, 0);
118 rc = cvtdberr(dbi, "db->put", rc, _debug);
120 +#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 6)
121 + rc = dbcursor->put(dbcursor, key, data, DB_KEYLAST);
122 + rc = cvtdberr(dbi, "dbcursor->put", rc, _debug);
124 rc = dbcursor->c_put(dbcursor, key, data, DB_KEYLAST);
125 rc = cvtdberr(dbi, "dbcursor->c_put", rc, _debug);
130 @@ -728,14 +700,26 @@
133 /* XXX TODO: insure that cursor is positioned with duplicates */
134 +#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 6)
135 + rc = dbcursor->get(dbcursor, key, data, DB_SET);
136 + /* XXX DB_NOTFOUND can be returned */
137 + _printit = (rc == DB_NOTFOUND ? 0 : _debug);
138 + rc = cvtdberr(dbi, "dbcursor->get", rc, _printit);
140 rc = dbcursor->c_get(dbcursor, key, data, DB_SET);
141 /* XXX DB_NOTFOUND can be returned */
142 _printit = (rc == DB_NOTFOUND ? 0 : _debug);
143 rc = cvtdberr(dbi, "dbcursor->c_get", rc, _printit);
147 +#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 6)
148 + rc = dbcursor->del(dbcursor, flags);
149 + rc = cvtdberr(dbi, "dbcursor->del", rc, _debug);
151 rc = dbcursor->c_del(dbcursor, flags);
152 rc = cvtdberr(dbi, "dbcursor->c_del", rc, _debug);
157 @@ -761,11 +745,19 @@
158 _printit = (rc == DB_NOTFOUND ? 0 : _debug);
159 rc = cvtdberr(dbi, "db->get", rc, _printit);
161 +#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 6)
162 + /* XXX db3 does DB_FIRST on uninitialized cursor */
163 + rc = dbcursor->get(dbcursor, key, data, flags);
164 + /* XXX DB_NOTFOUND can be returned */
165 + _printit = (rc == DB_NOTFOUND ? 0 : _debug);
166 + rc = cvtdberr(dbi, "dbcursor->get", rc, _printit);
168 /* XXX db3 does DB_FIRST on uninitialized cursor */
169 rc = dbcursor->c_get(dbcursor, key, data, flags);
170 /* XXX DB_NOTFOUND can be returned */
171 _printit = (rc == DB_NOTFOUND ? 0 : _debug);
172 rc = cvtdberr(dbi, "dbcursor->c_get", rc, _printit);
177 @@ -785,11 +777,19 @@
179 assert(dbcursor != NULL);
181 +#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 6)
182 + /* XXX db3 does DB_FIRST on uninitialized cursor */
183 + rc = dbcursor->pget(dbcursor, key, pkey, data, flags);
184 + /* XXX DB_NOTFOUND can be returned */
185 + _printit = (rc == DB_NOTFOUND ? 0 : _debug);
186 + rc = cvtdberr(dbi, "dbcursor->pget", rc, _printit);
188 /* XXX db3 does DB_FIRST on uninitialized cursor */
189 rc = dbcursor->c_pget(dbcursor, key, pkey, data, flags);
190 /* XXX DB_NOTFOUND can be returned */
191 _printit = (rc == DB_NOTFOUND ? 0 : _debug);
192 rc = cvtdberr(dbi, "dbcursor->c_pget", rc, _printit);
201 +#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 6)
202 + rc = dbcursor->count(dbcursor, &count, flags);
203 + rc = cvtdberr(dbi, "dbcursor->count", rc, _debug);
205 rc = dbcursor->c_count(dbcursor, &count, flags);
206 rc = cvtdberr(dbi, "dbcursor->c_count", rc, _debug);
210 if (countp) *countp = count;
212 if (rc || dbenv == NULL) goto exit;
214 /*@-noeffectuncon@*/ /* FIX: annotate db3 methods */
215 - dbenv->set_errcall(dbenv, rpmdb->db_errcall);
216 + dbenv->set_errcall(dbenv, (void *)rpmdb->db_errcall);
217 dbenv->set_errfile(dbenv, rpmdb->db_errfile);
218 dbenv->set_errpfx(dbenv, rpmdb->db_errpfx);
219 /* dbenv->set_paniccall(???) */
220 @@ -1176,19 +1181,6 @@
222 if (dbi->dbi_use_dbenv) {
226 - if (rpmdb->db_dbenv == NULL) {
227 - /* Set DB_PRIVATE if posix mutexes are not shared. */
228 - xx = db3_pthread_nptl();
230 - dbi->dbi_eflags |= DB_PRIVATE;
231 - rpmMessage(RPMMESS_DEBUG, _("unshared posix mutexes found(%d), adding DB_PRIVATE, using fcntl lock\n"), xx);
237 if (access(dbhome, W_OK) == -1) {
239 /* dbhome is unwritable, don't attempt DB_CREATE on DB->open ... */
240 Index: rpm/rpmdb/dbconfig.c
241 RCS File: /v/rpm/cvs/rpm/rpmdb/dbconfig.c,v
242 rcsdiff -q -kk '-r1.38' '-r1.38.2.1' -u '/v/rpm/cvs/rpm/rpmdb/dbconfig.c,v' 2>/dev/null
243 --- dbconfig.c 2007/05/25 17:36:33 1.38
244 +++ dbconfig.c 2007/07/27 18:51:24 1.38.2.1
245 @@ -109,11 +109,19 @@
247 { "use_environ", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_USE_ENVIRON,
249 +#if defined(DB_IGNORE_LEASE)
250 + { "ignore_lease", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_IGNORE_LEASE,
254 { "txn_sync", 0,POPT_BIT_SET, &db3dbi.dbi_tflags, DB_TXN_SYNC,
256 { "txn_nowait",0,POPT_BIT_SET, &db3dbi.dbi_tflags, DB_TXN_NOWAIT,
258 +#if defined(DB_TXN_WAIT)
259 + { "txn_wait",0,POPT_BIT_SET, &db3dbi.dbi_tflags, DB_TXN_WAIT,
267 { "waitsfor", 0,POPT_BIT_SET, &db3dbi.dbi_verbose, DB_VERB_WAITSFOR,
269 +#if defined(DB_VERB_FILEOPS)
270 + { "fileops", 0,POPT_BIT_SET, &db3dbi.dbi_verbose, DB_VERB_FILEOPS,
273 +#if defined(DB_VERB_FILEOPS_ALL)
274 + { "fileops_all",0,POPT_BIT_SET,&db3dbi.dbi_verbose, DB_VERB_FILEOPS_ALL,
277 { "verbose", 0,POPT_ARG_VAL, &db3dbi.dbi_verbose, -1,
283 /* XXX DB_ENV->set_timeout */
289 /* XXX DB_ENV->get_timeout */