1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279
|
nss_db is now external to libc, so it doesn't get to use internal interfaces.
diff -Nru nss_db-2.2.3pre1.orig/src/db-alias.c nss_db-2.2.3pre1/src/db-alias.c
--- nss_db-2.2.3pre1.orig/src/db-alias.c 2001-04-30 03:07:41.000000000 +0200
+++ nss_db-2.2.3pre1/src/db-alias.c 2005-07-09 14:21:40.271666576 +0200
@@ -23,15 +23,14 @@
#include <ctype.h>
#include <errno.h>
#include <paths.h>
+#include <pthread.h>
#include <stdio.h>
#include <string.h>
-#include <bits/libc-lock.h>
-
#include "nss_db.h"
/* Locks the static variables in this file. */
-__libc_lock_define_initialized (static, lock)
+static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
/* Maintenance of the shared handle open on the database. */
@@ -46,7 +45,7 @@
{
enum nss_status status;
- __libc_lock_lock (lock);
+ pthread_mutex_lock (&lock);
status = internal_setent (_PATH_VARDB "aliases.db", &db);
@@ -57,7 +56,7 @@
/* Reset the sequential index. */
entidx = 0;
- __libc_lock_unlock (lock);
+ pthread_mutex_unlock (&lock);
return status;
}
@@ -67,14 +66,14 @@
enum nss_status
_nss_db_endaliasent (void)
{
- __libc_lock_lock (lock);
+ pthread_mutex_lock (&lock);
internal_endent (&db);
/* Reset STAYOPEN flag. */
keep_db = 0;
- __libc_lock_unlock (lock);
+ pthread_mutex_unlock (&lock);
return NSS_STATUS_SUCCESS;
}
@@ -180,14 +179,14 @@
char buf[20];
DBT key;
- __libc_lock_lock (lock);
+ pthread_mutex_lock (&lock);
key.size = snprintf (key.data = buf, sizeof buf, "0%u", entidx++);
key.flags = 0;
status = lookup (&key, result, buffer, buflen, errnop);
if (status == NSS_STATUS_TRYAGAIN && *errnop == ERANGE)
/* Give the user a chance to get the same entry with a larger buffer. */
--entidx;
- __libc_lock_unlock (lock);
+ pthread_mutex_unlock (&lock);
return status;
}
@@ -207,9 +206,9 @@
memcpy (&((char *) key.data)[1], name, key.size - 1);
key.flags = 0;
- __libc_lock_lock (lock);
+ pthread_mutex_lock (&lock);
status = lookup (&key, result, buffer, buflen, errnop);
- __libc_lock_unlock (lock);
+ pthread_mutex_unlock (&lock);
return status;
}
diff -Nru nss_db-2.2.3pre1.orig/src/db-netgrp.c nss_db-2.2.3pre1/src/db-netgrp.c
--- nss_db-2.2.3pre1.orig/src/db-netgrp.c 2001-04-30 03:07:41.000000000 +0200
+++ nss_db-2.2.3pre1/src/db-netgrp.c 2005-07-09 14:21:40.276665816 +0200
@@ -21,8 +21,8 @@
#include <errno.h>
#include <fcntl.h>
#include <netgroup.h>
+#include <pthread.h>
#include <string.h>
-#include <bits/libc-lock.h>
#include <paths.h>
#include "nss_db.h"
@@ -32,7 +32,7 @@
/* Locks the static variables in this file. */
-__libc_lock_define_initialized (static, lock)
+static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
/* Maintenance of the shared handle open on the database. */
static DB *db;
@@ -44,7 +44,7 @@
{
enum nss_status status;
- __libc_lock_lock (lock);
+ pthread_mutex_lock (&lock);
status = internal_setent (DBFILE, &db);
@@ -60,7 +60,7 @@
cursor = entry = value.data;
}
- __libc_lock_unlock (lock);
+ pthread_mutex_unlock (&lock);
return status;
@@ -70,11 +70,11 @@
enum nss_status
_nss_db_endnetgrent (void)
{
- __libc_lock_lock (lock);
+ pthread_mutex_lock (&lock);
internal_endent (&db);
- __libc_lock_unlock (lock);
+ pthread_mutex_unlock (&lock);
return NSS_STATUS_SUCCESS;
}
@@ -91,11 +91,11 @@
{
int status;
- __libc_lock_lock (lock);
+ pthread_mutex_lock (&lock);
status = _nss_netgroup_parseline (&cursor, result, buffer, buflen, errnop);
- __libc_lock_unlock (lock);
+ pthread_mutex_unlock (&lock);
return status;
}
diff -Nru nss_db-2.2.3pre1.orig/src/db-open.c nss_db-2.2.3pre1/src/db-open.c
--- nss_db-2.2.3pre1.orig/src/db-open.c 2001-04-30 03:07:41.000000000 +0200
+++ nss_db-2.2.3pre1/src/db-open.c 2005-07-09 14:21:40.277665664 +0200
@@ -58,7 +58,7 @@
if (err != 0)
{
if (err > 0)
- __set_errno (err);
+ errno = err;
return NSS_STATUS_UNAVAIL;
}
@@ -75,7 +75,7 @@
fail:
db->close (db, 0);
if (err > 0)
- __set_errno (err);
+ errno = err;
return NSS_STATUS_UNAVAIL;
}
diff -Nru nss_db-2.2.3pre1.orig/src/db-XXX.c nss_db-2.2.3pre1/src/db-XXX.c
--- nss_db-2.2.3pre1.orig/src/db-XXX.c 2001-04-30 03:07:41.000000000 +0200
+++ nss_db-2.2.3pre1/src/db-XXX.c 2005-07-09 14:21:40.269666880 +0200
@@ -21,11 +21,10 @@
#include <ctype.h>
#include <db.h>
#include <netdb.h>
+#include <pthread.h>
#include <stdio.h>
#include <string.h>
-#include <bits/libc-lock.h>
-
#include "nss_db.h"
/* These symbols are defined by the including source file:
@@ -53,7 +52,7 @@
#endif
/* Locks the static variables in this file. */
-__libc_lock_define_initialized (static, lock)
+static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
/* Maintenance of the shared handle open on the database. */
@@ -68,7 +67,7 @@
{
enum nss_status status;
- __libc_lock_lock (lock);
+ pthread_mutex_lock (&lock);
status = internal_setent (DBFILE, &db);
@@ -78,7 +77,7 @@
/* Reset the sequential index. */
entidx = 0;
- __libc_lock_unlock (lock);
+ pthread_mutex_unlock (&lock);
return status;
}
@@ -88,14 +87,14 @@
enum nss_status
CONCAT(_nss_db_end,ENTNAME) (void)
{
- __libc_lock_lock (lock);
+ pthread_mutex_lock (&lock);
internal_endent (&db);
/* Reset STAYOPEN flag. */
keep_db = 0;
- __libc_lock_unlock (lock);
+ pthread_mutex_unlock (&lock);
return NSS_STATUS_SUCCESS;
}
@@ -227,10 +226,10 @@
key.data = alloca (size); \
key.size = KEYPRINTF keypattern; \
key.flags = 0; \
- __libc_lock_lock (lock); \
+ pthread_mutex_lock (&lock); \
status = lookup (&key, result, buffer, buflen, errnop H_ERRNO_ARG \
EXTRA_ARGS_VALUE); \
- __libc_lock_unlock (lock); \
+ pthread_mutex_unlock (&lock); \
return status; \
}
@@ -249,7 +248,7 @@
char buf[20];
DBT key;
- __libc_lock_lock (lock);
+ pthread_mutex_lock (&lock);
/* Loop until we find a valid entry or hit EOF. See above for the
special meaning of the status value. */
@@ -270,7 +269,7 @@
}
while (status == NSS_STATUS_RETURN);
- __libc_lock_unlock (lock);
+ pthread_mutex_unlock (&lock);
return status;
}
diff -Nru nss_db-2.2.3pre1.orig/src/Makefile.am nss_db-2.2.3pre1/src/Makefile.am
--- nss_db-2.2.3pre1.orig/src/Makefile.am 2001-04-30 03:19:31.000000000 +0200
+++ nss_db-2.2.3pre1/src/Makefile.am 2005-07-09 14:21:51.297990320 +0200
@@ -11,7 +11,7 @@
noinst_HEADERS = db-compat.h netgroup.h nss_db.h
-INCLUDES = @DB_CFLAGS@ -D_LIBC -D_GNU_SOURCE \
+INCLUDES = @DB_CFLAGS@ -D_GNU_SOURCE \
-I../intl -DLOCALEDIR=\"$(localedir)\"
EXTRA_DIST = libnss_db.map
|