예제 #1
0
파일: ipcs.c 프로젝트: ip1981/libqb
int32_t
qb_ipcs_run(struct qb_ipcs_service *s)
{
	int32_t res = 0;

	if (s->poll_fns.dispatch_add == NULL ||
	    s->poll_fns.dispatch_mod == NULL ||
	    s->poll_fns.dispatch_del == NULL) {
		return -EINVAL;
	}

	switch (s->type) {
	case QB_IPC_SOCKET:
		qb_ipcs_us_init((struct qb_ipcs_service *)s);
		break;
	case QB_IPC_SHM:
#if defined (HAVE_SEM_TIMEDWAIT) || defined(HAVE_SEMTIMEDOP)
		qb_ipcs_shm_init((struct qb_ipcs_service *)s);
#else
		res = -ENOTSUP;
#endif /* HAVE_SEM_TIMEDWAIT or HAVE_SEMTIMEDOP */
		break;
	case QB_IPC_POSIX_MQ:
#ifdef HAVE_POSIX_MQ
		qb_ipcs_pmq_init((struct qb_ipcs_service *)s);
#else
		res = -ENOTSUP;
#endif /* HAVE_POSIX_MQ */
		break;
	case QB_IPC_SYSV_MQ:
#ifdef HAVE_SYSV_MQ
		qb_ipcs_smq_init((struct qb_ipcs_service *)s);
#else
		res = -ENOTSUP;
#endif /* HAVE_SYSV_MQ */
		break;
	default:
		res = -EINVAL;
		break;
	}
	if (res < 0) {
		qb_ipcs_unref(s);
		return res;
	}
	res = qb_ipcs_us_publish(s);
	if (res < 0) {
		(void)qb_ipcs_us_withdraw(s);
		qb_ipcs_unref(s);
		return res;
	}

	return res;
}
예제 #2
0
파일: ipc_setup.c 프로젝트: jnpkrn/libqb
static void
destroy_ipc_auth_data(struct ipc_auth_data *data)
{
	if (data->s) {
		qb_ipcs_unref(data->s);
	}

#ifdef SO_PASSCRED
	free(data->cmsg_cred);
#endif
	free(data);
}
예제 #3
0
파일: ipcs.c 프로젝트: ip1981/libqb
void
qb_ipcs_destroy(struct qb_ipcs_service *s)
{
	qb_ipcs_unref(s);
}