本文整理汇总了C++中sd_event_exit函数的典型用法代码示例。如果您正苦于以下问题:C++ sd_event_exit函数的具体用法?C++ sd_event_exit怎么用?C++ sd_event_exit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sd_event_exit函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: test_client_solicit_cb
static void test_client_solicit_cb(sd_dhcp6_client *client, int event,
void *userdata) {
sd_event *e = userdata;
sd_dhcp6_lease *lease;
struct in6_addr *addrs;
char **domains;
assert_se(e);
assert_se(event == SD_DHCP6_CLIENT_EVENT_IP_ACQUIRE);
assert_se(sd_dhcp6_client_get_lease(client, &lease) >= 0);
assert_se(sd_dhcp6_lease_get_domains(lease, &domains) == 1);
assert_se(!strcmp("lab.intra", domains[0]));
assert_se(domains[1] == NULL);
assert_se(sd_dhcp6_lease_get_dns(lease, &addrs) == 1);
assert_se(!memcmp(addrs, &msg_advertise[124], 16));
assert_se(sd_dhcp6_lease_get_ntp_addrs(lease, &addrs) == 1);
assert_se(!memcmp(addrs, &msg_advertise[159], 16));
assert_se(sd_dhcp6_client_set_request_option(client, SD_DHCP6_OPTION_DNS_SERVERS) == -EBUSY);
if (verbose)
printf(" got DHCPv6 event %d\n", event);
sd_event_exit(e, 0);
}
开发者ID:nmartensen,项目名称:systemd,代码行数:29,代码来源:test-dhcp6-client.c
示例2: cli_handler_fn
static void cli_handler_fn(char *input)
{
_shl_free_ char *original = input;
_shl_strv_free_ char **args = NULL;
int r;
if (!input) {
rl_insert_text("quit");
rl_redisplay();
rl_crlf();
sd_event_exit(cli_event, 0);
return;
}
r = shl_qstr_tokenize(input, &args);
if (r < 0)
return cli_vENOMEM();
else if (!r)
return;
add_history(original);
r = cli_do(cli_cmds, args, r);
if (r != -EAGAIN)
return;
cli_printf("Command not found\n");
}
开发者ID:ValentinCupif,项目名称:MiraCle,代码行数:27,代码来源:ctl-cli.c
示例3: on_properties_changed
static int on_properties_changed(sd_bus_message *m, void *userdata, sd_bus_error *error) {
static const struct bus_properties_map map[] = {
{ "ActiveState", "s", NULL, offsetof(RunContext, active_state) },
{ "InactiveExitTimestampMonotonic", "t", NULL, offsetof(RunContext, inactive_exit_usec) },
{ "InactiveEnterTimestampMonotonic", "t", NULL, offsetof(RunContext, inactive_enter_usec) },
{ "Result", "s", NULL, offsetof(RunContext, result) },
{ "ExecMainCode", "i", NULL, offsetof(RunContext, exit_code) },
{ "ExecMainStatus", "i", NULL, offsetof(RunContext, exit_status) },
{ "CPUUsageNSec", "t", NULL, offsetof(RunContext, cpu_usage_nsec) },
{}
};
RunContext *c = userdata;
int r;
r = bus_map_all_properties(c->bus,
"org.freedesktop.systemd1",
sd_bus_message_get_path(m),
map,
c);
if (r < 0) {
sd_event_exit(c->event, EXIT_FAILURE);
return log_error_errno(r, "Failed to query unit state: %m");
}
run_context_check_done(c);
return 0;
}
开发者ID:pszewczyk,项目名称:systemd,代码行数:29,代码来源:run.c
示例4: test_rs_done
static void test_rs_done(sd_icmp6_nd *nd, int event, void *userdata) {
sd_event *e = userdata;
static int idx = 0;
struct {
uint8_t flag;
int event;
} flag_event[] = {
{ 0, ICMP6_EVENT_ROUTER_ADVERTISMENT_NONE },
{ ND_RA_FLAG_OTHER, ICMP6_EVENT_ROUTER_ADVERTISMENT_OTHER },
{ ND_RA_FLAG_MANAGED, ICMP6_EVENT_ROUTER_ADVERTISMENT_MANAGED }
};
uint32_t mtu;
assert_se(nd);
assert_se(event == flag_event[idx].event);
idx++;
if (verbose)
printf(" got event %d\n", event);
if (idx < 3) {
send_ra(flag_event[idx].flag);
return;
}
assert_se(sd_icmp6_ra_get_mtu(nd, &mtu) == -ENOMSG);
sd_event_exit(e, 0);
}
开发者ID:AlexBaranosky,项目名称:systemd,代码行数:30,代码来源:test-icmp6-rs.c
示例5: cli_exit
void cli_exit(void)
{
if (!cli_event)
return cli_vEINVAL();
sd_event_exit(cli_event, 0);
}
开发者ID:ValentinCupif,项目名称:MiraCle,代码行数:7,代码来源:ctl-cli.c
示例6: pty_fn
static int pty_fn(Pty *pty, void *userdata, unsigned int ev, const void *ptr, size_t size) {
switch (ev) {
case PTY_DATA:
assert_se(rcvsiz < strlen(rcvmsg) * 2);
assert_se(rcvsiz + size < sizeof(rcvbuf));
memcpy(&rcvbuf[rcvsiz], ptr, size);
rcvsiz += size;
if (rcvsiz >= strlen(rcvmsg) * 2) {
assert_se(rcvsiz == strlen(rcvmsg) * 2);
assert_se(!memcmp(rcvbuf, rcvmsg, strlen(rcvmsg)));
assert_se(!memcmp(&rcvbuf[strlen(rcvmsg)], rcvmsg, strlen(rcvmsg)));
}
break;
case PTY_HUP:
/* This is guaranteed to appear _after_ the input queues are
* drained! */
assert_se(rcvsiz == strlen(rcvmsg) * 2);
break;
case PTY_CHILD:
/* this may appear at any time */
break;
default:
assert_se(0);
break;
}
/* if we got HUP _and_ CHILD, exit */
if (pty_get_fd(pty) < 0 && pty_get_child(pty) < 0)
sd_event_exit(event, 0);
return 0;
}
开发者ID:RaghavanSanthanam,项目名称:systemd,代码行数:35,代码来源:test-pty.c
示例7: test_rs_done
static void test_rs_done(sd_ndisc *nd, uint8_t flags, const struct in6_addr *gateway, unsigned lifetime, int pref, void *userdata) {
sd_event *e = userdata;
static unsigned idx = 0;
uint8_t flags_array[] = {
0,
0,
0,
ND_RA_FLAG_OTHER,
ND_RA_FLAG_MANAGED
};
uint32_t mtu;
assert_se(nd);
assert_se(flags == flags_array[idx]);
idx++;
if (verbose)
printf(" got event 0x%02x\n", flags);
if (idx < ELEMENTSOF(flags_array)) {
send_ra(flags_array[idx]);
return;
}
assert_se(sd_ndisc_get_mtu(nd, &mtu) == -ENOMSG);
sd_event_exit(e, 0);
}
开发者ID:AOSC-Dev,项目名称:systemd,代码行数:29,代码来源:test-ndisc-rs.c
示例8: test_addr_acq_acquired
static void test_addr_acq_acquired(sd_dhcp_client *client, int event,
void *userdata) {
sd_event *e = userdata;
sd_dhcp_lease *lease;
struct in_addr addr;
assert_se(client);
assert_se(event == SD_DHCP_CLIENT_EVENT_IP_ACQUIRE);
assert_se(sd_dhcp_client_get_lease(client, &lease) >= 0);
assert_se(lease);
assert_se(sd_dhcp_lease_get_address(lease, &addr) >= 0);
assert_se(memcmp(&addr.s_addr, &test_addr_acq_ack[44],
sizeof(addr.s_addr)) == 0);
assert_se(sd_dhcp_lease_get_netmask(lease, &addr) >= 0);
assert_se(memcmp(&addr.s_addr, &test_addr_acq_ack[285],
sizeof(addr.s_addr)) == 0);
assert_se(sd_dhcp_lease_get_router(lease, &addr) >= 0);
assert_se(memcmp(&addr.s_addr, &test_addr_acq_ack[308],
sizeof(addr.s_addr)) == 0);
if (verbose)
printf(" DHCP address acquired\n");
sd_event_exit(e, 0);
}
开发者ID:floppym,项目名称:systemd,代码行数:29,代码来源:test-dhcp-client.c
示例9: accept_cb
static int accept_cb(sd_event_source *s, int fd, uint32_t revents, void *userdata) {
_cleanup_free_ char *peer = NULL;
Context *context = userdata;
int nfd = -1, r;
assert(s);
assert(fd >= 0);
assert(revents & EPOLLIN);
assert(context);
nfd = accept4(fd, NULL, NULL, SOCK_NONBLOCK|SOCK_CLOEXEC);
if (nfd < 0) {
if (errno != -EAGAIN)
log_warning_errno(errno, "Failed to accept() socket: %m");
} else {
getpeername_pretty(nfd, true, &peer);
log_debug("New connection from %s", strna(peer));
r = add_connection_socket(context, nfd);
if (r < 0) {
log_error_errno(r, "Failed to accept connection, ignoring: %m");
safe_close(fd);
}
}
r = sd_event_source_set_enabled(s, SD_EVENT_ONESHOT);
if (r < 0) {
log_error_errno(r, "Error while re-enabling listener with ONESHOT: %m");
sd_event_exit(context->event, r);
return r;
}
return 1;
}
开发者ID:floppym,项目名称:systemd,代码行数:34,代码来源:socket-proxyd.c
示例10: evcat_idev_fn
static int evcat_idev_fn(idev_session *session, void *userdata, idev_event *ev) {
Evcat *e = userdata;
switch (ev->type) {
case IDEV_EVENT_DEVICE_ADD:
idev_device_enable(ev->device_add.device);
break;
case IDEV_EVENT_DEVICE_REMOVE:
idev_device_disable(ev->device_remove.device);
break;
case IDEV_EVENT_DEVICE_DATA:
switch (ev->device_data.data.type) {
case IDEV_DATA_KEYBOARD:
if (kdata_is_exit(&ev->device_data.data))
sd_event_exit(e->event, 0);
else
kdata_print(&ev->device_data.data);
break;
}
break;
}
return 0;
}
开发者ID:275288698,项目名称:systemd-ubuntu-with-dbus,代码行数:26,代码来源:evcat.c
示例11: on_tar_finished
static void on_tar_finished(TarImport *import, int error, void *userdata) {
sd_event *event = userdata;
assert(import);
if (error == 0)
log_info("Operation completed successfully.");
sd_event_exit(event, abs(error));
}
开发者ID:josephgbr,项目名称:systemd,代码行数:9,代码来源:import.c
示例12: on_dkr_finished
static void on_dkr_finished(DkrPull *pull, int error, void *userdata) {
sd_event *event = userdata;
assert(pull);
if (error == 0)
log_info("Operation completed successfully.");
sd_event_exit(event, abs(error));
}
开发者ID:rowhit,项目名称:systemd,代码行数:9,代码来源:pull.c
示例13: dispatch_sigterm
static int dispatch_sigterm(sd_event_source *es, const struct signalfd_siginfo *si, void *userdata) {
Manager *m = userdata;
assert(m);
log_received_signal(LOG_INFO, si);
sd_event_exit(m->event, 0);
return 0;
}
开发者ID:wkennington,项目名称:systemd,代码行数:10,代码来源:networkd-manager.c
示例14: on_finished
static void on_finished(DckImport *import, int error, void *userdata) {
sd_event *event = userdata;
assert(import);
if (error == 0)
log_info("Operation completed successfully.");
else
log_info_errno(error, "Operation failed: %m");
sd_event_exit(event, error);
}
开发者ID:pwaller,项目名称:systemd,代码行数:11,代码来源:import.c
示例15: name_owner_change_callback
static int name_owner_change_callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
sd_event *e = userdata;
assert(m);
assert(e);
sd_bus_close(sd_bus_message_get_bus(m));
sd_event_exit(e, 0);
return 1;
}
开发者ID:ChALkeR,项目名称:systemd,代码行数:11,代码来源:bus-util.c
示例16: pty_forward_handler
static int pty_forward_handler(PTYForward *f, int rcode, void *userdata) {
RunContext *c = userdata;
assert(f);
if (rcode < 0) {
sd_event_exit(c->event, EXIT_FAILURE);
return log_error_errno(rcode, "Error on PTY forwarding logic: %m");
}
run_context_check_done(c);
return 0;
}
开发者ID:pszewczyk,项目名称:systemd,代码行数:13,代码来源:run.c
示例17: match_count
static int match_count(struct wpas *w,
struct wpas_message *m,
void *data)
{
int *expected = data;
if (!m)
ck_assert_msg(0, "HUP not expected");
if (!--*expected)
sd_event_exit(event, 0);
return 0;
}
开发者ID:Al3n,项目名称:miraclecast,代码行数:14,代码来源:test_wpas.c
示例18: run_context_check_done
static void run_context_check_done(RunContext *c) {
bool done = true;
assert(c);
if (c->match)
done = done && (c->active_state && STR_IN_SET(c->active_state, "inactive", "failed"));
if (c->forward)
done = done && pty_forward_is_done(c->forward);
if (done)
sd_event_exit(c->event, EXIT_SUCCESS);
}
开发者ID:pszewczyk,项目名称:systemd,代码行数:14,代码来源:run.c
示例19: child_handler
static int child_handler(sd_event_source *s, const siginfo_t *si, void *userdata) {
assert_se(s);
assert_se(si);
log_info("got child on %c", PTR_TO_INT(userdata));
assert_se(userdata == INT_TO_PTR('f'));
assert_se(sd_event_exit(sd_event_source_get_event(s), 0) >= 0);
sd_event_source_unref(s);
return 1;
}
开发者ID:275288698,项目名称:systemd-ubuntu-with-dbus,代码行数:14,代码来源:test-event.c
示例20: track_cb_y
static int track_cb_y(sd_bus_track *t, void *userdata) {
int r;
log_error("TRACK CB Y");
assert_se(!track_cb_called_y);
track_cb_called_y = true;
/* We got disconnected, let's close everything */
r = sd_event_exit(sd_bus_get_event(sd_bus_track_get_bus(t)), EXIT_SUCCESS);
assert_se(r >= 0);
return 0;
}
开发者ID:GuillaumeSeren,项目名称:systemd,代码行数:15,代码来源:test-bus-track.c
注:本文中的sd_event_exit函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论