More hacking

Move array and map to pinos
Move more things to spa lib
ControlCmd -> Message
Make pinos log, use for plugins as well
work on ringbuffer in alsa and nodes
work on making registry with all objects
This commit is contained in:
Wim Taymans 2016-11-03 19:41:53 +01:00
parent a1c0bef2ed
commit 7e46f9e3ad
81 changed files with 1831 additions and 1030 deletions

View file

@ -28,6 +28,7 @@
#include "memfd-wrappers.h"
#include <pinos/client/log.h>
#include <pinos/server/utils.h>
#undef USE_MEMFD
@ -47,21 +48,21 @@ pinos_memblock_alloc (PinosMemblockFlags flags,
#ifdef USE_MEMFD
mem->fd = memfd_create ("pinos-memfd", MFD_CLOEXEC | MFD_ALLOW_SEALING);
if (mem->fd == -1) {
fprintf (stderr, "Failed to create memfd: %s\n", strerror (errno));
pinos_log_error ("Failed to create memfd: %s\n", strerror (errno));
return FALSE;
}
#else
char filename[] = "/dev/shm/spa-tmpfile.XXXXXX";
mem->fd = mkostemp (filename, O_CLOEXEC);
if (mem->fd == -1) {
fprintf (stderr, "Failed to create temporary file: %s\n", strerror (errno));
pinos_log_error ("Failed to create temporary file: %s\n", strerror (errno));
return FALSE;
}
unlink (filename);
#endif
if (ftruncate (mem->fd, size) < 0) {
g_warning ("Failed to truncate temporary file: %s", strerror (errno));
pinos_log_warn ("Failed to truncate temporary file: %s", strerror (errno));
close (mem->fd);
return FALSE;
}
@ -69,7 +70,7 @@ pinos_memblock_alloc (PinosMemblockFlags flags,
if (flags & PINOS_MEMBLOCK_FLAG_SEAL) {
unsigned int seals = F_SEAL_GROW | F_SEAL_SHRINK | F_SEAL_SEAL;
if (fcntl (mem->fd, F_ADD_SEALS, seals) == -1) {
g_warning ("Failed to add seals: %s", strerror (errno));
pinos_log_warn ("Failed to add seals: %s", strerror (errno));
}
}
#endif