static int _hostsock_fcntl(oe_fd_t* sock_, int cmd, uint64_t arg)
{
    int ret = -1;
    sock_t* sock = _cast_sock(sock_);
    void* argout = NULL;
    uint64_t argsize = 0;

    oe_errno = 0;

    if (!sock)
        OE_RAISE_ERRNO(OE_EINVAL);

    switch (cmd)
    {
        case OE_F_GETFD:
        case OE_F_SETFD:
        case OE_F_GETFL:
        case OE_F_SETFL:
            break;

        default:
        case OE_F_DUPFD:
        case OE_F_GETLK64:
        case OE_F_OFD_GETLK:
        case OE_F_SETLK64:
        case OE_F_SETLKW64:
        case OE_F_OFD_SETLK:
        case OE_F_OFD_SETLKW:
            OE_RAISE_ERRNO(OE_EINVAL);
            break;

        // for sockets
        case OE_F_GETSIG: // Returns in return value
        case OE_F_SETSIG: // arg is data value
            break;

        case OE_F_GETOWN: // Returns in return value
        case OE_F_SETOWN: // arg is data value
            break;

        case OE_F_SETOWN_EX:
        case OE_F_GETOWN_EX:
            argsize = sizeof(struct oe_f_owner_ex);
            argout = (void*)arg;
            break;

        case OE_F_GETOWNER_UIDS:
            argsize = sizeof(oe_uid_t[2]);
            argout = (void*)arg;
            break;
    }

    if (oe_syscall_fcntl_ocall(
            &ret, sock->host_fd, cmd, arg, argsize, argout) != OE_OK)
        OE_RAISE_ERRNO(OE_EINVAL);
done:

    return ret;
}
static int _hostsock_fcntl(oe_fd_t* sock_, int cmd, uint64_t arg)
{
    int ret = -1;
    sock_t* sock = _cast_sock(sock_);
    void* argout = NULL;
    uint64_t argsize = 0;

    oe_errno = 0;

    if (!sock)
        OE_RAISE_ERRNO(OE_EINVAL);

    switch (cmd)
    {
        case OE_F_GETFD:
        case OE_F_SETFD:
        case OE_F_GETFL:
        case OE_F_SETFL:
            break;

        default:
        case OE_F_DUPFD:
        case OE_F_GETLK64:
        case OE_F_OFD_GETLK:
        case OE_F_SETLK64:
        case OE_F_SETLKW64:
        case OE_F_OFD_SETLK:
        case OE_F_OFD_SETLKW:
            OE_RAISE_ERRNO(OE_EINVAL);
            break;

         
        case OE_F_GETSIG:  
        case OE_F_SETSIG:  
            break;

        case OE_F_GETOWN:  
        case OE_F_SETOWN:  
            break;

        case OE_F_SETOWN_EX:
        case OE_F_GETOWN_EX:
            argsize = sizeof(struct oe_f_owner_ex);
            argout = (void*)arg;
            break;

        case OE_F_GETOWNER_UIDS:
            argsize = sizeof(oe_uid_t[2]);
            argout = (void*)arg;
            break;
    }

    if (oe_syscall_fcntl_ocall(
            &ret, sock->host_fd, cmd, arg, argsize, argout) != OE_OK)
        OE_RAISE_ERRNO(OE_EINVAL);
done:

    return ret;
}