diff --git a/syscall/devices/hostepoll/hostepoll.c b/syscall/devices/hostepoll/hostepoll.c index 546a49f1c5..9a2fb4f48b 100644 --- a/syscall/devices/hostepoll/hostepoll.c +++ b/syscall/devices/hostepoll/hostepoll.c @@ -147,6 +147,7 @@ static oe_fd_t* _epoll_create1(oe_device_t* device_, int32_t flags) epoll_t* epoll = NULL; device_t* device = _cast_device(device_); oe_host_fd_t retval; + oe_mutexattr_t attr; oe_errno = 0; @@ -167,6 +168,15 @@ static oe_fd_t* _epoll_create1(oe_device_t* device_, int32_t flags) epoll->magic = EPOLL_MAGIC; epoll->host_fd = retval; + if (oe_mutexattr_init(&attr) != OE_OK) + OE_RAISE_ERRNO(OE_EFAULT); + + if (oe_mutexattr_settype(&attr, OE_MUTEX_RECURSIVE) != OE_OK) + OE_RAISE_ERRNO(OE_EFAULT); + + if (oe_mutex_init(&epoll->lock, &attr) != OE_OK) + OE_RAISE_ERRNO(OE_EFAULT); + ret = &epoll->base; epoll = NULL;