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 funcs
= poll_funcs_init_tevent(ev
);
42 fprintf(stderr
, "poll_funcs_init_tevent failed\n");
46 ret
= unix_msg_init(sock
, funcs
, 256, 1, recv_cb
, &state
, &ctx
);
48 fprintf(stderr
, "unix_msg_init failed: %s\n",
54 ret
= tevent_loop_once(ev
);
56 fprintf(stderr
, "tevent_loop_once failed: %s\n",
64 static void recv_cb(struct unix_msg_ctx
*ctx
,
65 uint8_t *msg
, size_t msg_len
,
69 if (msg_len
== sizeof(num
)) {
70 memcpy(&num
, msg
, msg_len
);