Lines Matching defs:groupp

79 free_group(vntsd_group_t *groupp)
81 assert(groupp);
82 (void) mutex_destroy(&groupp->lock);
83 (void) cond_destroy(&groupp->cvp);
84 if (groupp->sockfd != -1)
85 (void) close(groupp->sockfd);
86 free(groupp);
96 vntsd_group_t *groupp;
103 groupp = consp->group;
104 assert(groupp);
126 (void) mutex_lock(&groupp->lock);
127 assert(groupp->num_cons > 0);
128 groupp->num_cons--;
129 (void) mutex_unlock(&groupp->lock);
138 find_clean_cons_group(vntsd_group_t *groupp)
140 if (groupp->status & VNTSD_GROUP_CLEAN_CONS) {
162 vntsd_group_t *groupp;
168 groupp = vntsd_que_walk(vntsdp->grouppq,
170 if (groupp == NULL) {
175 (void) mutex_lock(&groupp->lock);
176 groupp->status &= ~VNTSD_GROUP_CLEAN_CONS;
177 (void) mutex_unlock(&groupp->lock);
182 (void) mutex_lock(&groupp->lock);
185 if (groupp->conspq != NULL) {
186 consp = vntsd_que_walk(groupp->conspq,
190 (void) mutex_unlock(&groupp->lock);
195 (void) vntsd_que_rm(&groupp->conspq, consp);
196 (void) mutex_unlock(&groupp->lock);
203 if (groupp->conspq == NULL) {
205 assert(groupp->vntsd);
207 (void) mutex_lock(&groupp->vntsd->lock);
208 (void) vntsd_que_rm(&groupp->vntsd->grouppq,
209 groupp);
210 (void) mutex_unlock(&groupp->vntsd->lock);
213 vntsd_clean_group(groupp);
222 vntsd_clean_group(vntsd_group_t *groupp)
228 groupp->group_name, groupp->tcp_port);
230 (void) mutex_lock(&groupp->lock);
233 if (groupp->status & VNTSD_GROUP_IN_CLEANUP) {
234 (void) mutex_unlock(&groupp->lock);
237 groupp->status |= VNTSD_GROUP_IN_CLEANUP;
240 groupp->status |= VNTSD_GROUP_SIG_WAIT;
241 (void) mutex_unlock(&groupp->lock);
243 vntsd_free_que(&groupp->conspq, (clean_func_t)cleanup_cons);
245 (void) mutex_lock(&groupp->lock);
247 while (groupp->no_cons_clientpq != NULL) {
248 (void) vntsd_que_walk(groupp->no_cons_clientpq,
252 (void) cond_reltimedwait(&groupp->cvp, &groupp->lock, &to);
256 while (groupp->status & VNTSD_GROUP_SIG_WAIT) {
258 (void) thr_kill(groupp->listen_tid, SIGUSR1);
262 (void) cond_reltimedwait(&groupp->cvp, &groupp->lock, &to);
265 (void) mutex_unlock(&groupp->lock);
266 (void) thr_join(groupp->listen_tid, NULL, NULL);
268 free_group(groupp);
273 alloc_cons(vntsd_group_t *groupp, vcc_console_t *consolep)
298 (void) mutex_lock(&groupp->lock);
300 if ((rv = vntsd_que_append(&groupp->conspq, consp)) !=
302 (void) mutex_unlock(&groupp->lock);
307 groupp->num_cons++;
308 consp->group = groupp;
310 (void) mutex_unlock(&groupp->lock);
320 grp_by_tcp(vntsd_group_t *groupp, uint64_t *tcp_port)
322 assert(groupp);
324 return (groupp->tcp_port == *tcp_port);
331 vntsd_group_t *groupp;
334 groupp = (vntsd_group_t *)malloc(sizeof (vntsd_group_t));
335 if (groupp == NULL) {
341 bzero(groupp, sizeof (vntsd_group_t));
343 (void) mutex_init(&groupp->lock, USYNC_THREAD|LOCK_ERRORCHECK, NULL);
344 (void) cond_init(&groupp->cvp, USYNC_THREAD, NULL);
347 (void) memcpy(groupp->group_name, group_name, MAXPATHLEN);
350 groupp->tcp_port = tcp_port;
351 groupp->listen_tid = (thread_t)-1;
352 groupp->sockfd = -1;
353 groupp->vntsd = vntsdp;
355 D1(stderr, "t@%d alloc_group@%lld:%s\n", thr_self(), groupp->tcp_port,
356 groupp->group_name);
358 return (groupp);
379 vntsd_group_t *groupp = NULL;
388 groupp = vntsd_que_find(vntsdp->grouppq,
390 if (groupp != NULL)
391 (void) mutex_lock(&groupp->lock);
395 if (groupp != NULL) {
415 if (vntsd_chk_group_total_cons(groupp) == 0) {
418 (void) vntsd_que_walk(groupp->conspq,
420 groupp->status |= VNTSD_GROUP_CLEAN_CONS;
421 (void) mutex_unlock(&groupp->lock);
422 groupp = NULL;
424 } else if (strcmp(groupp->group_name, consp->group_name)) {
428 (void) mutex_unlock(&groupp->lock);
433 (void) mutex_unlock(&groupp->lock);
438 if (groupp == NULL) {
440 groupp = alloc_group(vntsdp, consp->group_name,
442 if (groupp == NULL) {
446 assert(groupp->conspq == NULL);
449 rv = vntsd_que_append(&vntsdp->grouppq, groupp);
456 *new_groupp = groupp;
460 if (alloc_cons(groupp, consp) == NULL) {
464 free_group(groupp);
477 create_listen_thread(vntsd_group_t *groupp)
483 assert(groupp);
485 (void) mutex_lock(&groupp->lock);
486 assert(groupp->num_cons);
488 D1(stderr, "t@%d create_listen:%lld\n", thr_self(), groupp->tcp_port);
491 (void *)groupp, THR_DETACHED, &groupp->listen_tid))
495 "group %s tcp %llx\n", groupp->group_name,
496 groupp->tcp_port);
500 vntsd_free_que(&groupp->conspq, (clean_func_t)free_cons);
501 groupp->listen_tid = (thread_t)-1;
504 (void) mutex_unlock(&groupp->lock);
540 find_cons_group_by_cons_no(vntsd_group_t *groupp, uint_t *cons_no)
544 consp = vntsd_que_find(groupp->conspq,
554 vntsd_group_t *groupp;
559 groupp = vntsd_que_find(vntsdp->grouppq,
564 if (groupp == NULL) {
570 (void) mutex_lock(&groupp->lock);
571 consp = vntsd_que_find(groupp->conspq,
576 (void) mutex_unlock(&groupp->lock);
586 (void) mutex_unlock(&groupp->lock);
591 groupp->status |= VNTSD_GROUP_CLEAN_CONS;
594 (void) mutex_unlock(&groupp->lock);
603 vntsd_group_t *groupp;
624 if ((rv = alloc_cons_with_group(vntsdp, &console, &groupp)) !=
631 if (groupp != NULL) {
634 if (create_listen_thread(groupp)) {
636 free_group(groupp);
685 vntsd_group_t *groupp;
719 if (alloc_cons_with_group(vntsdp, &consp[i], &groupp)
729 groupp = vntsd_que_walk(vntsdp->grouppq,
731 if (groupp == NULL) {