]>
Commit | Line | Data |
---|---|---|
ae23e6a0 AM |
1 | Index: rpm/rpmdb/db3.c |
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 | |
6 | @@ -239,57 +239,6 @@ | |
7 | return 0; | |
8 | } | |
9 | ||
10 | -#if 0 | |
11 | -#if HAVE_LIBPTHREAD | |
12 | -#if HAVE_PTHREAD_H | |
13 | -#include <pthread.h> | |
14 | -#endif | |
15 | - | |
16 | -/** | |
17 | - * Check that posix mutexes are shared. | |
18 | - * @return 0 == shared. | |
19 | - */ | |
20 | -static int db3_pthread_nptl(void) | |
21 | - /*@*/ | |
22 | -{ | |
23 | - pthread_mutex_t mutex; | |
24 | - pthread_mutexattr_t mutexattr, *mutexattrp = NULL; | |
25 | - pthread_cond_t cond; | |
26 | - pthread_condattr_t condattr, *condattrp = NULL; | |
27 | - int ret = 0; | |
28 | - | |
29 | - ret = pthread_mutexattr_init(&mutexattr); | |
30 | - if (ret == 0) { | |
31 | - ret = pthread_mutexattr_setpshared(&mutexattr, PTHREAD_PROCESS_SHARED); | |
32 | - mutexattrp = &mutexattr; | |
33 | - } | |
34 | - | |
35 | - if (ret == 0) | |
36 | - ret = pthread_mutex_init(&mutex, mutexattrp); | |
37 | - if (mutexattrp != NULL) | |
38 | - pthread_mutexattr_destroy(mutexattrp); | |
39 | - if (ret) | |
40 | - return ret; | |
41 | - (void) pthread_mutex_destroy(&mutex); | |
42 | - | |
43 | - ret = pthread_condattr_init(&condattr); | |
44 | - if (ret == 0) { | |
45 | - ret = pthread_condattr_setpshared(&condattr, PTHREAD_PROCESS_SHARED); | |
46 | - condattrp = &condattr; | |
47 | - } | |
48 | - | |
49 | - if (ret == 0) | |
50 | - ret = pthread_cond_init(&cond, condattrp); | |
51 | - | |
52 | - if (condattrp != NULL) | |
53 | - (void)pthread_condattr_destroy(condattrp); | |
54 | - if (ret == 0) | |
55 | - (void) pthread_cond_destroy(&cond); | |
56 | - return ret; | |
57 | -} | |
58 | -#endif | |
59 | -#endif | |
60 | - | |
61 | #if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 5) | |
62 | /** | |
63 | * Is process/thread still alive? | |
64 | @@ -374,7 +323,7 @@ | |
65 | /* 4.1: dbenv->set_data_dir(???) */ | |
66 | /* 4.1: dbenv->set_encrypt(???) */ | |
67 | ||
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); | |
72 | /*@=noeffectuncon@*/ | |
73 | @@ -425,6 +374,14 @@ | |
74 | #endif | |
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)); | |
80 | +#endif | |
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)); | |
84 | +#endif | |
85 | ||
86 | if (dbi->dbi_mmapsize) { | |
87 | xx = dbenv->set_mp_mmapsize(dbenv, dbi->dbi_mmapsize); | |
88 | @@ -637,8 +594,13 @@ | |
89 | /*@-boundswrite@*/ | |
90 | if (dbcp) *dbcp = NULL; | |
91 | /*@=boundswrite@*/ | |
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); | |
95 | +#else | |
96 | rc = dbcursor->c_dup(dbcursor, dbcp, flags); | |
97 | rc = cvtdberr(dbi, "dbcursor->c_dup", rc, _debug); | |
98 | +#endif | |
99 | /*@-nullstate @*/ /* FIX: *dbcp can be NULL */ | |
100 | return rc; | |
101 | /*@=nullstate @*/ | |
102 | @@ -654,8 +616,13 @@ | |
103 | ||
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); | |
109 | +#else | |
110 | rc = dbcursor->c_close(dbcursor); | |
111 | rc = cvtdberr(dbi, "dbcursor->c_close", rc, _debug); | |
112 | +#endif | |
113 | } | |
114 | return rc; | |
115 | } | |
116 | @@ -704,8 +671,13 @@ | |
117 | rc = db->put(db, dbi->dbi_txnid, key, data, 0); | |
118 | rc = cvtdberr(dbi, "db->put", rc, _debug); | |
119 | } else { | |
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); | |
123 | +#else | |
124 | rc = dbcursor->c_put(dbcursor, key, data, DB_KEYLAST); | |
125 | rc = cvtdberr(dbi, "dbcursor->c_put", rc, _debug); | |
126 | +#endif | |
127 | } | |
128 | ||
129 | return rc; | |
130 | @@ -728,14 +700,26 @@ | |
131 | int _printit; | |
132 | ||
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); | |
139 | +#else | |
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); | |
144 | +#endif | |
145 | ||
146 | if (rc == 0) { | |
147 | +#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 6) | |
148 | + rc = dbcursor->del(dbcursor, flags); | |
149 | + rc = cvtdberr(dbi, "dbcursor->del", rc, _debug); | |
150 | +#else | |
151 | rc = dbcursor->c_del(dbcursor, flags); | |
152 | rc = cvtdberr(dbi, "dbcursor->c_del", rc, _debug); | |
153 | +#endif | |
154 | } | |
155 | } | |
156 | ||
157 | @@ -761,11 +745,19 @@ | |
158 | _printit = (rc == DB_NOTFOUND ? 0 : _debug); | |
159 | rc = cvtdberr(dbi, "db->get", rc, _printit); | |
160 | } else { | |
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); | |
167 | +#else | |
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); | |
173 | +#endif | |
174 | } | |
175 | ||
176 | return rc; | |
177 | @@ -785,11 +777,19 @@ | |
178 | assert(db != NULL); | |
179 | assert(dbcursor != NULL); | |
180 | ||
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); | |
187 | +#else | |
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); | |
193 | +#endif | |
194 | ||
195 | return rc; | |
196 | } | |
197 | @@ -805,8 +805,13 @@ | |
198 | int rc = 0; | |
199 | ||
200 | flags = 0; | |
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); | |
204 | +#else | |
205 | rc = dbcursor->c_count(dbcursor, &count, flags); | |
206 | rc = cvtdberr(dbi, "dbcursor->c_count", rc, _debug); | |
207 | +#endif | |
208 | if (rc) return rc; | |
209 | /*@-boundswrite@*/ | |
210 | if (countp) *countp = count; | |
211 | @@ -995,7 +1000,7 @@ | |
212 | if (rc || dbenv == NULL) goto exit; | |
213 | ||
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 @@ | |
221 | */ | |
222 | if (dbi->dbi_use_dbenv) { | |
223 | ||
224 | -#if 0 | |
225 | -#if HAVE_LIBPTHREAD | |
226 | - if (rpmdb->db_dbenv == NULL) { | |
227 | - /* Set DB_PRIVATE if posix mutexes are not shared. */ | |
228 | - xx = db3_pthread_nptl(); | |
229 | - if (xx) { | |
230 | - dbi->dbi_eflags |= DB_PRIVATE; | |
231 | - rpmMessage(RPMMESS_DEBUG, _("unshared posix mutexes found(%d), adding DB_PRIVATE, using fcntl lock\n"), xx); | |
232 | - } | |
233 | - } | |
234 | -#endif | |
235 | -#endif | |
236 | - | |
237 | if (access(dbhome, W_OK) == -1) { | |
238 | ||
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 @@ | |
246 | NULL, NULL }, | |
247 | { "use_environ", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_USE_ENVIRON, | |
248 | NULL, NULL }, | |
249 | +#if defined(DB_IGNORE_LEASE) | |
250 | + { "ignore_lease", 0,POPT_BIT_SET, &db3dbi.dbi_eflags, DB_IGNORE_LEASE, | |
251 | + NULL, NULL }, | |
252 | +#endif | |
253 | ||
254 | { "txn_sync", 0,POPT_BIT_SET, &db3dbi.dbi_tflags, DB_TXN_SYNC, | |
255 | NULL, NULL }, | |
256 | { "txn_nowait",0,POPT_BIT_SET, &db3dbi.dbi_tflags, DB_TXN_NOWAIT, | |
257 | NULL, NULL }, | |
258 | +#if defined(DB_TXN_WAIT) | |
259 | + { "txn_wait",0,POPT_BIT_SET, &db3dbi.dbi_tflags, DB_TXN_WAIT, | |
260 | + NULL, NULL }, | |
261 | +#endif | |
262 | ||
263 | #if defined(NOTYET) | |
264 | DB_AUTO_COMMIT | |
265 | @@ -274,6 +282,14 @@ | |
266 | #endif | |
267 | { "waitsfor", 0,POPT_BIT_SET, &db3dbi.dbi_verbose, DB_VERB_WAITSFOR, | |
268 | NULL, NULL }, | |
269 | +#if defined(DB_VERB_FILEOPS) | |
270 | + { "fileops", 0,POPT_BIT_SET, &db3dbi.dbi_verbose, DB_VERB_FILEOPS, | |
271 | + NULL, NULL }, | |
272 | +#endif | |
273 | +#if defined(DB_VERB_FILEOPS_ALL) | |
274 | + { "fileops_all",0,POPT_BIT_SET,&db3dbi.dbi_verbose, DB_VERB_FILEOPS_ALL, | |
275 | + NULL, NULL }, | |
276 | +#endif | |
277 | { "verbose", 0,POPT_ARG_VAL, &db3dbi.dbi_verbose, -1, | |
278 | NULL, NULL }, | |
279 | ||
280 | @@ -335,6 +351,11 @@ | |
281 | NULL, NULL }, | |
282 | ||
283 | /* XXX DB_ENV->set_timeout */ | |
284 | +#if defined(NOTYET) | |
285 | +DB_SET_LOCK_TIMEOUT | |
286 | +DB_SET_TXN_NOW | |
287 | +DB_SET_TXN_TIMEOUT | |
288 | +#endif | |
289 | /* XXX DB_ENV->get_timeout */ | |
290 | ||
291 | /* ==== Logging: */ |