Пример #1
0
int
crm_ipc_get_fd(crm_ipc_t *client)
{
    int fd = 0;
    
    CRM_ASSERT(client != NULL);
    if(qb_ipcc_fd_get(client->ipc, &fd) < 0) {
        crm_perror(LOG_ERR, "Could not obtain file IPC descriptor for %s", client->name);
    }
    return fd;
}
Пример #2
0
int
crm_ipc_get_fd(crm_ipc_t * client)
{
    int fd = 0;

    if (client && client->ipc && (qb_ipcc_fd_get(client->ipc, &fd) == 0)) {
        return fd;
    }
    errno = EINVAL;
    crm_perror(LOG_ERR, "Could not obtain file IPC descriptor for %s",
               (client? client->name : "unspecified client"));
    return -errno;
}
Пример #3
0
cs_error_t cmap_fd_get(cmap_handle_t handle, int *fd)
{
	cs_error_t error;
	struct cmap_inst *cmap_inst;

	error = hdb_error_to_cs(hdb_handle_get (&cmap_handle_t_db, handle, (void *)&cmap_inst));
	if (error != CS_OK) {
		return (error);
	}

	error = qb_to_cs_error (qb_ipcc_fd_get (cmap_inst->c, fd));

	(void)hdb_handle_put (&cmap_handle_t_db, handle);

	return (error);
}
Пример #4
0
cs_error_t
corosync_cfg_fd_get (
	corosync_cfg_handle_t cfg_handle,
	int32_t *selection_fd)
{
	struct cfg_inst *cfg_inst;
	cs_error_t error;

	error = hdb_error_to_cs (hdb_handle_get (&cfg_hdb, cfg_handle, (void *)&cfg_inst));
	if (error != CS_OK) {
		return (error);
	}

	error = qb_to_cs_error (qb_ipcc_fd_get (cfg_inst->c, selection_fd));

	(void)hdb_handle_put (&cfg_hdb, cfg_handle);
	return (error);
}
Пример #5
0
cs_error_t votequorum_fd_get (
        votequorum_handle_t handle,
        int *fd)
{
	cs_error_t error;
        struct votequorum_inst *votequorum_inst;

        error = hdb_error_to_cs(hdb_handle_get (&votequorum_handle_t_db, handle, (void *)&votequorum_inst));
        if (error != CS_OK) {
                return (error);
        }

	error = qb_to_cs_error(qb_ipcc_fd_get (votequorum_inst->c, fd));

	(void)hdb_handle_put (&votequorum_handle_t_db, handle);

	return (error);
}
Пример #6
0
unsigned int pload_fd_get (
	pload_handle_t handle,
	int *fd)
{
	cs_error_t error;
	struct pload_inst *pload_inst;

	error = hdb_error_to_cs(hdb_handle_get (&pload_handle_t_db, handle, (void *)&pload_inst));
	if (error != CS_OK) {
		return (error);
	}

	qb_ipcc_fd_get (pload_inst->c, fd);

	(void)hdb_handle_put (&pload_handle_t_db, handle);

	return (CS_OK);
}
Пример #7
0
  void IPCClientPrivate::connect()
  {
    _qb_conn = qb_ipcc_connect("usbguard", 1<<20);

    if (_qb_conn == nullptr) {
      throw IPCException(IPCException::ConnectionError, "IPC Connection not established");
    }

    qb_ipcc_fd_get(_qb_conn, &_qb_conn_fd);

    if (_qb_conn_fd < 0) {
      qb_ipcc_disconnect(_qb_conn);
      _qb_conn = nullptr;
      _qb_conn_fd = -1;
      throw IPCException(IPCException::ConnectionError, "Bad file descriptor");
    }

    qb_loop_poll_add(_qb_loop, QB_LOOP_HIGH, _qb_conn_fd, POLLIN, this, qbIPCMessageProcessFn);
    _p_instance.IPCConnected();
    return;
  }