Lines Matching defs:handle

512 	case REP_PROTOCOL_FAIL_NOT_LATEST:	/* TX code should handle this */
633 * Check if a handle is currently bound. fork()ing implicitly unbinds
634 * the handle in the child.
647 /* forked since our last bind -- initiate handle close */
675 * This makes a door request on the client door associated with handle h.
758 * Like make_door_call(), but takes an fd instead of a handle, and expects
932 scf_handle_decorate(scf_handle_t *handle, const char *name, scf_value_t *v)
935 handle != v->value_handle)
938 (void) pthread_mutex_lock(&handle->rh_lock);
939 if (handle_is_bound(handle)) {
940 (void) pthread_mutex_unlock(&handle->rh_lock);
943 (void) pthread_mutex_unlock(&handle->rh_lock);
947 (void) pthread_mutex_lock(&handle->rh_lock);
948 handle->rh_debug = 0;
949 (void) pthread_mutex_unlock(&handle->rh_lock);
955 (void) pthread_mutex_lock(&handle->rh_lock);
956 handle->rh_debug = (uid_t)val;
957 (void) pthread_mutex_unlock(&handle->rh_lock);
962 char name[sizeof (handle->rh_doorpath)];
965 (void) pthread_mutex_lock(&handle->rh_lock);
966 handle->rh_doorpath[0] = 0;
967 (void) pthread_mutex_unlock(&handle->rh_lock);
979 (void) pthread_mutex_lock(&handle->rh_lock);
980 (void) strlcpy(handle->rh_doorpath, name,
981 sizeof (handle->rh_doorpath));
982 (void) pthread_mutex_unlock(&handle->rh_lock);
988 (void) pthread_mutex_lock(&handle->rh_lock);
989 handle->rh_show_masked = 0;
990 (void) pthread_mutex_unlock(&handle->rh_lock);
992 (void) pthread_mutex_lock(&handle->rh_lock);
993 handle->rh_show_masked =
995 (void) pthread_mutex_unlock(&handle->rh_lock);
1007 _scf_handle_decorations(scf_handle_t *handle, scf_decoration_func *f,
1011 char name[sizeof (handle->rh_doorpath)];
1017 if (v->value_handle != handle)
1022 (void) pthread_mutex_lock(&handle->rh_lock);
1023 debug = handle->rh_debug;
1024 (void) pthread_mutex_unlock(&handle->rh_lock);
1037 (void) pthread_mutex_lock(&handle->rh_lock);
1038 (void) strlcpy(name, handle->rh_doorpath, sizeof (name));
1039 (void) pthread_mutex_unlock(&handle->rh_lock);
1054 * Fails if handle is not bound.
1057 handle_unbind_unlocked(scf_handle_t *handle)
1062 if (!handle_is_bound(handle))
1067 (void) make_door_call(handle, &request, sizeof (request),
1070 handle_do_close(handle);
1077 * _HANDLE_DESTROYED - dp's handle has been destroyed
1121 * _HANDLE_DESTROYED - iter's handle has been destroyed
1161 * _IN_USE - handle already bound
1178 scf_handle_bind(scf_handle_t *handle)
1191 (void) pthread_mutex_lock(&handle->rh_lock);
1192 if (handle_is_bound(handle)) {
1193 (void) pthread_mutex_unlock(&handle->rh_lock);
1198 while (handle->rh_fd_users > 0) {
1203 (void) pthread_cond_wait(&handle->rh_cv, &handle->rh_lock);
1208 if (handle_is_bound(handle)) {
1209 (void) pthread_mutex_unlock(&handle->rh_lock);
1213 assert(handle->rh_doorfd == -1 && handle->rh_doorfd_old == -1);
1215 if (handle->rh_doorpath[0] != 0)
1216 door_name = handle->rh_doorpath;
1220 (void) pthread_mutex_unlock(&handle->rh_lock);
1226 request.rdr_flags = handle->rh_flags | handle->rh_show_masked;
1227 request.rdr_debug = handle->rh_debug;
1232 &response, sizeof (response), &handle->rh_doorfd);
1237 (void) pthread_mutex_unlock(&handle->rh_lock);
1246 if (handle->rh_doorfd < 0) {
1247 (void) pthread_mutex_unlock(&handle->rh_lock);
1273 (void) fcntl(handle->rh_doorfd, F_SETFD, FD_CLOEXEC);
1275 if (door_info(handle->rh_doorfd, &info) < 0) {
1276 (void) close(handle->rh_doorfd);
1277 handle->rh_doorfd = -1;
1279 (void) pthread_mutex_unlock(&handle->rh_lock);
1283 handle->rh_doorpid = pid;
1284 handle->rh_doorid = info.di_uniquifier;
1289 for (el = uu_list_first(handle->rh_dataels); el != NULL;
1290 el = uu_list_next(handle->rh_dataels, el)) {
1293 (void) handle_unbind_unlocked(handle);
1294 (void) pthread_mutex_unlock(&handle->rh_lock);
1299 for (iter = uu_list_first(handle->rh_iters); iter != NULL;
1300 iter = uu_list_next(handle->rh_iters, iter)) {
1303 (void) handle_unbind_unlocked(handle);
1304 (void) pthread_mutex_unlock(&handle->rh_lock);
1308 (void) pthread_mutex_unlock(&handle->rh_lock);
1313 scf_handle_unbind(scf_handle_t *handle)
1316 (void) pthread_mutex_lock(&handle->rh_lock);
1317 ret = handle_unbind_unlocked(handle);
1318 (void) pthread_mutex_unlock(&handle->rh_lock);
1336 * Called when an object is removed from the handle. On the last remove,
1337 * cleans up and frees the handle.
1340 handle_unrefed(scf_handle_t *handle)
1352 assert(MUTEX_HELD(&handle->rh_lock));
1355 * Don't do anything if the handle has not yet been destroyed, there
1359 if (!(handle->rh_flags & HANDLE_DEAD) ||
1360 handle->rh_extrefs > 0 ||
1361 handle->rh_fd_users > 0 ||
1362 (handle->rh_flags & HANDLE_UNREFED)) {
1363 (void) pthread_mutex_unlock(&handle->rh_lock);
1367 handle->rh_flags |= HANDLE_UNREFED;
1372 * our subhandles and destroy the handle completely.
1374 assert(handle->rh_intrefs >= 0);
1375 handle->rh_extrefs = handle->rh_intrefs;
1376 handle->rh_intrefs = 0;
1377 (void) pthread_mutex_unlock(&handle->rh_lock);
1379 handle_hold_subhandles(handle, RH_HOLD_ALL);
1381 iter = handle->rh_iter;
1382 sc = handle->rh_scope;
1383 svc = handle->rh_service;
1384 inst = handle->rh_instance;
1385 snap = handle->rh_snapshot;
1386 snaplvl = handle->rh_snaplvl;
1387 pg = handle->rh_pg;
1388 prop = handle->rh_property;
1389 v = handle->rh_value;
1391 handle->rh_iter = NULL;
1392 handle->rh_scope = NULL;
1393 handle->rh_service = NULL;
1394 handle->rh_instance = NULL;
1395 handle->rh_snapshot = NULL;
1396 handle->rh_snaplvl = NULL;
1397 handle->rh_pg = NULL;
1398 handle->rh_property = NULL;
1399 handle->rh_value = NULL;
1420 (void) pthread_mutex_lock(&handle->rh_lock);
1423 assert(handle->rh_extrefs == 0);
1424 assert(handle->rh_intrefs == 0);
1425 assert(handle->rh_values == 0);
1426 assert(handle->rh_entries == 0);
1427 assert(uu_list_numnodes(handle->rh_dataels) == 0);
1428 assert(uu_list_numnodes(handle->rh_iters) == 0);
1430 uu_list_destroy(handle->rh_dataels);
1431 uu_list_destroy(handle->rh_iters);
1432 handle->rh_dataels = NULL;
1433 handle->rh_iters = NULL;
1434 (void) pthread_mutex_unlock(&handle->rh_lock);
1436 (void) pthread_mutex_destroy(&handle->rh_lock);
1438 uu_free(handle);
1442 scf_handle_destroy(scf_handle_t *handle)
1444 if (handle == NULL)
1447 (void) pthread_mutex_lock(&handle->rh_lock);
1448 if (handle->rh_flags & HANDLE_DEAD) {
1451 * handle after it is destroyed), but we can't report it.
1453 (void) pthread_mutex_unlock(&handle->rh_lock);
1456 handle->rh_flags |= HANDLE_DEAD;
1457 (void) handle_unbind_unlocked(handle);
1458 handle_unrefed(handle);
1552 handle_next_changeid(scf_handle_t *handle)
1556 assert(MUTEX_HELD(&handle->rh_lock));
1558 nextid = ++handle->rh_nextchangeid;
1560 nextid = ++handle->rh_nextchangeid;
1589 * we're in undefined territory (the user cannot use a handle
1819 * We hold the handle lock across both door calls, so that they
2066 * _NOT_BOUND - handle is not bound
2487 scf_handle_t *handle;
2495 handle = iter->iter_handle;
2497 (void) pthread_mutex_lock(&handle->rh_lock);
2501 (void) make_door_call(handle, &request, sizeof (request),
2504 uu_list_remove(handle->rh_iters, iter);
2505 --handle->rh_extrefs;
2506 handle_unrefed(handle); /* drops h->rh_lock */
2514 handle_get_local_scope_locked(scf_handle_t *handle, scf_scope_t *out)
2520 assert(MUTEX_HELD(&handle->rh_lock));
2522 if (handle != out->rd_d.rd_handle)
2530 r = make_door_call(handle, &request, sizeof (request),
2543 scf_iter_handle_scopes(scf_iter_t *iter, const scf_handle_t *handle)
2546 if (h != handle)
2935 * _INVALID_ARGUMENT - handle is NULL
2942 scf_scope_create(scf_handle_t *handle)
2948 if (datael_init(&ret->rd_d, handle,
2996 * Fails with _INVALID_ARGUMENT (handle is NULL), _HANDLE_DESTROYED, _INTERNAL
3000 scf_service_create(scf_handle_t *handle)
3005 if (datael_init(&ret->rd_d, handle,
3540 * Fails with _INVALID_ARGUMENT (handle is NULL), _HANDLE_DESTROYED, _INTERNAL
3544 scf_instance_create(scf_handle_t *handle)
3550 if (datael_init(&ret->rd_d, handle,
3585 * Fails with _INVALID_ARGUMENT (handle is NULL), _HANDLE_DESTROYED, _INTERNAL
3589 scf_snapshot_create(scf_handle_t *handle)
3595 if (datael_init(&ret->rd_d, handle,
3630 * Fails with _INVALID_ARGUMENT (handle is NULL), _HANDLE_DESTROYED, _INTERNAL
3634 scf_snaplevel_create(scf_handle_t *handle)
3640 if (datael_init(&ret->rd_d, handle,
3773 * Fails with _INVALID_ARGUMENT (handle is NULL), _HANDLE_DESTROYED, _INTERNAL
3777 scf_pg_create(scf_handle_t *handle)
3782 if (datael_init(&ret->rd_d, handle,
4172 * Fails with _INVALID_ARGUMENT (handle is NULL), _HANDLE_DESTROYED, _INTERNAL
4176 scf_property_create(scf_handle_t *handle)
4181 if (datael_init(&ret->rd_d, handle,
4502 * Fails with _NO_MEMORY, _INVALID_ARGUMENT (handle is NULL), _HANDLE_DESTROYED,
4506 scf_transaction_create(scf_handle_t *handle)
4515 if (datael_init(&ret->tran_pg.rd_d, handle,
5175 scf_decoration_create(scf_handle_t *handle)
5181 if (datael_init(&ret->rd_d, handle,
5675 h->rh_values++; /* keep the handle from going away */
8305 * _NOT_BOUND handle is not bound