/** Read only (flag for open mode) \hideinitializer */
#define SND_CTL_READONLY 0x0004
+/** Return EINTR instead blocking (flag for open mode) \hideinitializer */
+#define SND_CTL_EINTR 0x0080
+
/** CTL handle */
typedef struct _snd_ctl snd_ctl_t;
}
#ifndef DOC_HIDDEN
-int snd_ctl_new(snd_ctl_t **ctlp, snd_ctl_type_t type, const char *name)
+int snd_ctl_new(snd_ctl_t **ctlp, snd_ctl_type_t type, const char *name, int mode)
{
snd_ctl_t *ctl;
ctl = calloc(1, sizeof(*ctl));
if (!ctl)
return -ENOMEM;
ctl->type = type;
+ ctl->mode = mode;
if (name)
ctl->name = strdup(name);
INIT_LIST_HEAD(&ctl->async_handlers);
return -ENXIO;
}
- err = snd_ctl_new(&ctl, SND_CTL_TYPE_EXT, name);
+ err = snd_ctl_new(&ctl, SND_CTL_TYPE_EXT, name, mode);
if (err < 0)
return err;
hw->fd = fd;
hw->protocol = ver;
- err = snd_ctl_new(&ctl, SND_CTL_TYPE_HW, name);
+ err = snd_ctl_new(&ctl, SND_CTL_TYPE_HW, name, mode);
if (err < 0) {
close(fd);
free(hw);
snd_ctl_type_t type;
const snd_ctl_ops_t *ops;
void *private_data;
+ int mode;
int nonblock;
int poll_fd;
struct list_head async_handlers;
/* make local functions really local */
#define snd_ctl_new snd1_ctl_new
-int snd_ctl_new(snd_ctl_t **ctlp, snd_ctl_type_t type, const char *name);
+int snd_ctl_new(snd_ctl_t **ctlp, snd_ctl_type_t type, const char *name, int mode);
int _snd_ctl_poll_descriptor(snd_ctl_t *ctl);
#define _snd_ctl_async_descriptor _snd_ctl_poll_descriptor
int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card, int mode);
* changed in future.
*/
int snd_ctl_remap_open(snd_ctl_t **handlep, const char *name, snd_config_t *remap,
- snd_config_t *map, snd_ctl_t *child, int mode ATTRIBUTE_UNUSED)
+ snd_config_t *map, snd_ctl_t *child, int mode)
{
snd_ctl_remap_t *priv;
snd_ctl_t *ctl;
priv->numid_remap_active = priv->map_items > 0;
priv->child = child;
- err = snd_ctl_new(&ctl, SND_CTL_TYPE_REMAP, name);
+ err = snd_ctl_new(&ctl, SND_CTL_TYPE_REMAP, name, mode);
if (err < 0) {
result = err;
goto _err;
shm->socket = sock;
shm->ctrl = ctrl;
- err = snd_ctl_new(&ctl, SND_CTL_TYPE_SHM, name);
+ err = snd_ctl_new(&ctl, SND_CTL_TYPE_SHM, name, mode);
if (err < 0) {
result = err;
goto _err;
pollio = 0;
err_poll = poll(pfd, npfds, timeout);
if (err_poll < 0) {
- if (errno == EINTR && !CTLINABORT(hctl->ctl))
+ if (errno == EINTR && !CTLINABORT(hctl->ctl) && !(hctl->ctl->mode & SND_CTL_EINTR))
continue;
return -errno;
}