/* Returns: -ENOMEM if buffer is too small, -EINVAL if attr.group is invalid, -EFAULT if copying to userspace failed, on success return number of stored interrupts  */
static int flic_get_all_irqs(KVMS390FLICState *flic, void *buf, int len)
/* Returns: -ENOMEM if buffer is too small, -EINVAL if attr.group is invalid, -EFAULT if copying to userspace failed, on success return number of stored interrupts  */
static int flic_get_all_irqs(KVMS390FLICState *flic, void *buf, int len)
{
    struct kvm_device_attr attr = {
        .group = KVM_DEV_FLIC_GET_ALL_IRQS,
        .addr = (uint64_t) buf,
        .attr = len,
    };
    int rc;
    rc = ioctl(flic->fd, KVM_GET_DEVICE_ATTR, &attr);
    return rc == -1 ? -errno : rc;
}