543 }
544
545 static void
546 child_gone(uid_t uid, pid_t pid, int status)
547 {
548 char door_file[64];
549 int x;
550
551 if (d_flag)
552 fprintf(stderr, "child_gone: uid %d pid %d\n",
553 uid, (int)pid);
554
555 snprintf(door_file, sizeof (door_file),
556 SMBIOD_RUNDIR "/%d", uid);
557 unlink(door_file);
558
559 if (WIFEXITED(status)) {
560 x = WEXITSTATUS(status);
561 if (x != 0) {
562 fprintf(stderr,
563 "uid %d, pid %d exit %d",
564 uid, (int)pid, x);
565 }
566 }
567 if (WIFSIGNALED(status)) {
568 x = WTERMSIG(status);
569 fprintf(stderr,
570 "uid %d, pid %d signal %d",
571 uid, (int)pid, x);
572 }
573 }
574
575 /*
576 * Final cleanup before exit. Unlink child doors, etc.
577 * Called while single threaded, so no locks needed here.
578 * The list is normally empty by now due to svc_sigchld
579 * calls during shutdown. But in case there were any
580 * straglers, do cleanup here. Don't bother freeing any
581 * list elements here, as we're exiting.
582 */
583 static void
584 svc_cleanup(void)
585 {
586 child_t *cp;
587
588 LIST_FOREACH(cp, &child_list, list) {
589 child_gone(cp->uid, cp->pid, 0);
590 }
|
543 }
544
545 static void
546 child_gone(uid_t uid, pid_t pid, int status)
547 {
548 char door_file[64];
549 int x;
550
551 if (d_flag)
552 fprintf(stderr, "child_gone: uid %d pid %d\n",
553 uid, (int)pid);
554
555 snprintf(door_file, sizeof (door_file),
556 SMBIOD_RUNDIR "/%d", uid);
557 unlink(door_file);
558
559 if (WIFEXITED(status)) {
560 x = WEXITSTATUS(status);
561 if (x != 0) {
562 fprintf(stderr,
563 "uid %d, pid %d exit %d\n",
564 uid, (int)pid, x);
565 }
566 }
567 if (WIFSIGNALED(status)) {
568 x = WTERMSIG(status);
569 fprintf(stderr,
570 "uid %d, pid %d signal %d\n",
571 uid, (int)pid, x);
572 }
573 }
574
575 /*
576 * Final cleanup before exit. Unlink child doors, etc.
577 * Called while single threaded, so no locks needed here.
578 * The list is normally empty by now due to svc_sigchld
579 * calls during shutdown. But in case there were any
580 * straglers, do cleanup here. Don't bother freeing any
581 * list elements here, as we're exiting.
582 */
583 static void
584 svc_cleanup(void)
585 {
586 child_t *cp;
587
588 LIST_FOREACH(cp, &child_list, list) {
589 child_gone(cp->uid, cp->pid, 0);
590 }
|