* @ALSACTL_CARD_ERROR_DISCONNECTED: The card associated to the instance is in disconnect state.
* @ALSACTL_CARD_ERROR_ELEM_NOT_FOUND: The control element not found in the card.
* @ALSACTL_CARD_ERROR_ELEM_NOT_SUPPORTED: The operation is not supported by the control element.
+ * @ALSACTL_CARD_ERROR_ELEM_OWNED: The control element is owned by the other process.
*
* A set of error code for GError with domain which equals to #alsactl_card_error_quark()
*/
ALSACTL_CARD_ERROR_DISCONNECTED,
ALSACTL_CARD_ERROR_ELEM_NOT_FOUND,
ALSACTL_CARD_ERROR_ELEM_NOT_SUPPORTED,
+ ALSACTL_CARD_ERROR_ELEM_OWNED,
} ALSACtlCardError;
#endif
[ALSACTL_CARD_ERROR_DISCONNECTED] = "The card associated to the instance is in disconnect state",
[ALSACTL_CARD_ERROR_ELEM_NOT_FOUND] = "The control element not found in the card",
[ALSACTL_CARD_ERROR_ELEM_NOT_SUPPORTED] = "The operation is not supported by the control element.",
+ [ALSACTL_CARD_ERROR_ELEM_OWNED] = "The control element is owned by the other process.",
};
#define generate_local_error(exception, code) \
generate_local_error(error, ALSACTL_CARD_ERROR_DISCONNECTED);
else if (errno == ENOENT)
generate_local_error(error, ALSACTL_CARD_ERROR_ELEM_NOT_FOUND);
+ else if ((errno == EBUSY && lock) || (errno == EPERM && !lock))
+ generate_local_error(error, ALSACTL_CARD_ERROR_ELEM_OWNED);
else
generate_syscall_error(error, errno, "ioctl(%s)", req_name);
}
generate_local_error(error, ALSACTL_CARD_ERROR_DISCONNECTED);
else if (errno == ENOENT)
generate_local_error(error, ALSACTL_CARD_ERROR_ELEM_NOT_FOUND);
+ else if (errno == EPERM)
+ generate_local_error(error, ALSACTL_CARD_ERROR_ELEM_OWNED);
else
generate_syscall_error(error, errno, "ioctl(%s)", "TLV_WRITE");
}
generate_local_error(error, ALSACTL_CARD_ERROR_DISCONNECTED);
else if (errno == ENOENT)
generate_local_error(error, ALSACTL_CARD_ERROR_ELEM_NOT_FOUND);
+ else if (errno == EPERM)
+ generate_local_error(error, ALSACTL_CARD_ERROR_ELEM_OWNED);
else
generate_syscall_error(error, errno, "ioctl(%s)", "TLV_COMMAND");
}
info->owner = (__kernel_pid_t)elem_count;
if (ioctl(fd, request, info) < 0) {
- if (errno == ENODEV)
+ if (errno == ENODEV) {
generate_local_error(error, ALSACTL_CARD_ERROR_DISCONNECTED);
- else if (errno == ENOENT)
+ } else if (errno == ENOENT) {
generate_local_error(error, ALSACTL_CARD_ERROR_ELEM_NOT_FOUND);
- else
+ } else if (errno == EBUSY) {
+ if (replace)
+ generate_local_error(error, ALSACTL_CARD_ERROR_ELEM_OWNED);
+ } else {
generate_syscall_error(error, errno, "ioctl(%s)", req_name);
+ }
}
g_free((void *)info->value.enumerated.names_ptr);
if (*error != NULL)
generate_local_error(error, ALSACTL_CARD_ERROR_DISCONNECTED);
else if (errno == ENOENT)
generate_local_error(error, ALSACTL_CARD_ERROR_ELEM_NOT_FOUND);
+ else if (errno == EBUSY)
+ generate_local_error(error, ALSACTL_CARD_ERROR_ELEM_OWNED);
else
generate_syscall_error(error, errno, "ioctl(%s)", "ELEM_REMOVE");
}