Exemplo n.º 1
0
/**
 * The end of all things
 */
void
main_fini(void)
{
  prop_destroy_by_name(prop_get_global(), "popups");
  fini_group(INIT_GROUP_API);
  TRACE(TRACE_DEBUG, "core", "API group finished");
  fini_group(INIT_GROUP_IPC);
  TRACE(TRACE_DEBUG, "core", "IPC group finished");
#if ENABLE_PLAYQUEUE
  playqueue_fini();
  TRACE(TRACE_DEBUG, "core", "Playqueue finished");
#endif
  audio_fini();
  TRACE(TRACE_DEBUG, "core", "Audio finished");
  nav_fini();
  TRACE(TRACE_DEBUG, "core", "Navigator finished");
  backend_fini();
  TRACE(TRACE_DEBUG, "core", "Backend finished");
  shutdown_hook_run(0);
  TRACE(TRACE_DEBUG, "core", "Slow shutdown hooks finished");
  blobcache_fini();
  TRACE(TRACE_DEBUG, "core", "Blobcache finished");
#if ENABLE_METADATA
  metadb_fini();
  TRACE(TRACE_DEBUG, "core", "Metadb finished");
#endif
  kvstore_fini();
  notifications_fini();
  htsmsg_store_flush();
  TRACE(TRACE_DEBUG, "core", APPNAMEUSER" terminated normally");
  trace_fini();
}
Exemplo n.º 2
0
/**
 * The end of all things
 */
static void
finalize(void)
{
    audio_fini();
    backend_fini();
    shutdown_hook_run(0);
    arch_exit(showtime_retcode);
}
Exemplo n.º 3
0
/**
 * The end of all things
 */
void
showtime_fini(void)
{
  audio_fini();
  backend_fini();
  TRACE(TRACE_DEBUG, "core", "Backend finished");
  shutdown_hook_run(0);
  TRACE(TRACE_DEBUG, "core", "Slow shutdown hooks finished");
  blobcache_fini();
  TRACE(TRACE_DEBUG, "core", "Blobcache finished");
  metadb_fini();
  TRACE(TRACE_DEBUG, "core", "Metadb finished");
  kvstore_fini();
  notifications_fini();
  TRACE(TRACE_DEBUG, "core", "Showtime terminated normally");
  trace_fini();
}
Exemplo n.º 4
0
/*ARGSUSED*/
static void
main_switcher(void *cookie, char *argp, size_t arg_size, door_desc_t *desc,
    uint_t n_desc)
{
	repository_door_request_t *request;
	repository_door_response_t reply;
	door_desc_t reply_desc;

	thread_info_t *ti = thread_self();

	int send_desc = 0;
	int fd;

	thread_newstate(ti, TI_MAIN_DOOR_CALL);
	ti->ti_main_door_request = (void *)argp;

	assert(cookie == REPOSITORY_DOOR_COOKIE);

	reply.rdr_status = INVALID_RESULT;

	if (argp == DOOR_UNREF_DATA) {
		backend_fini();

		exit(CONFIGD_EXIT_LOST_MAIN_DOOR);
	}

	/*
	 * No file descriptors allowed
	 */
	assert(n_desc == 0);

	/*
	 * first, we just check the version
	 */
	if (arg_size < offsetofend(repository_door_request_t, rdr_version)) {
		reply.rdr_status = REPOSITORY_DOOR_FAIL_BAD_REQUEST;
		goto fail;
	}

	/* LINTED alignment */
	request = (repository_door_request_t *)argp;
	ti->ti_main_door_request = request;

	if (request->rdr_version != REPOSITORY_DOOR_VERSION) {
		reply.rdr_status = REPOSITORY_DOOR_FAIL_VERSION_MISMATCH;
		goto fail;
	}

	/*
	 * Now, check that the argument is of the minimum required size
	 */
	if (arg_size < offsetofend(repository_door_request_t, rdr_request)) {
		reply.rdr_status = REPOSITORY_DOOR_FAIL_BAD_REQUEST;
		goto fail;
	}

	if (door_ucred(&ti->ti_ucred) != 0) {
		reply.rdr_status = REPOSITORY_DOOR_FAIL_PERMISSION_DENIED;
		goto fail;
	}

	switch (request->rdr_request) {
	case REPOSITORY_DOOR_REQUEST_CONNECT:
		fd = -1;
		reply.rdr_status = create_connection(ti->ti_ucred, request,
		    arg_size, &fd);
		if (reply.rdr_status != REPOSITORY_DOOR_SUCCESS) {
			assert(fd == -1);
			goto fail;
		}
		assert(fd != -1);
		reply_desc.d_attributes = DOOR_DESCRIPTOR | DOOR_RELEASE;
		reply_desc.d_data.d_desc.d_descriptor = fd;
		send_desc = 1;
		break;

	default:
		reply.rdr_status = REPOSITORY_DOOR_FAIL_BAD_REQUEST;
		goto fail;
	}

fail:
	assert(reply.rdr_status != INVALID_RESULT);

	thread_newstate(ti, TI_DOOR_RETURN);
	ti->ti_main_door_request = NULL;

	(void) door_return((char *)&reply, sizeof (reply),
	    &reply_desc, (send_desc)? 1:0);
	(void) door_return(NULL, 0, NULL, 0);
}