mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-04 06:06:17 +00:00
ipc/server: Add Android main entry point which receives fd.
This commit is contained in:
parent
baa68fac4f
commit
1430b1b22c
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue