コード例 #1
0
ファイル: ifevent.c プロジェクト: nirmoy/wicked
void
ni_server_deactivate_interface_events(void)
{
	ni_server_deactivate_interface_uevents();

	if (__ni_rtevent_sock) {
		ni_socket_t *sock = __ni_rtevent_sock;
		__ni_rtevent_sock = NULL;

		ni_socket_deactivate(sock);
		ni_socket_release(sock);
	}
	ni_global.rule_event = NULL;
	ni_global.route_event = NULL;
	ni_global.interface_event = NULL;
	ni_global.interface_addr_event = NULL;
	ni_global.interface_prefix_event = NULL;
}
コード例 #2
0
ファイル: process.c プロジェクト: mijos/wicked
/*
 * Connect the subprocess output to our I/O handling loop
 */
static void
__ni_process_output_recv(ni_socket_t *sock)
{
	ni_process_t *pi = sock->user_data;
	ni_buffer_t *rbuf = &sock->rbuf;
	int cnt;

	ni_assert(pi);
	if (ni_buffer_tailroom(rbuf) < 256)
		ni_buffer_ensure_tailroom(rbuf, 4096);

	cnt = recv(sock->__fd, ni_buffer_tail(rbuf), ni_buffer_tailroom(rbuf), MSG_DONTWAIT);
	if (cnt >= 0) {
		rbuf->tail += cnt;
	} else if (errno != EWOULDBLOCK) {
		ni_error("read error on subprocess pipe: %m");
		ni_socket_deactivate(sock);
	}
}
コード例 #3
0
ファイル: process.c プロジェクト: gsanso/wicked
/*
 * Connect the subprocess output to our I/O handling loop
 */
static void
__ni_process_output_recv(ni_socket_t *sock)
{
	ni_process_t *pi = sock->user_data;
	ni_buffer_t *rbuf = &sock->rbuf;
	int cnt;

	ni_assert(pi);

	/* Grow socket input buffer as needed.
	 * NB: we may put an upper limit on how much process output we capture.
	 * Anything beyond a few MB is insane...
	 */
	if (ni_buffer_tailroom(rbuf) < 256)
		ni_buffer_ensure_tailroom(rbuf, 4096);

	cnt = recv(sock->__fd, ni_buffer_tail(rbuf), ni_buffer_tailroom(rbuf), MSG_DONTWAIT);
	if (cnt >= 0) {
		rbuf->tail += cnt;
	} else if (errno != EWOULDBLOCK) {
		ni_error("read error on subprocess pipe: %m");
		ni_socket_deactivate(sock);
	}
}