Lines Matching refs:fd
80 int fd; member
85 int fd; member
311 static struct tee_shm *alloc_shm(int fd, size_t size) in alloc_shm() argument
323 shm->fd = ioctl(fd, TEE_IOC_SHM_ALLOC, &data); in alloc_shm()
324 if (shm->fd < 0) { in alloc_shm()
330 shm->fd, 0); in alloc_shm()
332 close(shm->fd); in alloc_shm()
342 static struct tee_shm *register_local_shm(int fd, size_t size) in register_local_shm() argument
363 shm->fd = ioctl(fd, TEE_IOC_SHM_REGISTER, &data); in register_local_shm()
364 if (shm->fd < 0) { in register_local_shm()
387 shm = register_local_shm(arg->fd, val->b); in process_alloc()
389 shm = alloc_shm(arg->fd, val->b); in process_alloc()
422 close(shm->fd); in process_free()
428 close(shm->fd); in process_free()
440 int fd = 0; in open_dev() local
445 fd = open(devname, O_RDWR); in open_dev()
446 if (fd < 0) in open_dev()
449 if (ioctl(fd, TEE_IOC_VERSION, &vers)) in open_dev()
461 return fd; in open_dev()
463 close(fd); in open_dev()
469 int fd = 0; in get_dev_fd() local
475 fd = open_dev(name, gen_caps); in get_dev_fd()
476 if (fd >= 0) in get_dev_fd()
477 return fd; in get_dev_fd()
505 static bool read_request(int fd, union tee_rpc_invoke *request) in read_request() argument
513 if (ioctl(fd, TEE_IOC_SUPPL_RECV, &data)) { in read_request()
520 static bool write_response(int fd, union tee_rpc_invoke *request) in write_response() argument
530 if (ioctl(fd, TEE_IOC_SUPPL_SEND, &data)) { in write_response()
616 if (!read_request(arg->fd, &request)) in process_one_request()
661 return write_response(arg->fd, &request); in process_one_request()
684 struct thread_arg arg = { .fd = -1 }; in main()
715 arg.fd = open_dev(dev, &arg.gen_caps); in main()
716 if (arg.fd < 0) { in main()
721 arg.fd = get_dev_fd(&arg.gen_caps); in main()
722 if (arg.fd < 0) { in main()
738 close(arg.fd); in main()