Lines Matching refs:idmap_cache

29  * This module provides the libidmap idmap_cache.
42 #include "idmap_cache.h"
166 typedef struct idmap_cache {
190 static idmap_cache_t idmap_cache;
289 avl_create(&idmap_cache.sid2uid_gid.tree,
292 (void) pthread_mutex_init(&idmap_cache.sid2uid_gid.mutex, NULL);
293 idmap_cache.sid2uid_gid.head.flink = &idmap_cache.sid2uid_gid.head;
294 idmap_cache.sid2uid_gid.head.blink = &idmap_cache.sid2uid_gid.head;
295 idmap_cache.sid2uid_gid.prev = NULL;
296 idmap_cache.sid2uid_gid.purge_time = 0;
297 idmap_cache.sid2uid_gid.uid_num = 0;
298 idmap_cache.sid2uid_gid.gid_num = 0;
299 idmap_cache.sid2uid_gid.pid_num = 0;
301 avl_create(&idmap_cache.uid2sid_winname.tree,
304 (void) pthread_mutex_init(&idmap_cache.uid2sid_winname.mutex, NULL);
305 idmap_cache.uid2sid_winname.head.flink =
306 &idmap_cache.uid2sid_winname.head;
307 idmap_cache.uid2sid_winname.head.blink =
308 &idmap_cache.uid2sid_winname.head;
309 idmap_cache.uid2sid_winname.prev = NULL;
310 idmap_cache.uid2sid_winname.purge_time = 0;
311 idmap_cache.uid2sid_winname.sid_num = 0;
312 idmap_cache.uid2sid_winname.winname_num = 0;
314 avl_create(&idmap_cache.gid2sid_winname.tree,
317 (void) pthread_mutex_init(&idmap_cache.gid2sid_winname.mutex, NULL);
318 idmap_cache.gid2sid_winname.head.flink =
319 &idmap_cache.gid2sid_winname.head;
320 idmap_cache.gid2sid_winname.head.blink =
321 &idmap_cache.gid2sid_winname.head;
322 idmap_cache.gid2sid_winname.prev = NULL;
323 idmap_cache.gid2sid_winname.purge_time = 0;
324 idmap_cache.gid2sid_winname.sid_num = 0;
325 idmap_cache.gid2sid_winname.winname_num = 0;
327 avl_create(&idmap_cache.winname2uid_gid.tree,
330 (void) pthread_mutex_init(&idmap_cache.winname2uid_gid.mutex, NULL);
331 idmap_cache.winname2uid_gid.head.flink =
332 &idmap_cache.winname2uid_gid.head;
333 idmap_cache.winname2uid_gid.head.blink =
334 &idmap_cache.winname2uid_gid.head;
335 idmap_cache.winname2uid_gid.prev = NULL;
336 idmap_cache.winname2uid_gid.purge_time = 0;
337 idmap_cache.winname2uid_gid.uid_num = 0;
338 idmap_cache.winname2uid_gid.gid_num = 0;
351 (void) pthread_mutex_lock(&idmap_cache.sid2uid_gid.mutex);
354 &idmap_cache.sid2uid_gid.tree, &cookie)) != NULL) {
358 avl_destroy(&idmap_cache.sid2uid_gid.tree);
359 avl_create(&idmap_cache.sid2uid_gid.tree,
362 idmap_cache.sid2uid_gid.head.flink = &idmap_cache.sid2uid_gid.head;
363 idmap_cache.sid2uid_gid.head.blink = &idmap_cache.sid2uid_gid.head;
364 idmap_cache.sid2uid_gid.prev = NULL;
365 idmap_cache.sid2uid_gid.purge_time = 0;
366 idmap_cache.sid2uid_gid.uid_num = 0;
367 idmap_cache.sid2uid_gid.gid_num = 0;
368 idmap_cache.sid2uid_gid.pid_num = 0;
369 (void) pthread_mutex_unlock(&idmap_cache.sid2uid_gid.mutex);
372 (void) pthread_mutex_lock(&idmap_cache.uid2sid_winname.mutex);
375 &idmap_cache.uid2sid_winname.tree, &cookie)) != NULL) {
382 avl_destroy(&idmap_cache.uid2sid_winname.tree);
383 avl_create(&idmap_cache.uid2sid_winname.tree,
386 idmap_cache.uid2sid_winname.head.flink =
387 &idmap_cache.uid2sid_winname.head;
388 idmap_cache.uid2sid_winname.head.blink =
389 &idmap_cache.uid2sid_winname.head;
390 idmap_cache.uid2sid_winname.prev = NULL;
391 idmap_cache.uid2sid_winname.purge_time = 0;
392 idmap_cache.uid2sid_winname.sid_num = 0;
393 idmap_cache.uid2sid_winname.winname_num = 0;
394 (void) pthread_mutex_unlock(&idmap_cache.uid2sid_winname.mutex);
397 (void) pthread_mutex_lock(&idmap_cache.gid2sid_winname.mutex);
400 &idmap_cache.gid2sid_winname.tree, &cookie)) != NULL) {
407 avl_destroy(&idmap_cache.gid2sid_winname.tree);
408 avl_create(&idmap_cache.gid2sid_winname.tree,
411 idmap_cache.gid2sid_winname.head.flink =
412 &idmap_cache.gid2sid_winname.head;
413 idmap_cache.gid2sid_winname.head.blink =
414 &idmap_cache.gid2sid_winname.head;
415 idmap_cache.gid2sid_winname.prev = NULL;
416 idmap_cache.gid2sid_winname.purge_time = 0;
417 idmap_cache.gid2sid_winname.sid_num = 0;
418 idmap_cache.gid2sid_winname.winname_num = 0;
419 (void) pthread_mutex_unlock(&idmap_cache.gid2sid_winname.mutex);
421 (void) pthread_mutex_lock(&idmap_cache.winname2uid_gid.mutex);
424 &idmap_cache.winname2uid_gid.tree, &cookie)) != NULL) {
430 avl_destroy(&idmap_cache.winname2uid_gid.tree);
431 avl_create(&idmap_cache.winname2uid_gid.tree,
434 idmap_cache.winname2uid_gid.head.flink =
435 &idmap_cache.winname2uid_gid.head;
436 idmap_cache.winname2uid_gid.head.blink =
437 &idmap_cache.winname2uid_gid.head;
438 idmap_cache.winname2uid_gid.prev = NULL;
439 idmap_cache.winname2uid_gid.purge_time = 0;
440 idmap_cache.winname2uid_gid.uid_num = 0;
441 idmap_cache.winname2uid_gid.gid_num = 0;
442 (void) pthread_mutex_unlock(&idmap_cache.winname2uid_gid.mutex);
453 (void) pthread_mutex_lock(&idmap_cache.sid2uid_gid.mutex);
454 *uidbysid = idmap_cache.sid2uid_gid.uid_num;
455 *gidbysid = idmap_cache.sid2uid_gid.gid_num;
456 *pidbysid = idmap_cache.sid2uid_gid.pid_num;
457 (void) pthread_mutex_unlock(&idmap_cache.sid2uid_gid.mutex);
459 (void) pthread_mutex_lock(&idmap_cache.uid2sid_winname.mutex);
460 *sidbyuid = idmap_cache.uid2sid_winname.sid_num;
461 *winnamebyuid = idmap_cache.uid2sid_winname.winname_num;
462 (void) pthread_mutex_unlock(&idmap_cache.uid2sid_winname.mutex);
464 (void) pthread_mutex_lock(&idmap_cache.gid2sid_winname.mutex);
465 *sidbygid = idmap_cache.gid2sid_winname.sid_num;
466 *winnamebygid = idmap_cache.gid2sid_winname.winname_num;
467 (void) pthread_mutex_unlock(&idmap_cache.gid2sid_winname.mutex);
469 (void) pthread_mutex_lock(&idmap_cache.winname2uid_gid.mutex);
470 *uidbywinname = idmap_cache.winname2uid_gid.uid_num;
471 *gidbywinname = idmap_cache.winname2uid_gid.gid_num;
472 (void) pthread_mutex_unlock(&idmap_cache.winname2uid_gid.mutex);
489 (void) pthread_mutex_lock(&idmap_cache.sid2uid_gid.mutex);
491 result = avl_find(&idmap_cache.sid2uid_gid.tree, &entry, &where);
493 list_move(&idmap_cache.sid2uid_gid.head, result);
500 (void) pthread_mutex_unlock(&idmap_cache.sid2uid_gid.mutex);
520 (void) pthread_mutex_lock(&idmap_cache.sid2uid_gid.mutex);
522 result = avl_find(&idmap_cache.sid2uid_gid.tree, &entry, &where);
524 list_move(&idmap_cache.sid2uid_gid.head, result);
531 (void) pthread_mutex_unlock(&idmap_cache.sid2uid_gid.mutex);
552 (void) pthread_mutex_lock(&idmap_cache.sid2uid_gid.mutex);
554 result = avl_find(&idmap_cache.sid2uid_gid.tree, &entry, &where);
556 list_move(&idmap_cache.sid2uid_gid.head, result);
569 (void) pthread_mutex_unlock(&idmap_cache.sid2uid_gid.mutex);
588 (void) pthread_mutex_lock(&idmap_cache.uid2sid_winname.mutex);
590 result = avl_find(&idmap_cache.uid2sid_winname.tree, &entry, &where);
592 list_move(&idmap_cache.uid2sid_winname.head, result);
603 (void) pthread_mutex_unlock(&idmap_cache.uid2sid_winname.mutex);
620 (void) pthread_mutex_lock(&idmap_cache.gid2sid_winname.mutex);
622 result = avl_find(&idmap_cache.gid2sid_winname.tree, &entry, &where);
624 list_move(&idmap_cache.gid2sid_winname.head, result);
635 (void) pthread_mutex_unlock(&idmap_cache.gid2sid_winname.mutex);
652 (void) pthread_mutex_lock(&idmap_cache.uid2sid_winname.mutex);
654 result = avl_find(&idmap_cache.uid2sid_winname.tree, &entry, &where);
656 list_move(&idmap_cache.uid2sid_winname.head, result);
680 (void) pthread_mutex_unlock(&idmap_cache.uid2sid_winname.mutex);
697 (void) pthread_mutex_lock(&idmap_cache.gid2sid_winname.mutex);
699 result = avl_find(&idmap_cache.gid2sid_winname.tree, &entry, &where);
701 list_move(&idmap_cache.gid2sid_winname.head, result);
725 (void) pthread_mutex_unlock(&idmap_cache.gid2sid_winname.mutex);
744 (void) pthread_mutex_lock(&idmap_cache.winname2uid_gid.mutex);
746 result = avl_find(&idmap_cache.winname2uid_gid.tree, &entry, &where);
748 list_move(&idmap_cache.winname2uid_gid.head, result);
755 (void) pthread_mutex_unlock(&idmap_cache.winname2uid_gid.mutex);
774 (void) pthread_mutex_lock(&idmap_cache.winname2uid_gid.mutex);
776 result = avl_find(&idmap_cache.winname2uid_gid.tree, &entry, &where);
778 list_move(&idmap_cache.winname2uid_gid.head, result);
785 (void) pthread_mutex_unlock(&idmap_cache.winname2uid_gid.mutex);
809 (void) pthread_mutex_lock(&idmap_cache.sid2uid_gid.mutex);
810 result = avl_find(&idmap_cache.sid2uid_gid.tree, &find, &where);
814 idmap_cache.sid2uid_gid.uid_num++;
832 idmap_cache.sid2uid_gid.uid_num++;
834 list_insert(&idmap_cache.sid2uid_gid.head, new);
835 avl_insert(&idmap_cache.sid2uid_gid.tree, new, where);
837 if ((avl_numnodes(&idmap_cache.sid2uid_gid.tree) >
839 (idmap_cache.sid2uid_gid.purge_time + CACHE_PURGE_INTERVAL <
841 idmap_purge_sid2uid_gid_cache(&idmap_cache.sid2uid_gid,
845 (void) pthread_mutex_unlock(&idmap_cache.sid2uid_gid.mutex);
856 (void) pthread_mutex_lock(&idmap_cache.uid2sid_winname.mutex);
857 result = avl_find(&idmap_cache.uid2sid_winname.tree, &find,
864 idmap_cache.uid2sid_winname.sid_num++;
882 idmap_cache.uid2sid_winname.sid_num ++;
884 list_insert(&idmap_cache.uid2sid_winname.head, new);
885 avl_insert(&idmap_cache.uid2sid_winname.tree, new,
888 if ((avl_numnodes(&idmap_cache.uid2sid_winname.tree) >
890 (idmap_cache.uid2sid_winname.purge_time +
893 &idmap_cache.uid2sid_winname,
898 (void) pthread_mutex_unlock(&idmap_cache.uid2sid_winname.mutex);
921 (void) pthread_mutex_lock(&idmap_cache.sid2uid_gid.mutex);
922 result = avl_find(&idmap_cache.sid2uid_gid.tree, &find, &where);
926 idmap_cache.sid2uid_gid.gid_num++;
944 idmap_cache.sid2uid_gid.gid_num++;
946 list_insert(&idmap_cache.sid2uid_gid.head, new);
947 avl_insert(&idmap_cache.sid2uid_gid.tree, new, where);
949 if ((avl_numnodes(&idmap_cache.sid2uid_gid.tree) >
951 (idmap_cache.sid2uid_gid.purge_time + CACHE_PURGE_INTERVAL <
953 idmap_purge_sid2uid_gid_cache(&idmap_cache.sid2uid_gid,
957 (void) pthread_mutex_unlock(&idmap_cache.sid2uid_gid.mutex);
968 (void) pthread_mutex_lock(&idmap_cache.gid2sid_winname.mutex);
969 result = avl_find(&idmap_cache.gid2sid_winname.tree, &find,
976 idmap_cache.gid2sid_winname.sid_num++;
994 idmap_cache.gid2sid_winname.sid_num++;
996 list_insert(&idmap_cache.gid2sid_winname.head, new);
997 avl_insert(&idmap_cache.gid2sid_winname.tree, new,
1000 if ((avl_numnodes(&idmap_cache.gid2sid_winname.tree) >
1002 (idmap_cache.gid2sid_winname.purge_time +
1005 &idmap_cache.gid2sid_winname,
1009 (void) pthread_mutex_unlock(&idmap_cache.gid2sid_winname.mutex);
1031 (void) pthread_mutex_lock(&idmap_cache.sid2uid_gid.mutex);
1032 result = avl_find(&idmap_cache.sid2uid_gid.tree, &find, &where);
1036 idmap_cache.sid2uid_gid.pid_num++;
1040 idmap_cache.sid2uid_gid.uid_num++;
1045 idmap_cache.sid2uid_gid.gid_num++;
1065 idmap_cache.sid2uid_gid.uid_num++;
1071 idmap_cache.sid2uid_gid.gid_num++;
1073 idmap_cache.sid2uid_gid.pid_num++;
1075 list_insert(&idmap_cache.sid2uid_gid.head, new);
1076 avl_insert(&idmap_cache.sid2uid_gid.tree, new, where);
1078 if ((avl_numnodes(&idmap_cache.sid2uid_gid.tree) >
1080 (idmap_cache.sid2uid_gid.purge_time + CACHE_PURGE_INTERVAL <
1082 idmap_purge_sid2uid_gid_cache(&idmap_cache.sid2uid_gid,
1086 (void) pthread_mutex_unlock(&idmap_cache.sid2uid_gid.mutex);
1098 &idmap_cache.uid2sid_winname.mutex);
1099 result = avl_find(&idmap_cache.uid2sid_winname.tree,
1107 idmap_cache.uid2sid_winname.sid_num++;
1124 idmap_cache.uid2sid_winname.sid_num++;
1126 list_insert(&idmap_cache.uid2sid_winname.head,
1128 avl_insert(&idmap_cache.uid2sid_winname.tree,
1131 if ((avl_numnodes(&idmap_cache.uid2sid_winname.tree) >
1133 (idmap_cache.uid2sid_winname.purge_time +
1136 &idmap_cache.uid2sid_winname,
1141 &idmap_cache.uid2sid_winname.mutex);
1144 &idmap_cache.gid2sid_winname.mutex);
1145 result = avl_find(&idmap_cache.gid2sid_winname.tree,
1153 idmap_cache.gid2sid_winname.sid_num++;
1170 idmap_cache.gid2sid_winname.sid_num++;
1172 list_insert(&idmap_cache.gid2sid_winname.head,
1174 avl_insert(&idmap_cache.gid2sid_winname.tree,
1177 if ((avl_numnodes(&idmap_cache.gid2sid_winname.tree) >
1179 (idmap_cache.gid2sid_winname.purge_time +
1182 &idmap_cache.gid2sid_winname,
1186 &idmap_cache.gid2sid_winname.mutex);
1210 (void) pthread_mutex_lock(&idmap_cache.winname2uid_gid.mutex);
1211 result = avl_find(&idmap_cache.winname2uid_gid.tree, &find,
1216 idmap_cache.winname2uid_gid.uid_num++;
1241 idmap_cache.winname2uid_gid.uid_num++;
1243 list_insert(&idmap_cache.winname2uid_gid.head, new);
1244 avl_insert(&idmap_cache.winname2uid_gid.tree, new,
1247 if ((avl_numnodes(&idmap_cache.winname2uid_gid.tree) >
1249 (idmap_cache.winname2uid_gid.purge_time +
1252 &idmap_cache.winname2uid_gid,
1255 (void) pthread_mutex_unlock(&idmap_cache.winname2uid_gid.mutex);
1266 (void) pthread_mutex_lock(&idmap_cache.uid2sid_winname.mutex);
1267 result = avl_find(&idmap_cache.uid2sid_winname.tree, &find,
1276 idmap_cache.uid2sid_winname.winname_num++;
1301 idmap_cache.uid2sid_winname.winname_num ++;
1303 list_insert(&idmap_cache.uid2sid_winname.head, new);
1304 avl_insert(&idmap_cache.uid2sid_winname.tree, new,
1307 if ((avl_numnodes(&idmap_cache.uid2sid_winname.tree) >
1309 (idmap_cache.uid2sid_winname.purge_time +
1312 &idmap_cache.uid2sid_winname,
1315 (void) pthread_mutex_unlock(&idmap_cache.uid2sid_winname.mutex);
1340 (void) pthread_mutex_lock(&idmap_cache.winname2uid_gid.mutex);
1341 result = avl_find(&idmap_cache.winname2uid_gid.tree, &find,
1346 idmap_cache.winname2uid_gid.gid_num++;
1372 idmap_cache.winname2uid_gid.gid_num++;
1374 list_insert(&idmap_cache.winname2uid_gid.head, new);
1375 avl_insert(&idmap_cache.winname2uid_gid.tree, new,
1378 if ((avl_numnodes(&idmap_cache.winname2uid_gid.tree) >
1380 (idmap_cache.winname2uid_gid.purge_time +
1383 &idmap_cache.winname2uid_gid,
1386 (void) pthread_mutex_unlock(&idmap_cache.winname2uid_gid.mutex);
1397 (void) pthread_mutex_lock(&idmap_cache.gid2sid_winname.mutex);
1398 result = avl_find(&idmap_cache.gid2sid_winname.tree, &find,
1407 idmap_cache.gid2sid_winname.winname_num++;
1433 idmap_cache.gid2sid_winname.winname_num ++;
1435 list_insert(&idmap_cache.gid2sid_winname.head, new);
1436 avl_insert(&idmap_cache.gid2sid_winname.tree, new,
1439 if ((avl_numnodes(&idmap_cache.gid2sid_winname.tree) >
1441 (idmap_cache.gid2sid_winname.purge_time +
1444 &idmap_cache.gid2sid_winname,
1447 (void) pthread_mutex_unlock(&idmap_cache.gid2sid_winname.mutex);