static oe_fd_t* _epoll_create1(oe_device_t* device_, int32_t flags)
{
    oe_fd_t* ret = NULL;
    epoll_t* epoll = NULL;
    device_t* device = _cast_device(device_);
    oe_host_fd_t retval;

    oe_errno = 0;

    if (!device)
        OE_RAISE_ERRNO(OE_EINVAL);

    if (!(epoll = oe_calloc(1, sizeof(epoll_t))))
        OE_RAISE_ERRNO(OE_ENOMEM);

    if (oe_syscall_epoll_create1_ocall(&retval, flags) != OE_OK)
        OE_RAISE_ERRNO(OE_EINVAL);

    if (retval < 0)
        goto done;

    epoll->base.type = OE_FD_TYPE_EPOLL;
    epoll->base.ops.epoll = _get_epoll_ops();
    epoll->magic = EPOLL_MAGIC;
    epoll->host_fd = retval;

    ret = &epoll->base;
    epoll = NULL;

done:

    if (epoll)
        oe_free(epoll);

    return ret;
}
static oe_fd_t* _epoll_create1(oe_device_t* device_, int32_t flags)
{
    oe_fd_t* ret = NULL;
    epoll_t* epoll = NULL;
    device_t* device = _cast_device(device_);
    oe_host_fd_t retval;

    oe_errno = 0;

    if (!device)
        OE_RAISE_ERRNO(OE_EINVAL);

    if (!(epoll = oe_calloc(1, sizeof(epoll_t))))
        OE_RAISE_ERRNO(OE_ENOMEM);

    if (oe_syscall_epoll_create1_ocall(&retval, flags) != OE_OK)
        OE_RAISE_ERRNO(OE_EINVAL);

    if (retval < 0)
        goto done;

    epoll->base.type = OE_FD_TYPE_EPOLL;
    epoll->base.ops.epoll = _get_epoll_ops();
    epoll->magic = EPOLL_MAGIC;
    epoll->host_fd = retval;

    ret = &epoll->base;
    epoll = NULL;

done:

    if (epoll)
        oe_free(epoll);

    return ret;
}