ucm: add exec sequence command

This change renames the original exec command to shell which
is more appropriate. Implement a light version of the exec
command which calls directly the specified executable without
the shell interaction (man 3 system).

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2021-05-11 14:48:16 +02:00
parent a468505c96
commit 590df3a5b1
6 changed files with 312 additions and 7 deletions

View file

@ -717,6 +717,14 @@ static int execute_sequence(snd_use_case_mgr_t *uc_mgr,
usleep(s->data.sleep);
break;
case SEQUENCE_ELEMENT_TYPE_EXEC:
err = uc_mgr_exec(s->data.exec);
if (err != 0) {
uc_error("exec '%s' failed (exit code %d)", s->data.exec, err);
goto __fail;
}
break;
case SEQUENCE_ELEMENT_TYPE_SHELL:
shell_retry:
err = system(s->data.exec);
if (WIFSIGNALED(err)) {
err = -EINTR;
@ -727,6 +735,8 @@ static int execute_sequence(snd_use_case_mgr_t *uc_mgr,
goto __fail;
}
} else if (err < 0) {
if (errno == EAGAIN)
goto shell_retry;
err = -errno;
goto __fail;
}