- remove all gcc warnings
- add total sample cache size to stat
- make fragments settings runtime configurable
-- CLOEXEC
- logging
- automatic termination of daemon if unused
- add sample directory
pa_make_nonblock_fd(signal_pipe[0]);
pa_make_nonblock_fd(signal_pipe[1]);
+ pa_fd_set_cloexec(signal_pipe[0], 1);
+ pa_fd_set_cloexec(signal_pipe[1], 1);
api = a;
io_event = api->io_new(api, signal_pipe[0], PA_IO_EVENT_INPUT, callback, NULL);
goto fail;
}
+ pa_fd_set_cloexec(fd, 1);
+
if (fstat(fd, &st) < 0) {
fprintf(stderr, __FILE__": fstat('%s'): %s\n", p, strerror(errno));
goto fail;
#include <fcntl.h>
#include "oss-util.h"
+#include "util.h"
int pa_oss_open(const char *device, int *mode, int* pcaps) {
int fd = -1;
goto fail;
}
}
+
+ pa_fd_set_cloexec(fd, 1);
return fd;
goto fail;
}
+ pa_fd_set_cloexec(c->fd, 1);
pa_socket_tcp_low_delay(c->fd);
sa.sin_family = AF_INET;
goto fail;
}
+ pa_fd_set_cloexec(c->fd, 1);
pa_socket_low_delay(c->fd);
sa.sun_family = AF_LOCAL;
goto fail;
}
+ pa_fd_set_cloexec(c->fd, 1);
if (sa->sa_family == AF_INET)
pa_socket_tcp_low_delay(c->fd);
else
#include "socket-server.h"
#include "socket-util.h"
#include "xmalloc.h"
+#include "util.h"
struct pa_socket_server {
int ref;
goto finish;
}
+ pa_fd_set_cloexec(nfd, 1);
+
if (!s->on_connection) {
close(nfd);
goto finish;
goto fail;
}
+ pa_fd_set_cloexec(fd, 1);
+
sa.sun_family = AF_LOCAL;
strncpy(sa.sun_path, filename, sizeof(sa.sun_path)-1);
sa.sun_path[sizeof(sa.sun_path) - 1] = 0;
goto fail;
}
+ pa_fd_set_cloexec(fd, 1);
+
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0)
fprintf(stderr, "setsockopt(): %s\n", strerror(errno));
pa_xfree(dir);
return ret;
}
+
setpriority(PRIO_PROCESS, 0, 0);
}
+
+int pa_fd_set_cloexec(int fd, int b) {
+ int v;
+ assert(fd >= 0);
+
+ if ((v = fcntl(fd, F_GETFD, 0)) < 0)
+ return -1;
+
+ v = (v & ~FD_CLOEXEC) | (b ? FD_CLOEXEC : 0);
+
+ if (fcntl(fd, F_SETFD, v) < 0)
+ return -1;
+
+ return 0;
+}
void pa_raise_priority(void);
void pa_reset_priority(void);
+int pa_fd_set_cloexec(int fd, int b);
+
#endif