3 #include "poll_funcs/poll_funcs_tevent.h"
5 #include "system/select.h"
13 static void recv_cb(struct unix_msg_ctx
*ctx
,
14 uint8_t *msg
, size_t msg_len
,
17 int main(int argc
, const char *argv
[])
19 struct poll_funcs funcs
;
21 struct unix_msg_ctx
*ctx
;
22 struct tevent_context
*ev
;
25 struct cb_state state
;
28 fprintf(stderr
, "Usage: %s <sockname>\n", argv
[0]);
35 ev
= tevent_context_init(NULL
);
37 perror("tevent_context_init failed");
40 poll_funcs_init_tevent(&funcs
, ev
);
42 ret
= unix_msg_init(sock
, &funcs
, 256, 1,
43 recv_cb
, &state
, &ctx
);
45 fprintf(stderr
, "unix_msg_init failed: %s\n",
51 ret
= tevent_loop_once(ev
);
53 fprintf(stderr
, "tevent_loop_once failed: %s\n",
61 static void recv_cb(struct unix_msg_ctx
*ctx
,
62 uint8_t *msg
, size_t msg_len
,
66 if (msg_len
== sizeof(num
)) {
67 memcpy(&num
, msg
, msg_len
);