Lines Matching refs:arg

115 static size_t num_waiters_inc(struct thread_arg *arg)  in num_waiters_inc()  argument
119 tee_supp_mutex_lock(&arg->mutex); in num_waiters_inc()
120 arg->num_waiters++; in num_waiters_inc()
121 assert(arg->num_waiters); in num_waiters_inc()
122 ret = arg->num_waiters; in num_waiters_inc()
123 tee_supp_mutex_unlock(&arg->mutex); in num_waiters_inc()
128 static size_t num_waiters_dec(struct thread_arg *arg) in num_waiters_dec() argument
132 tee_supp_mutex_lock(&arg->mutex); in num_waiters_dec()
133 assert(arg->num_waiters); in num_waiters_dec()
134 arg->num_waiters--; in num_waiters_dec()
135 ret = arg->num_waiters; in num_waiters_dec()
136 tee_supp_mutex_unlock(&arg->mutex); in num_waiters_dec()
387 static uint32_t process_alloc(struct thread_arg *arg, size_t num_params, in process_alloc() argument
396 if (arg->gen_caps & TEE_GEN_CAP_REG_MEM) in process_alloc()
397 shm = register_local_shm(arg->fd, val->b); in process_alloc()
399 shm = alloc_shm(arg->fd, val->b); in process_alloc()
584 static bool spawn_thread(struct thread_arg *arg) in spawn_thread() argument
597 num_waiters_inc(arg); in spawn_thread()
599 e = pthread_create(&tid, NULL, thread_main, arg); in spawn_thread()
602 num_waiters_dec(arg); in spawn_thread()
613 static bool process_one_request(struct thread_arg *arg) in process_one_request() argument
631 num_waiters_inc(arg); in process_one_request()
633 if (!read_request(arg->fd, &request)) in process_one_request()
639 if (num_meta && !num_waiters_dec(arg) && !spawn_thread(arg)) in process_one_request()
653 ret = process_alloc(arg, num_params, params); in process_one_request()
678 return write_response(arg->fd, &request); in process_one_request()
683 struct thread_arg *arg = a; in thread_main() local
689 num_waiters_dec(arg); in thread_main()
691 while (!arg->abort) { in thread_main()
692 if (!process_one_request(arg)) in thread_main()
693 arg->abort = true; in thread_main()
792 struct thread_arg arg = { .fd = -1 }; in main() local
800 e = pthread_mutex_init(&arg.mutex, NULL); in main()
876 arg.fd = open_dev(dev, &arg.gen_caps); in main()
877 if (arg.fd < 0) { in main()
882 arg.fd = get_dev_fd(&arg.gen_caps); in main()
883 if (arg.fd < 0) { in main()
898 while (!arg.abort) { in main()
899 if (!process_one_request(&arg)) in main()
900 arg.abort = true; in main()
903 close(arg.fd); in main()