From 00a34a8ba3ad7c018a7a669594bfd6ec51ed0f4d Mon Sep 17 00:00:00 2001 From: Masamichi Takagi Date: Mon, 30 Jul 2018 17:41:29 +0900 Subject: [PATCH] uti: util_thread: Hoist uti_desc check Change-Id: I8c4b75140df2fe149dfe20e0a8f0bf323b5f1763 --- executer/user/mcexec.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/executer/user/mcexec.c b/executer/user/mcexec.c index 761688c0..270b5da3 100644 --- a/executer/user/mcexec.c +++ b/executer/user/mcexec.c @@ -2889,6 +2889,15 @@ static long util_thread(struct thread_data_s *my_thread, unsigned long rp_rctx, struct thread_data_s *tp; + uti_desc = (struct uti_desc *)_uti_desc; + if (!uti_desc) { + printf("%s: ERROR: uti_desc not found. Add --enable-uti option to mcexec.\n", + __func__); + rc = -EINVAL; + goto out; + } + __dprintf("%s: uti_desc=%p\n", __FUNCTION__, uti_desc); + pthread_barrier_init(&uti_init_ready, NULL, 2); if ((rc = create_worker_thread(&tp, &uti_init_ready))) { printf("%s: Error: create_worker_thread failed (%d)\n", __FUNCTION__, rc); @@ -2898,12 +2907,6 @@ static long util_thread(struct thread_data_s *my_thread, unsigned long rp_rctx, pthread_barrier_wait(&uti_init_ready); __dprintf("%s: worker tid: %d\n", __FUNCTION__, tp->tid); - uti_desc = (struct uti_desc *)_uti_desc; - if (!uti_desc) { - printf("%s: ERROR: uti_desc isn't set. Use mcexec.sh instead of mcexec\n", __FUNCTION__); - rc = -EINVAL; - goto out; - } /* Initialize uti related variables for syscall_intercept */ uti_desc->fd = fd;