ipc/server: Add Android main entry point which receives fd.

This commit is contained in:
Lubosz Sarnecki 2020-11-25 14:10:39 +01:00
parent baa68fac4f
commit 1430b1b22c
2 changed files with 36 additions and 0 deletions

View file

@ -202,6 +202,16 @@ struct ipc_server
int
ipc_server_main(int argc, char **argv);
/*!
* Android entry point to the IPC server process.
*
* @ingroup ipc_server
*/
#ifdef XRT_OS_ANDROID
int
ipc_server_main_android(int fd);
#endif
/*!
* Called by client threads to manage global state
*

View file

@ -1230,3 +1230,29 @@ ipc_server_main(int argc, char **argv)
return ret;
}
#ifdef XRT_OS_ANDROID
int
ipc_server_main_android(int fd)
{
struct ipc_server *s = U_TYPED_CALLOC(struct ipc_server);
U_LOG_D("Created IPC server on fd %d", fd);
int ret = init_all(s);
if (ret < 0) {
free(s);
return ret;
}
init_server_state(s);
start_client_listener_thread(s, fd);
ret = main_loop(s);
teardown_all(s);
free(s);
U_LOG_E("Server exiting! '%i'", ret);
return ret;
}
#endif