mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-01 22:58:49 -04:00
Maik Broemme <mbroemme@plusserver.de>
- added ipc_perm for dmix plugin Jaroslav Kysela <perex@suse.cz> - added ipc_perm for dsnoop and dshare plugins - added ipc_perm to doc/asoundrc.txt
This commit is contained in:
parent
e88884e9bf
commit
0545cf711d
6 changed files with 88 additions and 15 deletions
|
|
@ -33,6 +33,7 @@
|
|||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/shm.h>
|
||||
|
|
@ -482,6 +483,7 @@ static snd_pcm_fast_ops_t snd_pcm_dshare_fast_ops = {
|
|||
* \param pcmp Returns created PCM handle
|
||||
* \param name Name of PCM
|
||||
* \param ipc_key IPC key for semaphore and shared memory
|
||||
* \param ipc_mode IPC permissions for semaphore and shared memory
|
||||
* \param params Parameters for slave
|
||||
* \param root Configuration root
|
||||
* \param sconf Slave configuration
|
||||
|
|
@ -493,10 +495,11 @@ static snd_pcm_fast_ops_t snd_pcm_dshare_fast_ops = {
|
|||
* changed in future.
|
||||
*/
|
||||
int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
|
||||
key_t ipc_key, struct slave_params *params,
|
||||
snd_config_t *bindings,
|
||||
snd_config_t *root, snd_config_t *sconf,
|
||||
snd_pcm_stream_t stream, int mode)
|
||||
key_t ipc_key, mode_t ipc_perm,
|
||||
struct slave_params *params,
|
||||
snd_config_t *bindings,
|
||||
snd_config_t *root, snd_config_t *sconf,
|
||||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_pcm_t *pcm = NULL, *spcm = NULL;
|
||||
snd_pcm_direct_t *dshare = NULL;
|
||||
|
|
@ -528,6 +531,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
|
|||
}
|
||||
|
||||
dshare->ipc_key = ipc_key;
|
||||
dshare->ipc_perm = ipc_perm;
|
||||
dshare->semid = -1;
|
||||
dshare->shmid = -1;
|
||||
|
||||
|
|
@ -745,6 +749,8 @@ int _snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
|
|||
struct slave_params params;
|
||||
int bsize, psize, ipc_key_add_uid = 0;
|
||||
key_t ipc_key = 0;
|
||||
mode_t ipc_perm = 0600;
|
||||
|
||||
int err;
|
||||
snd_config_for_each(i, next, conf) {
|
||||
snd_config_t *n = snd_config_iterator_entry(i);
|
||||
|
|
@ -763,6 +769,21 @@ int _snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
|
|||
ipc_key = key;
|
||||
continue;
|
||||
}
|
||||
if (strcmp(id, "ipc_perm") == 0) {
|
||||
char *perm;
|
||||
char *endp;
|
||||
err = snd_config_get_ascii(n, &perm);
|
||||
if (err < 0) {
|
||||
SNDERR("The field ipc_perm must be a valid file permission");
|
||||
return err;
|
||||
}
|
||||
if (isdigit(*perm) == 0) {
|
||||
SNDERR("The field ipc_perm must be a valid file permission");
|
||||
return -EINVAL;
|
||||
}
|
||||
ipc_perm = strtol(perm, &endp, 8);
|
||||
continue;
|
||||
}
|
||||
if (strcmp(id, "ipc_key_add_uid") == 0) {
|
||||
char *tmp;
|
||||
err = snd_config_get_ascii(n, &tmp);
|
||||
|
|
@ -822,7 +843,7 @@ int _snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
|
|||
|
||||
params.period_size = psize;
|
||||
params.buffer_size = bsize;
|
||||
err = snd_pcm_dshare_open(pcmp, name, ipc_key, ¶ms, bindings, root, sconf, stream, mode);
|
||||
err = snd_pcm_dshare_open(pcmp, name, ipc_key, ipc_perm, ¶ms, bindings, root, sconf, stream, mode);
|
||||
if (err < 0)
|
||||
snd_config_delete(sconf);
|
||||
return err;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue