mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-11 13:30:02 -05:00
change pa_log() and friends to not require a trailing \n on all logged strings
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@574 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
cb59817b4a
commit
4a64b0d116
74 changed files with 558 additions and 532 deletions
|
|
@ -52,7 +52,7 @@ static int generate(int fd, void *ret_data, size_t length) {
|
|||
ftruncate(fd, 0);
|
||||
|
||||
if ((r = pa_loop_write(fd, ret_data, length)) < 0 || (size_t) r != length) {
|
||||
pa_log(__FILE__": failed to write cookie file: %s\n", strerror(errno));
|
||||
pa_log(__FILE__": failed to write cookie file: %s", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ static int load(const char *fn, void *data, size_t length) {
|
|||
|
||||
if ((fd = open(fn, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR)) < 0) {
|
||||
if (errno != EACCES || (fd = open(fn, O_RDONLY)) < 0) {
|
||||
pa_log(__FILE__": failed to open cookie file '%s': %s\n", fn, strerror(errno));
|
||||
pa_log(__FILE__": failed to open cookie file '%s': %s", fn, strerror(errno));
|
||||
goto finish;
|
||||
} else
|
||||
writable = 0;
|
||||
|
|
@ -79,14 +79,14 @@ static int load(const char *fn, void *data, size_t length) {
|
|||
unlock = pa_lock_fd(fd, 1) >= 0;
|
||||
|
||||
if ((r = pa_loop_read(fd, data, length)) < 0) {
|
||||
pa_log(__FILE__": failed to read cookie file '%s': %s\n", fn, strerror(errno));
|
||||
pa_log(__FILE__": failed to read cookie file '%s': %s", fn, strerror(errno));
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if ((size_t) r != length) {
|
||||
|
||||
if (!writable) {
|
||||
pa_log(__FILE__": unable to write cookie to read only file\n");
|
||||
pa_log(__FILE__": unable to write cookie to read only file");
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ int pa_authkey_load(const char *path, void *data, size_t length) {
|
|||
ret = load(path, data, length);
|
||||
|
||||
if (ret < 0)
|
||||
pa_log(__FILE__": Failed to load authorization key '%s': %s\n", path,
|
||||
pa_log(__FILE__": Failed to load authorization key '%s': %s", path,
|
||||
(ret == -1) ? strerror(errno) : "file corrupt");
|
||||
|
||||
return ret;
|
||||
|
|
@ -175,14 +175,14 @@ int pa_authkey_save(const char *fn, const void *data, size_t length) {
|
|||
return -2;
|
||||
|
||||
if ((fd = open(p, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR)) < 0) {
|
||||
pa_log(__FILE__": failed to open cookie file '%s': %s\n", fn, strerror(errno));
|
||||
pa_log(__FILE__": failed to open cookie file '%s': %s", fn, strerror(errno));
|
||||
goto finish;
|
||||
}
|
||||
|
||||
unlock = pa_lock_fd(fd, 1) >= 0;
|
||||
|
||||
if ((r = pa_loop_write(fd, data, length)) < 0 || (size_t) r != length) {
|
||||
pa_log(__FILE__": failed to read cookie file '%s': %s\n", fn, strerror(errno));
|
||||
pa_log(__FILE__": failed to read cookie file '%s': %s", fn, strerror(errno));
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ static void client_kill(pa_client *client) {
|
|||
assert(client && client->userdata);
|
||||
c = client->userdata;
|
||||
|
||||
pa_log_debug(__FILE__": CLI client killed.\n");
|
||||
pa_log_debug(__FILE__": CLI client killed.");
|
||||
if (c->defer_kill)
|
||||
c->kill_requested = 1;
|
||||
else {
|
||||
|
|
@ -119,7 +119,7 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) {
|
|||
assert(line && c);
|
||||
|
||||
if (!s) {
|
||||
pa_log_debug(__FILE__": CLI got EOF from user.\n");
|
||||
pa_log_debug(__FILE__": CLI got EOF from user.");
|
||||
if (c->eof_callback)
|
||||
c->eof_callback(c, c->userdata);
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ pa_client *pa_client_new(pa_core *core, const char *name, const char *driver) {
|
|||
r = pa_idxset_put(core->clients, c, &c->index);
|
||||
assert(c->index != PA_IDXSET_INVALID && r >= 0);
|
||||
|
||||
pa_log_info(__FILE__": created %u \"%s\"\n", c->index, c->name);
|
||||
pa_log_info(__FILE__": created %u \"%s\"", c->index, c->name);
|
||||
pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_CLIENT|PA_SUBSCRIPTION_EVENT_NEW, c->index);
|
||||
|
||||
pa_core_check_quit(core);
|
||||
|
|
@ -66,7 +66,7 @@ void pa_client_free(pa_client *c) {
|
|||
|
||||
pa_core_check_quit(c->core);
|
||||
|
||||
pa_log_info(__FILE__": freed %u \"%s\"\n", c->index, c->name);
|
||||
pa_log_info(__FILE__": freed %u \"%s\"", c->index, c->name);
|
||||
pa_subscription_post(c->core, PA_SUBSCRIPTION_EVENT_CLIENT|PA_SUBSCRIPTION_EVENT_REMOVE, c->index);
|
||||
pa_xfree(c->name);
|
||||
pa_xfree(c->driver);
|
||||
|
|
@ -76,7 +76,7 @@ void pa_client_free(pa_client *c) {
|
|||
void pa_client_kill(pa_client *c) {
|
||||
assert(c);
|
||||
if (!c->kill) {
|
||||
pa_log_warn(__FILE__": kill() operation not implemented for client %u\n", c->index);
|
||||
pa_log_warn(__FILE__": kill() operation not implemented for client %u", c->index);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ static int next_assignment(const char *filename, unsigned line, const pa_config_
|
|||
if (!strcmp(lvalue, t->lvalue))
|
||||
return t->parse(filename, line, lvalue, rvalue, t->data, userdata);
|
||||
|
||||
pa_log(__FILE__": [%s:%u] Unknown lvalue '%s'.\n", filename, line, lvalue);
|
||||
pa_log(__FILE__": [%s:%u] Unknown lvalue '%s'.", filename, line, lvalue);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -88,7 +88,7 @@ static int parse_line(const char *filename, unsigned line, const pa_config_item
|
|||
return 0;
|
||||
|
||||
if (!(e = strchr(b, '='))) {
|
||||
pa_log(__FILE__": [%s:%u] Missing '='.\n", filename, line);
|
||||
pa_log(__FILE__": [%s:%u] Missing '='.", filename, line);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -111,7 +111,7 @@ int pa_config_parse(const char *filename, FILE *f, const pa_config_item *t, void
|
|||
goto finish;
|
||||
}
|
||||
|
||||
pa_log(__FILE__": WARNING: failed to open configuration file '%s': %s\n", filename, strerror(errno));
|
||||
pa_log(__FILE__": WARNING: failed to open configuration file '%s': %s", filename, strerror(errno));
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ int pa_config_parse(const char *filename, FILE *f, const pa_config_item *t, void
|
|||
if (feof(f))
|
||||
break;
|
||||
|
||||
pa_log(__FILE__": WARNING: failed to read configuration file '%s': %s\n", filename, strerror(errno));
|
||||
pa_log(__FILE__": WARNING: failed to read configuration file '%s': %s", filename, strerror(errno));
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ int pa_config_parse_int(const char *filename, unsigned line, const char *lvalue,
|
|||
assert(filename && lvalue && rvalue && data);
|
||||
|
||||
if (pa_atoi(rvalue, &k) < 0) {
|
||||
pa_log(__FILE__": [%s:%u] Failed to parse numeric value: %s\n", filename, line, rvalue);
|
||||
pa_log(__FILE__": [%s:%u] Failed to parse numeric value: %s", filename, line, rvalue);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -158,7 +158,7 @@ int pa_config_parse_bool(const char *filename, unsigned line, const char *lvalue
|
|||
assert(filename && lvalue && rvalue && data);
|
||||
|
||||
if ((k = pa_parse_boolean(rvalue)) < 0) {
|
||||
pa_log(__FILE__": [%s:%u] Failed to parse boolean value: %s\n", filename, line, rvalue);
|
||||
pa_log(__FILE__": [%s:%u] Failed to parse boolean value: %s", filename, line, rvalue);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@ static void add_file(pa_core *c, const char *pathname) {
|
|||
e = pa_path_get_filename(pathname);
|
||||
|
||||
if (stat(pathname, &st) < 0) {
|
||||
pa_log(__FILE__": stat('%s') failed: %s\n", pathname, strerror(errno));
|
||||
pa_log(__FILE__": stat('%s') failed: %s", pathname, strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -363,7 +363,7 @@ int pa_scache_add_directory_lazy(pa_core *c, const char *pathname) {
|
|||
/* If that fails, try to open it as shell glob */
|
||||
|
||||
if (glob(pathname, GLOB_ERR|GLOB_NOSORT, NULL, &p) < 0) {
|
||||
pa_log(__FILE__": Failed to open directory: %s\n", strerror(errno));
|
||||
pa_log(__FILE__": Failed to open directory: %s", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ void pa_subscription_free_all(pa_core *c) {
|
|||
break;
|
||||
}
|
||||
|
||||
pa_log(__FILE__": %u\n", e->index);
|
||||
pa_log(__FILE__": %u", e->index);
|
||||
}*/
|
||||
|
||||
/* Deferred callback for dispatching subscirption events */
|
||||
|
|
|
|||
|
|
@ -274,7 +274,7 @@ static int do_read(pa_ioline *l) {
|
|||
pa_ioline_puts(l, "\nExiting.\n");
|
||||
do_write(l);
|
||||
} else if (r < 0) {
|
||||
pa_log(__FILE__": read() failed: %s\n", strerror(errno));
|
||||
pa_log(__FILE__": read() failed: %s", strerror(errno));
|
||||
failure(l);
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -296,7 +296,7 @@ static int do_write(pa_ioline *l) {
|
|||
while (!l->dead && pa_iochannel_is_writable(l->io) && l->wbuf_valid_length) {
|
||||
|
||||
if ((r = pa_iochannel_write(l->io, l->wbuf+l->wbuf_index, l->wbuf_valid_length)) < 0) {
|
||||
pa_log(__FILE__": write() failed: %s\n", r < 0 ? strerror(errno) : "EOF");
|
||||
pa_log(__FILE__": write() failed: %s", r < 0 ? strerror(errno) : "EOF");
|
||||
failure(l);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_SYSLOG_H
|
||||
#include <syslog.h>
|
||||
|
|
@ -73,6 +75,8 @@ void pa_log_set_target(pa_log_target_t t, void (*func)(pa_log_level_t l, const c
|
|||
|
||||
void pa_log_levelv(pa_log_level_t level, const char *format, va_list ap) {
|
||||
const char *e;
|
||||
char *text, *t, *n;
|
||||
|
||||
assert(level < PA_LOG_LEVEL_MAX);
|
||||
|
||||
if ((e = getenv(ENV_LOGLEVEL)))
|
||||
|
|
@ -81,31 +85,55 @@ void pa_log_levelv(pa_log_level_t level, const char *format, va_list ap) {
|
|||
if (level > maximal_level)
|
||||
return;
|
||||
|
||||
switch (log_target) {
|
||||
case PA_LOG_STDERR:
|
||||
vfprintf(stderr, format, ap);
|
||||
break;
|
||||
text = pa_vsprintf_malloc(format, ap);
|
||||
|
||||
#ifdef HAVE_SYSLOG_H
|
||||
case PA_LOG_SYSLOG:
|
||||
openlog(log_ident ? log_ident : "???", LOG_PID, LOG_USER);
|
||||
vsyslog(level_to_syslog[level], format, ap);
|
||||
closelog();
|
||||
break;
|
||||
#endif
|
||||
|
||||
case PA_LOG_USER: {
|
||||
char *t = pa_vsprintf_malloc(format, ap);
|
||||
assert(user_log_func);
|
||||
user_log_func(level, t);
|
||||
pa_xfree(t);
|
||||
for (t = text; t; t = n) {
|
||||
if ((n = strchr(t, '\n'))) {
|
||||
*n = 0;
|
||||
n++;
|
||||
}
|
||||
|
||||
if (!*t)
|
||||
continue;
|
||||
|
||||
switch (log_target) {
|
||||
case PA_LOG_STDERR: {
|
||||
const char *prefix = "", *suffix = "";
|
||||
|
||||
/* Yes indeed. Useless, but fun! */
|
||||
if (isatty(STDERR_FILENO)) {
|
||||
if (level <= PA_LOG_ERROR) {
|
||||
prefix = "\x1B[1;31m";
|
||||
suffix = "\x1B[0m";
|
||||
} else if (level <= PA_LOG_WARN) {
|
||||
prefix = "\x1B[1m";
|
||||
suffix = "\x1B[0m";
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "%s%s%s\n", prefix, t, suffix);
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SYSLOG_H
|
||||
case PA_LOG_SYSLOG:
|
||||
openlog(log_ident ? log_ident : "???", LOG_PID, LOG_USER);
|
||||
syslog(level_to_syslog[level], "%s", t);
|
||||
closelog();
|
||||
break;
|
||||
#endif
|
||||
|
||||
case PA_LOG_USER:
|
||||
user_log_func(level, t);
|
||||
break;
|
||||
|
||||
case PA_LOG_NULL:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
case PA_LOG_NULL:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
pa_xfree(text);
|
||||
|
||||
}
|
||||
|
||||
void pa_log_level(pa_log_level_t level, const char *format, ...) {
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ pa_memblockq* pa_memblockq_new(
|
|||
bq->read_index = bq->write_index = idx;
|
||||
bq->memblock_stat = s;
|
||||
|
||||
pa_log_debug(__FILE__": memblockq requested: maxlength=%u, tlength=%u, base=%u, prebuf=%u, minreq=%u\n", maxlength, tlength, base, prebuf, minreq);
|
||||
pa_log_debug(__FILE__": memblockq requested: maxlength=%u, tlength=%u, base=%u, prebuf=%u, minreq=%u", maxlength, tlength, base, prebuf, minreq);
|
||||
|
||||
bq->maxlength = ((maxlength+base-1)/base)*base;
|
||||
assert(bq->maxlength >= base);
|
||||
|
|
@ -98,7 +98,7 @@ pa_memblockq* pa_memblockq_new(
|
|||
if (!bq->minreq)
|
||||
bq->minreq = 1;
|
||||
|
||||
pa_log_debug(__FILE__": memblockq sanitized: maxlength=%u, tlength=%u, base=%u, prebuf=%u, minreq=%u\n", bq->maxlength, bq->tlength, bq->base, bq->prebuf, bq->minreq);
|
||||
pa_log_debug(__FILE__": memblockq sanitized: maxlength=%u, tlength=%u, base=%u, prebuf=%u, minreq=%u", bq->maxlength, bq->tlength, bq->base, bq->prebuf, bq->minreq);
|
||||
|
||||
bq->state = bq->prebuf ? PREBUF : RUNNING;
|
||||
bq->silence = silence ? pa_memblock_ref(silence) : NULL;
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ pa_modinfo *pa_modinfo_get_by_name(const char *name) {
|
|||
assert(name);
|
||||
|
||||
if (!(dl = lt_dlopenext(name))) {
|
||||
pa_log(__FILE__": Failed to open module \"%s\": %s\n", name, lt_dlerror());
|
||||
pa_log(__FILE__": Failed to open module \"%s\": %s", name, lt_dlerror());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,17 +69,17 @@ pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) {
|
|||
m->argument = pa_xstrdup(argument);
|
||||
|
||||
if (!(m->dl = lt_dlopenext(name))) {
|
||||
pa_log(__FILE__": Failed to open module \"%s\": %s\n", name, lt_dlerror());
|
||||
pa_log(__FILE__": Failed to open module \"%s\": %s", name, lt_dlerror());
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!(m->init = (int (*)(pa_core *_c, pa_module*_m)) lt_dlsym(m->dl, PA_SYMBOL_INIT))) {
|
||||
pa_log(__FILE__": Failed to load module \"%s\": symbol \""PA_SYMBOL_INIT"\" not found.\n", name);
|
||||
pa_log(__FILE__": Failed to load module \"%s\": symbol \""PA_SYMBOL_INIT"\" not found.", name);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!(m->done = (void (*)(pa_core *_c, pa_module*_m)) lt_dlsym(m->dl, PA_SYMBOL_DONE))) {
|
||||
pa_log(__FILE__": Failed to load module \"%s\": symbol \""PA_SYMBOL_DONE"\" not found.\n", name);
|
||||
pa_log(__FILE__": Failed to load module \"%s\": symbol \""PA_SYMBOL_DONE"\" not found.", name);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) {
|
|||
|
||||
assert(m->init);
|
||||
if (m->init(c, m) < 0) {
|
||||
pa_log_error(__FILE__": Failed to load module \"%s\" (argument: \"%s\"): initialization failed.\n", name, argument ? argument : "");
|
||||
pa_log_error(__FILE__": Failed to load module \"%s\" (argument: \"%s\"): initialization failed.", name, argument ? argument : "");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) {
|
|||
r = pa_idxset_put(c->modules, m, &m->index);
|
||||
assert(r >= 0 && m->index != PA_IDXSET_INVALID);
|
||||
|
||||
pa_log_info(__FILE__": Loaded \"%s\" (index: #%u; argument: \"%s\").\n", m->name, m->index, m->argument ? m->argument : "");
|
||||
pa_log_info(__FILE__": Loaded \"%s\" (index: #%u; argument: \"%s\").", m->name, m->index, m->argument ? m->argument : "");
|
||||
|
||||
pa_subscription_post(c, PA_SUBSCRIPTION_EVENT_MODULE|PA_SUBSCRIPTION_EVENT_NEW, m->index);
|
||||
|
||||
|
|
@ -137,13 +137,13 @@ static void pa_module_free(pa_module *m) {
|
|||
if (m->core->disallow_module_loading)
|
||||
return;
|
||||
|
||||
pa_log_info(__FILE__": Unloading \"%s\" (index: #%u).\n", m->name, m->index);
|
||||
pa_log_info(__FILE__": Unloading \"%s\" (index: #%u).", m->name, m->index);
|
||||
|
||||
m->done(m->core, m);
|
||||
|
||||
lt_dlclose(m->dl);
|
||||
|
||||
pa_log_info(__FILE__": Unloaded \"%s\" (index: #%u).\n", m->name, m->index);
|
||||
pa_log_info(__FILE__": Unloaded \"%s\" (index: #%u).", m->name, m->index);
|
||||
|
||||
pa_subscription_post(m->core, PA_SUBSCRIPTION_EVENT_MODULE|PA_SUBSCRIPTION_EVENT_REMOVE, m->index);
|
||||
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ int pa_pdispatch_run(pa_pdispatch *pd, pa_packet*packet, void *userdata) {
|
|||
if (!(p = command_names[command]))
|
||||
snprintf((char*) (p = t), sizeof(t), "%u", command);
|
||||
|
||||
pa_log(__FILE__": Recieved opcode <%s>\n", p);
|
||||
pa_log(__FILE__": Recieved opcode <%s>", p);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -215,7 +215,7 @@ int pa_pdispatch_run(pa_pdispatch *pd, pa_packet*packet, void *userdata) {
|
|||
|
||||
(*c)(pd, command, tag, ts, userdata);
|
||||
} else {
|
||||
pa_log(__FILE__": Recieved unsupported command %u\n", command);
|
||||
pa_log(__FILE__": Recieved unsupported command %u", command);
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ static pid_t read_pid(const char *fn, int fd) {
|
|||
assert(fn && fd >= 0);
|
||||
|
||||
if ((r = pa_loop_read(fd, t, sizeof(t)-1)) < 0) {
|
||||
pa_log(__FILE__": WARNING: failed to read PID file '%s': %s\n", fn, strerror(errno));
|
||||
pa_log(__FILE__": WARNING: failed to read PID file '%s': %s", fn, strerror(errno));
|
||||
return (pid_t) -1;
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ static pid_t read_pid(const char *fn, int fd) {
|
|||
*e = 0;
|
||||
|
||||
if (pa_atou(t, &pid) < 0) {
|
||||
pa_log(__FILE__": WARNING: failed to parse PID file '%s'\n", fn);
|
||||
pa_log(__FILE__": WARNING: failed to parse PID file '%s'", fn);
|
||||
return (pid_t) -1;
|
||||
}
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ static int open_pid_file(const char *fn, int mode) {
|
|||
|
||||
if ((fd = open(fn, mode, S_IRUSR|S_IWUSR)) < 0) {
|
||||
if (mode != O_RDONLY || errno != ENOENT)
|
||||
pa_log(__FILE__": WARNING: failed to open PID file '%s': %s\n", fn, strerror(errno));
|
||||
pa_log(__FILE__": WARNING: failed to open PID file '%s': %s", fn, strerror(errno));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -93,7 +93,7 @@ static int open_pid_file(const char *fn, int mode) {
|
|||
goto fail;
|
||||
|
||||
if (fstat(fd, &st) < 0) {
|
||||
pa_log(__FILE__": Failed to fstat() PID file '%s': %s\n", fn, strerror(errno));
|
||||
pa_log(__FILE__": Failed to fstat() PID file '%s': %s", fn, strerror(errno));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ static int open_pid_file(const char *fn, int mode) {
|
|||
goto fail;
|
||||
|
||||
if (close(fd) < 0) {
|
||||
pa_log(__FILE__": Failed to close file '%s': %s\n", fn, strerror(errno));
|
||||
pa_log(__FILE__": Failed to close file '%s': %s", fn, strerror(errno));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ int pa_pid_file_create(void) {
|
|||
goto fail;
|
||||
|
||||
if ((pid = read_pid(fn, fd)) == (pid_t) -1)
|
||||
pa_log(__FILE__": corrupt PID file, overwriting.\n");
|
||||
pa_log(__FILE__": corrupt PID file, overwriting.");
|
||||
else if (pid > 0) {
|
||||
#ifdef OS_IS_WIN32
|
||||
if ((process = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid)) != NULL) {
|
||||
|
|
@ -153,16 +153,16 @@ int pa_pid_file_create(void) {
|
|||
#else
|
||||
if (kill(pid, 0) >= 0 || errno != ESRCH) {
|
||||
#endif
|
||||
pa_log(__FILE__": daemon already running.\n");
|
||||
pa_log(__FILE__": daemon already running.");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
pa_log(__FILE__": stale PID file, overwriting.\n");
|
||||
pa_log(__FILE__": stale PID file, overwriting.");
|
||||
}
|
||||
|
||||
/* Overwrite the current PID file */
|
||||
if (lseek(fd, 0, SEEK_SET) == (off_t) -1 || ftruncate(fd, 0) < 0) {
|
||||
pa_log(__FILE__": failed to truncate PID fil: %s.\n", strerror(errno));
|
||||
pa_log(__FILE__": failed to truncate PID fil: %s.", strerror(errno));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -170,7 +170,7 @@ int pa_pid_file_create(void) {
|
|||
l = strlen(t);
|
||||
|
||||
if (pa_loop_write(fd, t, l) != (ssize_t) l) {
|
||||
pa_log(__FILE__": failed to write PID file.\n");
|
||||
pa_log(__FILE__": failed to write PID file.");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -195,7 +195,7 @@ int pa_pid_file_remove(void) {
|
|||
pa_runtime_path("pid", fn, sizeof(fn));
|
||||
|
||||
if ((fd = open_pid_file(fn, O_RDWR)) < 0) {
|
||||
pa_log(__FILE__": WARNING: failed to open PID file '%s': %s\n", fn, strerror(errno));
|
||||
pa_log(__FILE__": WARNING: failed to open PID file '%s': %s", fn, strerror(errno));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -203,12 +203,12 @@ int pa_pid_file_remove(void) {
|
|||
goto fail;
|
||||
|
||||
if (pid != getpid()) {
|
||||
pa_log(__FILE__": WARNING: PID file '%s' not mine!\n", fn);
|
||||
pa_log(__FILE__": WARNING: PID file '%s' not mine!", fn);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (ftruncate(fd, 0) < 0) {
|
||||
pa_log(__FILE__": failed to truncate PID file '%s': %s\n", fn, strerror(errno));
|
||||
pa_log(__FILE__": failed to truncate PID file '%s': %s", fn, strerror(errno));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ int pa_pid_file_remove(void) {
|
|||
#endif
|
||||
|
||||
if (unlink(fn) < 0) {
|
||||
pa_log(__FILE__": failed to remove PID file '%s': %s\n", fn, strerror(errno));
|
||||
pa_log(__FILE__": failed to remove PID file '%s': %s", fn, strerror(errno));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ static void on_connection(pa_socket_server*s, pa_iochannel *io, void *userdata)
|
|||
assert(s && io && p);
|
||||
|
||||
if (pa_idxset_size(p->connections)+1 > MAX_CONNECTIONS) {
|
||||
pa_log(__FILE__": Warning! Too many connections (%u), dropping incoming connection.\n", MAX_CONNECTIONS);
|
||||
pa_log(__FILE__": Warning! Too many connections (%u), dropping incoming connection.", MAX_CONNECTIONS);
|
||||
pa_iochannel_free(io);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ static int esd_proto_connect(struct connection *c, PA_GCC_UNUSED esd_proto_t req
|
|||
|
||||
if (!c->authorized) {
|
||||
if (memcmp(data, c->protocol->esd_key, ESD_KEY_LEN) != 0) {
|
||||
pa_log(__FILE__": kicked client with invalid authorization key.\n");
|
||||
pa_log(__FILE__": kicked client with invalid authorization key.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -286,7 +286,7 @@ static int esd_proto_connect(struct connection *c, PA_GCC_UNUSED esd_proto_t req
|
|||
else if (ekey == ESD_SWAP_ENDIAN_KEY)
|
||||
c->swap_byte_order = 1;
|
||||
else {
|
||||
pa_log(__FILE__": client sent invalid endian key\n");
|
||||
pa_log(__FILE__": client sent invalid endian key");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -311,12 +311,12 @@ static int esd_proto_stream_play(struct connection *c, PA_GCC_UNUSED esd_proto_t
|
|||
format_esd2native(format, c->swap_byte_order, &ss);
|
||||
|
||||
if (!pa_sample_spec_valid(&ss)) {
|
||||
pa_log(__FILE__": invalid sample specification\n");
|
||||
pa_log(__FILE__": invalid sample specification");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(sink = pa_namereg_get(c->protocol->core, c->protocol->sink_name, PA_NAMEREG_SINK, 1))) {
|
||||
pa_log(__FILE__": no such sink\n");
|
||||
pa_log(__FILE__": no such sink");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -328,7 +328,7 @@ static int esd_proto_stream_play(struct connection *c, PA_GCC_UNUSED esd_proto_t
|
|||
assert(!c->sink_input && !c->input_memblockq);
|
||||
|
||||
if (!(c->sink_input = pa_sink_input_new(sink, __FILE__, name, &ss, NULL, 0, -1))) {
|
||||
pa_log(__FILE__": failed to create sink input.\n");
|
||||
pa_log(__FILE__": failed to create sink input.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -375,7 +375,7 @@ static int esd_proto_stream_record(struct connection *c, esd_proto_t request, co
|
|||
format_esd2native(format, c->swap_byte_order, &ss);
|
||||
|
||||
if (!pa_sample_spec_valid(&ss)) {
|
||||
pa_log(__FILE__": invalid sample specification.\n");
|
||||
pa_log(__FILE__": invalid sample specification.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -383,19 +383,19 @@ static int esd_proto_stream_record(struct connection *c, esd_proto_t request, co
|
|||
pa_sink* sink;
|
||||
|
||||
if (!(sink = pa_namereg_get(c->protocol->core, c->protocol->sink_name, PA_NAMEREG_SINK, 1))) {
|
||||
pa_log(__FILE__": no such sink.\n");
|
||||
pa_log(__FILE__": no such sink.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(source = sink->monitor_source)) {
|
||||
pa_log(__FILE__": no such monitor source.\n");
|
||||
pa_log(__FILE__": no such monitor source.");
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
assert(request == ESD_PROTO_STREAM_REC);
|
||||
|
||||
if (!(source = pa_namereg_get(c->protocol->core, c->protocol->source_name, PA_NAMEREG_SOURCE, 1))) {
|
||||
pa_log(__FILE__": no such source.\n");
|
||||
pa_log(__FILE__": no such source.");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
@ -408,7 +408,7 @@ static int esd_proto_stream_record(struct connection *c, esd_proto_t request, co
|
|||
assert(!c->output_memblockq && !c->source_output);
|
||||
|
||||
if (!(c->source_output = pa_source_output_new(source, __FILE__, name, &ss, NULL, -1))) {
|
||||
pa_log(__FILE__": failed to create source output\n");
|
||||
pa_log(__FILE__": failed to create source output");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -733,14 +733,14 @@ static void client_kill_cb(pa_client *c) {
|
|||
static int do_read(struct connection *c) {
|
||||
assert(c && c->io);
|
||||
|
||||
/* pa_log("READ\n"); */
|
||||
/* pa_log("READ"); */
|
||||
|
||||
if (c->state == ESD_NEXT_REQUEST) {
|
||||
ssize_t r;
|
||||
assert(c->read_data_length < sizeof(c->request));
|
||||
|
||||
if ((r = pa_iochannel_read(c->io, ((uint8_t*) &c->request) + c->read_data_length, sizeof(c->request) - c->read_data_length)) <= 0) {
|
||||
pa_log_debug(__FILE__": read() failed: %s\n", r < 0 ? strerror(errno) : "EOF");
|
||||
pa_log_debug(__FILE__": read() failed: %s", r < 0 ? strerror(errno) : "EOF");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -750,16 +750,16 @@ static int do_read(struct connection *c) {
|
|||
c->request = MAYBE_INT32_SWAP(c->swap_byte_order, c->request);
|
||||
|
||||
if (c->request < ESD_PROTO_CONNECT || c->request > ESD_PROTO_MAX) {
|
||||
pa_log(__FILE__": recieved invalid request.\n");
|
||||
pa_log(__FILE__": recieved invalid request.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
handler = proto_map+c->request;
|
||||
|
||||
/* pa_log(__FILE__": executing request #%u\n", c->request); */
|
||||
/* pa_log(__FILE__": executing request #%u", c->request); */
|
||||
|
||||
if (!handler->proc) {
|
||||
pa_log(__FILE__": recieved unimplemented request #%u.\n", c->request);
|
||||
pa_log(__FILE__": recieved unimplemented request #%u.", c->request);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -788,7 +788,7 @@ static int do_read(struct connection *c) {
|
|||
assert(c->read_data && c->read_data_length < handler->data_length);
|
||||
|
||||
if ((r = pa_iochannel_read(c->io, (uint8_t*) c->read_data + c->read_data_length, handler->data_length - c->read_data_length)) <= 0) {
|
||||
pa_log_debug(__FILE__": read() failed: %s\n", r < 0 ? strerror(errno) : "EOF");
|
||||
pa_log_debug(__FILE__": read() failed: %s", r < 0 ? strerror(errno) : "EOF");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -808,7 +808,7 @@ static int do_read(struct connection *c) {
|
|||
assert(c->scache.memchunk.memblock && c->scache.name && c->scache.memchunk.index < c->scache.memchunk.length);
|
||||
|
||||
if ((r = pa_iochannel_read(c->io, (uint8_t*) c->scache.memchunk.memblock->data+c->scache.memchunk.index, c->scache.memchunk.length-c->scache.memchunk.index)) <= 0) {
|
||||
pa_log_debug(__FILE__": read() failed: %s\n", r < 0 ? strerror(errno) : "EOF");
|
||||
pa_log_debug(__FILE__": read() failed: %s", r < 0 ? strerror(errno) : "EOF");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -843,7 +843,7 @@ static int do_read(struct connection *c) {
|
|||
|
||||
assert(c->input_memblockq);
|
||||
|
||||
/* pa_log("STREAMING_DATA\n"); */
|
||||
/* pa_log("STREAMING_DATA"); */
|
||||
|
||||
if (!(l = pa_memblockq_missing(c->input_memblockq)))
|
||||
return 0;
|
||||
|
|
@ -865,7 +865,7 @@ static int do_read(struct connection *c) {
|
|||
}
|
||||
|
||||
if ((r = pa_iochannel_read(c->io, (uint8_t*) c->playback.current_memblock->data+c->playback.memblock_index, l)) <= 0) {
|
||||
pa_log_debug(__FILE__": read() failed: %s\n", r < 0 ? strerror(errno) : "EOF");
|
||||
pa_log_debug(__FILE__": read() failed: %s", r < 0 ? strerror(errno) : "EOF");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -888,14 +888,14 @@ static int do_read(struct connection *c) {
|
|||
static int do_write(struct connection *c) {
|
||||
assert(c && c->io);
|
||||
|
||||
/* pa_log("WRITE\n"); */
|
||||
/* pa_log("WRITE"); */
|
||||
|
||||
if (c->write_data_length) {
|
||||
ssize_t r;
|
||||
|
||||
assert(c->write_data_index < c->write_data_length);
|
||||
if ((r = pa_iochannel_write(c->io, (uint8_t*) c->write_data+c->write_data_index, c->write_data_length-c->write_data_index)) < 0) {
|
||||
pa_log(__FILE__": write() failed: %s\n", strerror(errno));
|
||||
pa_log(__FILE__": write() failed: %s", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -914,7 +914,7 @@ static int do_write(struct connection *c) {
|
|||
|
||||
if ((r = pa_iochannel_write(c->io, (uint8_t*) chunk.memblock->data+chunk.index, chunk.length)) < 0) {
|
||||
pa_memblock_unref(chunk.memblock);
|
||||
pa_log(__FILE__": write(): %s\n", strerror(errno));
|
||||
pa_log(__FILE__": write(): %s", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -967,7 +967,7 @@ static void io_callback(pa_iochannel*io, void *userdata) {
|
|||
struct connection *c = userdata;
|
||||
assert(io && c && c->io == io);
|
||||
|
||||
/* pa_log("IO\n"); */
|
||||
/* pa_log("IO"); */
|
||||
|
||||
do_work(c);
|
||||
}
|
||||
|
|
@ -978,7 +978,7 @@ static void defer_callback(pa_mainloop_api*a, pa_defer_event *e, void *userdata)
|
|||
struct connection *c = userdata;
|
||||
assert(a && c && c->defer_event == e);
|
||||
|
||||
/* pa_log("DEFER\n"); */
|
||||
/* pa_log("DEFER"); */
|
||||
|
||||
do_work(c);
|
||||
}
|
||||
|
|
@ -1005,7 +1005,7 @@ static void sink_input_drop_cb(pa_sink_input *i, const pa_memchunk *chunk, size_
|
|||
struct connection*c = i->userdata;
|
||||
assert(i && c && length);
|
||||
|
||||
/* pa_log("DROP\n"); */
|
||||
/* pa_log("DROP"); */
|
||||
|
||||
pa_memblockq_drop(c->input_memblockq, chunk, length);
|
||||
|
||||
|
|
@ -1072,7 +1072,7 @@ static void on_connection(pa_socket_server*s, pa_iochannel *io, void *userdata)
|
|||
assert(s && io && p);
|
||||
|
||||
if (pa_idxset_size(p->connections)+1 > MAX_CONNECTIONS) {
|
||||
pa_log(__FILE__": Warning! Too many connections (%u), dropping incoming connection.\n", MAX_CONNECTIONS);
|
||||
pa_log(__FILE__": Warning! Too many connections (%u), dropping incoming connection.", MAX_CONNECTIONS);
|
||||
pa_iochannel_free(io);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1142,7 +1142,7 @@ pa_protocol_esound* pa_protocol_esound_new(pa_core*core, pa_socket_server *serve
|
|||
p = pa_xmalloc(sizeof(pa_protocol_esound));
|
||||
|
||||
if (pa_modargs_get_value_boolean(ma, "public", &public) < 0) {
|
||||
pa_log(__FILE__": public= expects a boolean argument.\n");
|
||||
pa_log(__FILE__": public= expects a boolean argument.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) {
|
|||
/* We're done */
|
||||
c->state = DATA;
|
||||
|
||||
pa_log_info(__FILE__": request for %s\n", c->url);
|
||||
pa_log_info(__FILE__": request for %s", c->url);
|
||||
|
||||
if (!strcmp(c->url, URL_ROOT)) {
|
||||
char txt[256];
|
||||
|
|
@ -222,7 +222,7 @@ static void on_connection(pa_socket_server*s, pa_iochannel *io, void *userdata)
|
|||
assert(s && io && p);
|
||||
|
||||
if (pa_idxset_size(p->connections)+1 > MAX_CONNECTIONS) {
|
||||
pa_log_warn(__FILE__": Warning! Too many connections (%u), dropping incoming connection.\n", MAX_CONNECTIONS);
|
||||
pa_log_warn(__FILE__": Warning! Too many connections (%u), dropping incoming connection.", MAX_CONNECTIONS);
|
||||
pa_iochannel_free(io);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -507,7 +507,7 @@ static void request_bytes(struct playback_stream *s) {
|
|||
pa_tagstruct_putu32(t, l);
|
||||
pa_pstream_send_tagstruct(s->connection->pstream, t);
|
||||
|
||||
/* pa_log(__FILE__": Requesting %u bytes\n", l); */
|
||||
/* pa_log(__FILE__": Requesting %u bytes", l); */
|
||||
}
|
||||
|
||||
static void send_memblock(struct connection *c) {
|
||||
|
|
@ -585,11 +585,11 @@ static int sink_input_peek_cb(pa_sink_input *i, pa_memchunk *chunk) {
|
|||
}
|
||||
|
||||
if (pa_memblockq_peek(s->memblockq, chunk) < 0) {
|
||||
/* pa_log(__FILE__": peek: failure\n"); */
|
||||
/* pa_log(__FILE__": peek: failure"); */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* pa_log(__FILE__": peek: %u\n", chunk->length); */
|
||||
/* pa_log(__FILE__": peek: %u", chunk->length); */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -608,7 +608,7 @@ static void sink_input_drop_cb(pa_sink_input *i, const pa_memchunk *chunk, size_
|
|||
s->drain_request = 0;
|
||||
}
|
||||
|
||||
/* pa_log(__FILE__": after_drop: %u %u\n", pa_memblockq_get_length(s->memblockq), pa_memblockq_is_readable(s->memblockq)); */
|
||||
/* pa_log(__FILE__": after_drop: %u %u", pa_memblockq_get_length(s->memblockq), pa_memblockq_is_readable(s->memblockq)); */
|
||||
}
|
||||
|
||||
static void sink_input_kill_cb(pa_sink_input *i) {
|
||||
|
|
@ -622,7 +622,7 @@ static pa_usec_t sink_input_get_latency_cb(pa_sink_input *i) {
|
|||
assert(i && i->userdata);
|
||||
s = i->userdata;
|
||||
|
||||
/*pa_log(__FILE__": get_latency: %u\n", pa_memblockq_get_length(s->memblockq));*/
|
||||
/*pa_log(__FILE__": get_latency: %u", pa_memblockq_get_length(s->memblockq));*/
|
||||
|
||||
return pa_bytes_to_usec(pa_memblockq_get_length(s->memblockq), &s->sink_input->sample_spec);
|
||||
}
|
||||
|
|
@ -635,7 +635,7 @@ static void source_output_push_cb(pa_source_output *o, const pa_memchunk *chunk)
|
|||
s = o->userdata;
|
||||
|
||||
if (pa_memblockq_push_align(s->memblockq, chunk) < 0) {
|
||||
pa_log_warn(__FILE__": Failed to push data into output queue.\n");
|
||||
pa_log_warn(__FILE__": Failed to push data into output queue.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -654,7 +654,7 @@ static pa_usec_t source_output_get_latency_cb(pa_source_output *o) {
|
|||
assert(o && o->userdata);
|
||||
s = o->userdata;
|
||||
|
||||
/*pa_log(__FILE__": get_latency: %u\n", pa_memblockq_get_length(s->memblockq));*/
|
||||
/*pa_log(__FILE__": get_latency: %u", pa_memblockq_get_length(s->memblockq));*/
|
||||
|
||||
return pa_bytes_to_usec(pa_memblockq_get_length(s->memblockq), &o->sample_spec);
|
||||
}
|
||||
|
|
@ -662,7 +662,7 @@ static pa_usec_t source_output_get_latency_cb(pa_source_output *o) {
|
|||
/*** pdispatch callbacks ***/
|
||||
|
||||
static void protocol_error(struct connection *c) {
|
||||
pa_log(__FILE__": protocol error, kicking client\n");
|
||||
pa_log(__FILE__": protocol error, kicking client");
|
||||
connection_free(c);
|
||||
}
|
||||
|
||||
|
|
@ -868,7 +868,7 @@ static void command_auth(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_UNUSED uint32_t
|
|||
|
||||
if (!c->authorized) {
|
||||
if (memcmp(c->protocol->auth_cookie, cookie, PA_NATIVE_COOKIE_LENGTH) != 0) {
|
||||
pa_log(__FILE__": Denied access to client with invalid authorization key.\n");
|
||||
pa_log(__FILE__": Denied access to client with invalid authorization key.");
|
||||
pa_pstream_send_error(c->pstream, tag, PA_ERR_ACCESS);
|
||||
return;
|
||||
}
|
||||
|
|
@ -958,10 +958,10 @@ static void command_drain_playback_stream(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC
|
|||
pa_memblockq_prebuf_disable(s->memblockq);
|
||||
|
||||
if (!pa_memblockq_is_readable(s->memblockq)) {
|
||||
/* pa_log("immediate drain: %u\n", pa_memblockq_get_length(s->memblockq)); */
|
||||
/* pa_log("immediate drain: %u", pa_memblockq_get_length(s->memblockq)); */
|
||||
pa_pstream_send_simple_ack(c->pstream, tag);
|
||||
} else {
|
||||
/* pa_log("slow drain triggered\n"); */
|
||||
/* pa_log("slow drain triggered"); */
|
||||
s->drain_request = 1;
|
||||
s->drain_tag = tag;
|
||||
|
||||
|
|
@ -1967,7 +1967,7 @@ static void pstream_packet_callback(pa_pstream *p, pa_packet *packet, void *user
|
|||
assert(p && packet && packet->data && c);
|
||||
|
||||
if (pa_pdispatch_run(c->pdispatch, packet, c) < 0) {
|
||||
pa_log(__FILE__": invalid packet.\n");
|
||||
pa_log(__FILE__": invalid packet.");
|
||||
connection_free(c);
|
||||
}
|
||||
}
|
||||
|
|
@ -1978,7 +1978,7 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o
|
|||
assert(p && chunk && userdata);
|
||||
|
||||
if (!(stream = pa_idxset_get_by_index(c->output_streams, channel))) {
|
||||
pa_log(__FILE__": client sent block for invalid stream.\n");
|
||||
pa_log(__FILE__": client sent block for invalid stream.");
|
||||
connection_free(c);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1995,7 +1995,7 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o
|
|||
if (pa_memblockq_push_align(ps->memblockq, chunk) < 0) {
|
||||
pa_tagstruct *t;
|
||||
|
||||
pa_log_warn(__FILE__": failed to push data into queue\n");
|
||||
pa_log_warn(__FILE__": failed to push data into queue");
|
||||
|
||||
/* Pushing this block into the queue failed, so we simulate
|
||||
* it by skipping ahead */
|
||||
|
|
@ -2050,7 +2050,7 @@ static void pstream_die_callback(pa_pstream *p, void *userdata) {
|
|||
assert(p && c);
|
||||
connection_free(c);
|
||||
|
||||
/* pa_log(__FILE__": connection died.\n");*/
|
||||
/* pa_log(__FILE__": connection died.");*/
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2084,7 +2084,7 @@ static void on_connection(PA_GCC_UNUSED pa_socket_server*s, pa_iochannel *io, vo
|
|||
assert(io && p);
|
||||
|
||||
if (pa_idxset_size(p->connections)+1 > MAX_CONNECTIONS) {
|
||||
pa_log_warn(__FILE__": Warning! Too many connections (%u), dropping incoming connection.\n", MAX_CONNECTIONS);
|
||||
pa_log_warn(__FILE__": Warning! Too many connections (%u), dropping incoming connection.", MAX_CONNECTIONS);
|
||||
pa_iochannel_free(io);
|
||||
return;
|
||||
}
|
||||
|
|
@ -2138,7 +2138,7 @@ static int load_key(pa_protocol_native*p, const char*fn) {
|
|||
p->auth_cookie_in_property = 0;
|
||||
|
||||
if (!fn && pa_authkey_prop_get(p->core, PA_NATIVE_COOKIE_PROPERTY_NAME, p->auth_cookie, sizeof(p->auth_cookie)) >= 0) {
|
||||
pa_log_info(__FILE__": using already loaded auth cookie.\n");
|
||||
pa_log_info(__FILE__": using already loaded auth cookie.");
|
||||
pa_authkey_prop_ref(p->core, PA_NATIVE_COOKIE_PROPERTY_NAME);
|
||||
p->auth_cookie_in_property = 1;
|
||||
return 0;
|
||||
|
|
@ -2150,7 +2150,7 @@ static int load_key(pa_protocol_native*p, const char*fn) {
|
|||
if (pa_authkey_load_auto(fn, p->auth_cookie, sizeof(p->auth_cookie)) < 0)
|
||||
return -1;
|
||||
|
||||
pa_log_info(__FILE__": loading cookie from disk.\n");
|
||||
pa_log_info(__FILE__": loading cookie from disk.");
|
||||
|
||||
if (pa_authkey_prop_put(p->core, PA_NATIVE_COOKIE_PROPERTY_NAME, p->auth_cookie, sizeof(p->auth_cookie)) >= 0)
|
||||
p->auth_cookie_in_property = 1;
|
||||
|
|
@ -2164,7 +2164,7 @@ static pa_protocol_native* protocol_new_internal(pa_core *c, pa_module *m, pa_mo
|
|||
assert(c && ma);
|
||||
|
||||
if (pa_modargs_get_value_boolean(ma, "public", &public) < 0) {
|
||||
pa_log(__FILE__": public= expects a boolean argument.\n");
|
||||
pa_log(__FILE__": public= expects a boolean argument.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ static int do_read(struct connection *c) {
|
|||
}
|
||||
|
||||
if ((r = pa_iochannel_read(c->io, (uint8_t*) c->playback.current_memblock->data+c->playback.memblock_index, l)) <= 0) {
|
||||
pa_log_debug(__FILE__": read() failed: %s\n", r == 0 ? "EOF" : strerror(errno));
|
||||
pa_log_debug(__FILE__": read() failed: %s", r == 0 ? "EOF" : strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -166,7 +166,7 @@ static int do_write(struct connection *c) {
|
|||
|
||||
if ((r = pa_iochannel_write(c->io, (uint8_t*) chunk.memblock->data+chunk.index, chunk.length)) < 0) {
|
||||
pa_memblock_unref(chunk.memblock);
|
||||
pa_log(__FILE__": write(): %s\n", strerror(errno));
|
||||
pa_log(__FILE__": write(): %s", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -313,7 +313,7 @@ static void on_connection(pa_socket_server*s, pa_iochannel *io, void *userdata)
|
|||
assert(s && io && p);
|
||||
|
||||
if (pa_idxset_size(p->connections)+1 > MAX_CONNECTIONS) {
|
||||
pa_log(__FILE__": Warning! Too many connections (%u), dropping incoming connection.\n", MAX_CONNECTIONS);
|
||||
pa_log(__FILE__": Warning! Too many connections (%u), dropping incoming connection.", MAX_CONNECTIONS);
|
||||
pa_iochannel_free(io);
|
||||
return;
|
||||
}
|
||||
|
|
@ -342,12 +342,12 @@ static void on_connection(pa_socket_server*s, pa_iochannel *io, void *userdata)
|
|||
size_t l;
|
||||
|
||||
if (!(sink = pa_namereg_get(p->core, p->sink_name, PA_NAMEREG_SINK, 1))) {
|
||||
pa_log(__FILE__": Failed to get sink.\n");
|
||||
pa_log(__FILE__": Failed to get sink.");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!(c->sink_input = pa_sink_input_new(sink, __FILE__, c->client->name, &p->sample_spec, NULL, 0, -1))) {
|
||||
pa_log(__FILE__": Failed to create sink input.\n");
|
||||
pa_log(__FILE__": Failed to create sink input.");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -380,13 +380,13 @@ static void on_connection(pa_socket_server*s, pa_iochannel *io, void *userdata)
|
|||
size_t l;
|
||||
|
||||
if (!(source = pa_namereg_get(p->core, p->source_name, PA_NAMEREG_SOURCE, 1))) {
|
||||
pa_log(__FILE__": Failed to get source.\n");
|
||||
pa_log(__FILE__": Failed to get source.");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
c->source_output = pa_source_output_new(source, __FILE__, c->client->name, &p->sample_spec, NULL, -1);
|
||||
if (!c->source_output) {
|
||||
pa_log(__FILE__": Failed to create source output.\n");
|
||||
pa_log(__FILE__": Failed to create source output.");
|
||||
goto fail;
|
||||
}
|
||||
c->source_output->owner = p->module;
|
||||
|
|
@ -437,7 +437,7 @@ pa_protocol_simple* pa_protocol_simple_new(pa_core *core, pa_socket_server *serv
|
|||
|
||||
p->sample_spec = core->default_sample_spec;
|
||||
if (pa_modargs_get_sample_spec(ma, &p->sample_spec) < 0) {
|
||||
pa_log(__FILE__": Failed to parse sample type specification.\n");
|
||||
pa_log(__FILE__": Failed to parse sample type specification.");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -446,20 +446,20 @@ pa_protocol_simple* pa_protocol_simple_new(pa_core *core, pa_socket_server *serv
|
|||
|
||||
enable = 0;
|
||||
if (pa_modargs_get_value_boolean(ma, "record", &enable) < 0) {
|
||||
pa_log(__FILE__": record= expects a numeric argument.\n");
|
||||
pa_log(__FILE__": record= expects a numeric argument.");
|
||||
goto fail;
|
||||
}
|
||||
p->mode = enable ? RECORD : 0;
|
||||
|
||||
enable = 1;
|
||||
if (pa_modargs_get_value_boolean(ma, "playback", &enable) < 0) {
|
||||
pa_log(__FILE__": playback= expects a numeric argument.\n");
|
||||
pa_log(__FILE__": playback= expects a numeric argument.");
|
||||
goto fail;
|
||||
}
|
||||
p->mode |= enable ? PLAYBACK : 0;
|
||||
|
||||
if ((p->mode & (RECORD|PLAYBACK)) == 0) {
|
||||
pa_log(__FILE__": neither playback nor recording enabled for protocol.\n");
|
||||
pa_log(__FILE__": neither playback nor recording enabled for protocol.");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ void pa_pstream_send_packet(pa_pstream*p, pa_packet *packet) {
|
|||
if (p->dead)
|
||||
return;
|
||||
|
||||
/* pa_log(__FILE__": push-packet %p\n", packet); */
|
||||
/* pa_log(__FILE__": push-packet %p", packet); */
|
||||
|
||||
i = pa_xnew(struct item_info, 1);
|
||||
i->type = PA_PSTREAM_ITEM_PACKET;
|
||||
|
|
@ -263,7 +263,7 @@ void pa_pstream_send_memblock(pa_pstream*p, uint32_t channel, int64_t offset, pa
|
|||
if (p->dead)
|
||||
return;
|
||||
|
||||
/* pa_log(__FILE__": push-memblock %p\n", chunk); */
|
||||
/* pa_log(__FILE__": push-memblock %p", chunk); */
|
||||
|
||||
i = pa_xnew(struct item_info, 1);
|
||||
i->type = PA_PSTREAM_ITEM_MEMBLOCK;
|
||||
|
|
@ -301,7 +301,7 @@ static void prepare_next_write_item(pa_pstream *p) {
|
|||
p->write.index = 0;
|
||||
|
||||
if (p->write.current->type == PA_PSTREAM_ITEM_PACKET) {
|
||||
/*pa_log(__FILE__": pop-packet %p\n", p->write.current->packet);*/
|
||||
/*pa_log(__FILE__": pop-packet %p", p->write.current->packet);*/
|
||||
|
||||
assert(p->write.current->packet);
|
||||
p->write.data = p->write.current->packet->data;
|
||||
|
|
@ -385,7 +385,7 @@ static int do_read(pa_pstream *p) {
|
|||
|
||||
/* Frame size too large */
|
||||
if (ntohl(p->read.descriptor[PA_PSTREAM_DESCRIPTOR_LENGTH]) > FRAME_SIZE_MAX) {
|
||||
pa_log_warn(__FILE__": Frame size too large\n");
|
||||
pa_log_warn(__FILE__": Frame size too large");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -401,7 +401,7 @@ static int do_read(pa_pstream *p) {
|
|||
p->read.data = p->read.memblock->data;
|
||||
|
||||
if (ntohl(p->read.descriptor[PA_PSTREAM_DESCRIPTOR_SEEK]) > PA_SEEK_RELATIVE_END) {
|
||||
pa_log_warn(__FILE__": Invalid seek mode\n");
|
||||
pa_log_warn(__FILE__": Invalid seek mode");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ void pa_random(void *ret_data, size_t length) {
|
|||
if ((fd = open(RANDOM_DEVICE, O_RDONLY)) >= 0) {
|
||||
|
||||
if ((r = pa_loop_read(fd, ret_data, length)) < 0 || (size_t) r != length)
|
||||
pa_log_error(__FILE__": failed to read entropy from '%s'\n", RANDOM_DEVICE);
|
||||
pa_log_error(__FILE__": failed to read entropy from '%s'", RANDOM_DEVICE);
|
||||
|
||||
close(fd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -330,7 +330,7 @@ void pa_volume_memchunk(pa_memchunk*c, const pa_sample_spec *spec, const pa_cvol
|
|||
}
|
||||
|
||||
default:
|
||||
pa_log_error(__FILE__": ERROR: Unable to change volume of format %s.\n",
|
||||
pa_log_error(__FILE__": ERROR: Unable to change volume of format %s.",
|
||||
pa_sample_format_to_string(spec->format));
|
||||
abort();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ pa_sink_input* pa_sink_input_new(
|
|||
assert(s->state == PA_SINK_RUNNING);
|
||||
|
||||
if (pa_idxset_size(s->inputs) >= PA_MAX_INPUTS_PER_SINK) {
|
||||
pa_log_warn(__FILE__": Failed to create sink input: too many inputs per sink.\n");
|
||||
pa_log_warn(__FILE__": Failed to create sink input: too many inputs per sink.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ pa_sink_input* pa_sink_input_new(
|
|||
assert(r == 0);
|
||||
|
||||
pa_sample_spec_snprint(st, sizeof(st), spec);
|
||||
pa_log_info(__FILE__": created %u \"%s\" on %u with sample spec \"%s\"\n", i->index, i->name, s->index, st);
|
||||
pa_log_info(__FILE__": created %u \"%s\" on %u with sample spec \"%s\"", i->index, i->name, s->index, st);
|
||||
|
||||
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_NEW, i->index);
|
||||
|
||||
|
|
@ -141,7 +141,7 @@ static void sink_input_free(pa_sink_input* i) {
|
|||
if (i->state != PA_SINK_INPUT_DISCONNECTED)
|
||||
pa_sink_input_disconnect(i);
|
||||
|
||||
pa_log_info(__FILE__": freed %u \"%s\"\n", i->index, i->name);
|
||||
pa_log_info(__FILE__": freed %u \"%s\"", i->index, i->name);
|
||||
|
||||
if (i->resampled_chunk.memblock)
|
||||
pa_memblock_unref(i->resampled_chunk.memblock);
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ pa_sink* pa_sink_new(
|
|||
assert(s->index != PA_IDXSET_INVALID && r >= 0);
|
||||
|
||||
pa_sample_spec_snprint(st, sizeof(st), spec);
|
||||
pa_log_info(__FILE__": created %u \"%s\" with sample spec \"%s\"\n", s->index, s->name, st);
|
||||
pa_log_info(__FILE__": created %u \"%s\" with sample spec \"%s\"", s->index, s->name, st);
|
||||
|
||||
n = pa_sprintf_malloc("%s_monitor", name);
|
||||
s->monitor_source = pa_source_new(core, driver, n, 0, spec, map);
|
||||
|
|
@ -143,7 +143,7 @@ static void sink_free(pa_sink *s) {
|
|||
if (s->state != PA_SINK_DISCONNECTED)
|
||||
pa_sink_disconnect(s);
|
||||
|
||||
pa_log_info(__FILE__": freed %u \"%s\"\n", s->index, s->name);
|
||||
pa_log_info(__FILE__": freed %u \"%s\"", s->index, s->name);
|
||||
|
||||
pa_source_unref(s->monitor_source);
|
||||
s->monitor_source = NULL;
|
||||
|
|
@ -270,7 +270,7 @@ int pa_sink_render(pa_sink*s, size_t length, pa_memchunk *result) {
|
|||
result->memblock = pa_memblock_new(length, s->core->memblock_stat);
|
||||
assert(result->memblock);
|
||||
|
||||
/* pa_log("mixing %i\n", n); */
|
||||
/* pa_log("mixing %i", n); */
|
||||
|
||||
result->length = pa_mix(info, n, result->memblock->data, length, &s->sample_spec, &s->sw_volume);
|
||||
result->index = 0;
|
||||
|
|
|
|||
|
|
@ -137,17 +137,17 @@ static void do_call(pa_socket_client *c) {
|
|||
|
||||
lerror = sizeof(error);
|
||||
if (getsockopt(c->fd, SOL_SOCKET, SO_ERROR, (void*)&error, &lerror) < 0) {
|
||||
pa_log(__FILE__": getsockopt(): %s\n", strerror(errno));
|
||||
pa_log(__FILE__": getsockopt(): %s", strerror(errno));
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if (lerror != sizeof(error)) {
|
||||
pa_log(__FILE__": getsockopt() returned invalid size.\n");
|
||||
pa_log(__FILE__": getsockopt() returned invalid size.");
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if (error != 0) {
|
||||
pa_log_debug(__FILE__": connect(): %s\n", strerror(error));
|
||||
pa_log_debug(__FILE__": connect(): %s", strerror(error));
|
||||
errno = error;
|
||||
goto finish;
|
||||
}
|
||||
|
|
@ -188,7 +188,7 @@ static int do_connect(pa_socket_client *c, const struct sockaddr *sa, socklen_t
|
|||
|
||||
if ((r = connect(c->fd, sa, len)) < 0) {
|
||||
if (errno != EINPROGRESS) {
|
||||
/*pa_log(__FILE__": connect(): %s\n", strerror(errno));*/
|
||||
/*pa_log(__FILE__": connect(): %s", strerror(errno));*/
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -259,7 +259,7 @@ static int sockaddr_prepare(pa_socket_client *c, const struct sockaddr *sa, size
|
|||
}
|
||||
|
||||
if ((c->fd = socket(sa->sa_family, SOCK_STREAM, 0)) < 0) {
|
||||
pa_log(__FILE__": socket(): %s\n", strerror(errno));
|
||||
pa_log(__FILE__": socket(): %s", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ static void callback(pa_mainloop_api *mainloop, pa_io_event *e, int fd, PA_GCC_U
|
|||
pa_socket_server_ref(s);
|
||||
|
||||
if ((nfd = accept(fd, NULL, NULL)) < 0) {
|
||||
pa_log(__FILE__": accept(): %s\n", strerror(errno));
|
||||
pa_log(__FILE__": accept(): %s", strerror(errno));
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
|
@ -107,12 +107,12 @@ static void callback(pa_mainloop_api *mainloop, pa_io_event *e, int fd, PA_GCC_U
|
|||
request_init(&req, RQ_DAEMON, s->tcpwrap_service, RQ_FILE, nfd, NULL);
|
||||
fromhost(&req);
|
||||
if (!hosts_access(&req)) {
|
||||
pa_log_warn(__FILE__": TCP connection refused by tcpwrap.\n");
|
||||
pa_log_warn(__FILE__": TCP connection refused by tcpwrap.");
|
||||
close(nfd);
|
||||
goto finish;
|
||||
}
|
||||
|
||||
pa_log_info(__FILE__": TCP connection accepted by tcpwrap.\n");
|
||||
pa_log_info(__FILE__": TCP connection accepted by tcpwrap.");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -167,7 +167,7 @@ pa_socket_server* pa_socket_server_new_unix(pa_mainloop_api *m, const char *file
|
|||
assert(m && filename);
|
||||
|
||||
if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
|
||||
pa_log(__FILE__": socket(): %s\n", strerror(errno));
|
||||
pa_log(__FILE__": socket(): %s", strerror(errno));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -180,12 +180,12 @@ pa_socket_server* pa_socket_server_new_unix(pa_mainloop_api *m, const char *file
|
|||
pa_socket_low_delay(fd);
|
||||
|
||||
if (bind(fd, (struct sockaddr*) &sa, SUN_LEN(&sa)) < 0) {
|
||||
pa_log(__FILE__": bind(): %s\n", strerror(errno));
|
||||
pa_log(__FILE__": bind(): %s", strerror(errno));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (listen(fd, 5) < 0) {
|
||||
pa_log(__FILE__": listen(): %s\n", strerror(errno));
|
||||
pa_log(__FILE__": listen(): %s", strerror(errno));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -221,14 +221,14 @@ pa_socket_server* pa_socket_server_new_ipv4(pa_mainloop_api *m, uint32_t address
|
|||
assert(m && port);
|
||||
|
||||
if ((fd = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
|
||||
pa_log(__FILE__": socket(PF_INET): %s\n", strerror(errno));
|
||||
pa_log(__FILE__": socket(PF_INET): %s", strerror(errno));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
pa_fd_set_cloexec(fd, 1);
|
||||
|
||||
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void*)&on, sizeof(on)) < 0)
|
||||
pa_log(__FILE__": setsockopt(): %s\n", strerror(errno));
|
||||
pa_log(__FILE__": setsockopt(): %s", strerror(errno));
|
||||
|
||||
pa_socket_tcp_low_delay(fd);
|
||||
|
||||
|
|
@ -238,12 +238,12 @@ pa_socket_server* pa_socket_server_new_ipv4(pa_mainloop_api *m, uint32_t address
|
|||
sa.sin_addr.s_addr = htonl(address);
|
||||
|
||||
if (bind(fd, (struct sockaddr *) &sa, sizeof(sa)) < 0) {
|
||||
pa_log(__FILE__": bind(): %s\n", strerror(errno));
|
||||
pa_log(__FILE__": bind(): %s", strerror(errno));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (listen(fd, 5) < 0) {
|
||||
pa_log(__FILE__": listen(): %s\n", strerror(errno));
|
||||
pa_log(__FILE__": listen(): %s", strerror(errno));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -270,14 +270,14 @@ pa_socket_server* pa_socket_server_new_ipv6(pa_mainloop_api *m, const uint8_t ad
|
|||
assert(m && port);
|
||||
|
||||
if ((fd = socket(PF_INET6, SOCK_STREAM, 0)) < 0) {
|
||||
pa_log(__FILE__": socket(PF_INET6): %s\n", strerror(errno));
|
||||
pa_log(__FILE__": socket(PF_INET6): %s", strerror(errno));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
pa_fd_set_cloexec(fd, 1);
|
||||
|
||||
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void*)&on, sizeof(on)) < 0)
|
||||
pa_log(__FILE__": setsockopt(): %s\n", strerror(errno));
|
||||
pa_log(__FILE__": setsockopt(): %s", strerror(errno));
|
||||
|
||||
pa_socket_tcp_low_delay(fd);
|
||||
|
||||
|
|
@ -287,12 +287,12 @@ pa_socket_server* pa_socket_server_new_ipv6(pa_mainloop_api *m, const uint8_t ad
|
|||
memcpy(sa.sin6_addr.s6_addr, address, 16);
|
||||
|
||||
if (bind(fd, (struct sockaddr *) &sa, sizeof(sa)) < 0) {
|
||||
pa_log(__FILE__": bind(): %s\n", strerror(errno));
|
||||
pa_log(__FILE__": bind(): %s", strerror(errno));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (listen(fd, 5) < 0) {
|
||||
pa_log(__FILE__": listen(): %s\n", strerror(errno));
|
||||
pa_log(__FILE__": listen(): %s", strerror(errno));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -348,7 +348,7 @@ pa_socket_server* pa_socket_server_new_ip_string(pa_mainloop_api *m, const char
|
|||
if (inet_pton(AF_INET, name, &ipv4) > 0)
|
||||
return pa_socket_server_new_ipv4(m, ntohl(ipv4), port, tcpwrap_service);
|
||||
|
||||
pa_log_warn(__FILE__": failed to parse '%s'.\n", name);
|
||||
pa_log_warn(__FILE__": failed to parse '%s'.", name);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -392,7 +392,7 @@ char *pa_socket_server_get_address(pa_socket_server *s, char *c, size_t l) {
|
|||
socklen_t sa_len = sizeof(sa);
|
||||
|
||||
if (getsockname(s->fd, (struct sockaddr*) &sa, &sa_len) < 0) {
|
||||
pa_log(__FILE__": getsockname() failed: %s\n", strerror(errno));
|
||||
pa_log(__FILE__": getsockname() failed: %s", strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -413,7 +413,7 @@ char *pa_socket_server_get_address(pa_socket_server *s, char *c, size_t l) {
|
|||
char ip[INET6_ADDRSTRLEN];
|
||||
|
||||
if (!inet_ntop(AF_INET6, &sa.sin6_addr, ip, sizeof(ip))) {
|
||||
pa_log(__FILE__": inet_ntop() failed: %s\n", strerror(errno));
|
||||
pa_log(__FILE__": inet_ntop() failed: %s", strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -428,7 +428,7 @@ char *pa_socket_server_get_address(pa_socket_server *s, char *c, size_t l) {
|
|||
socklen_t sa_len = sizeof(sa);
|
||||
|
||||
if (getsockname(s->fd, (struct sockaddr*) &sa, &sa_len) < 0) {
|
||||
pa_log(__FILE__": getsockname() failed: %s\n", strerror(errno));
|
||||
pa_log(__FILE__": getsockname() failed: %s", strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -448,7 +448,7 @@ char *pa_socket_server_get_address(pa_socket_server *s, char *c, size_t l) {
|
|||
char ip[INET_ADDRSTRLEN];
|
||||
|
||||
if (!inet_ntop(AF_INET, &sa.sin_addr, ip, sizeof(ip))) {
|
||||
pa_log(__FILE__": inet_ntop() failed: %s\n", strerror(errno));
|
||||
pa_log(__FILE__": inet_ntop() failed: %s", strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ int pa_socket_set_rcvbuf(int fd, size_t l) {
|
|||
assert(fd >= 0);
|
||||
|
||||
/* if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (void*)&l, sizeof(l)) < 0) { */
|
||||
/* pa_log(__FILE__": SO_RCVBUF: %s\n", strerror(errno)); */
|
||||
/* pa_log(__FILE__": SO_RCVBUF: %s", strerror(errno)); */
|
||||
/* return -1; */
|
||||
/* } */
|
||||
|
||||
|
|
@ -183,7 +183,7 @@ int pa_socket_set_sndbuf(int fd, size_t l) {
|
|||
assert(fd >= 0);
|
||||
|
||||
/* if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (void*)&l, sizeof(l)) < 0) { */
|
||||
/* pa_log(__FILE__": SO_SNDBUF: %s\n", strerror(errno)); */
|
||||
/* pa_log(__FILE__": SO_SNDBUF: %s", strerror(errno)); */
|
||||
/* return -1; */
|
||||
/* } */
|
||||
|
||||
|
|
@ -197,7 +197,7 @@ int pa_unix_socket_is_stale(const char *fn) {
|
|||
int fd = -1, ret = -1;
|
||||
|
||||
if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
|
||||
pa_log(__FILE__": socket(): %s\n", strerror(errno));
|
||||
pa_log(__FILE__": socket(): %s", strerror(errno));
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ int pa_play_file(pa_sink *sink, const char *fname, const pa_cvolume *volume) {
|
|||
memset(&sfinfo, 0, sizeof(sfinfo));
|
||||
|
||||
if (!(u->sndfile = sf_open(fname, SFM_READ, &sfinfo))) {
|
||||
pa_log(__FILE__": Failed to open file %s\n", fname);
|
||||
pa_log(__FILE__": Failed to open file %s", fname);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -154,7 +154,7 @@ int pa_play_file(pa_sink *sink, const char *fname, const pa_cvolume *volume) {
|
|||
ss.channels = sfinfo.channels;
|
||||
|
||||
if (!pa_sample_spec_valid(&ss)) {
|
||||
pa_log(__FILE__": Unsupported sample format in file %s\n", fname);
|
||||
pa_log(__FILE__": Unsupported sample format in file %s", fname);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ int pa_sound_file_load(const char *fname, pa_sample_spec *ss, pa_memchunk *chunk
|
|||
memset(&sfinfo, 0, sizeof(sfinfo));
|
||||
|
||||
if (!(sf = sf_open(fname, SFM_READ, &sfinfo))) {
|
||||
pa_log(__FILE__": Failed to open file %s\n", fname);
|
||||
pa_log(__FILE__": Failed to open file %s", fname);
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
|
@ -71,12 +71,12 @@ int pa_sound_file_load(const char *fname, pa_sample_spec *ss, pa_memchunk *chunk
|
|||
ss->channels = sfinfo.channels;
|
||||
|
||||
if (!pa_sample_spec_valid(ss)) {
|
||||
pa_log(__FILE__": Unsupported sample format in file %s\n", fname);
|
||||
pa_log(__FILE__": Unsupported sample format in file %s", fname);
|
||||
goto finish;
|
||||
}
|
||||
|
||||
if ((l = pa_frame_size(ss)*sfinfo.frames) > MAX_FILE_SIZE) {
|
||||
pa_log(__FILE__": File too large\n");
|
||||
pa_log(__FILE__": File too large");
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ int pa_sound_file_load(const char *fname, pa_sample_spec *ss, pa_memchunk *chunk
|
|||
chunk->length = l;
|
||||
|
||||
if (readf_function(sf, chunk->memblock->data, sfinfo.frames) != sfinfo.frames) {
|
||||
pa_log(__FILE__": Premature file end\n");
|
||||
pa_log(__FILE__": Premature file end");
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ int pa_sound_file_too_big_to_cache(const char *fname) {
|
|||
pa_sample_spec ss;
|
||||
|
||||
if (!(sf = sf_open(fname, SFM_READ, &sfinfo))) {
|
||||
pa_log(__FILE__": Failed to open file %s\n", fname);
|
||||
pa_log(__FILE__": Failed to open file %s", fname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ int pa_sound_file_too_big_to_cache(const char *fname) {
|
|||
ss.channels = sfinfo.channels;
|
||||
|
||||
if ((pa_frame_size(&ss) * sfinfo.frames) > MAX_FILE_SIZE) {
|
||||
pa_log(__FILE__": File too large %s\n", fname);
|
||||
pa_log(__FILE__": File too large %s", fname);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ pa_source_output* pa_source_output_new(
|
|||
assert(s->state == PA_SOURCE_RUNNING);
|
||||
|
||||
if (pa_idxset_size(s->outputs) >= PA_MAX_OUTPUTS_PER_SOURCE) {
|
||||
pa_log(__FILE__": Failed to create source output: too many outputs per source.\n");
|
||||
pa_log(__FILE__": Failed to create source output: too many outputs per source.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -95,7 +95,7 @@ pa_source_output* pa_source_output_new(
|
|||
assert(r == 0);
|
||||
|
||||
pa_sample_spec_snprint(st, sizeof(st), spec);
|
||||
pa_log_info(__FILE__": created %u \"%s\" on %u with sample spec \"%s\"\n", o->index, o->name, s->index, st);
|
||||
pa_log_info(__FILE__": created %u \"%s\" on %u with sample spec \"%s\"", o->index, o->name, s->index, st);
|
||||
|
||||
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT|PA_SUBSCRIPTION_EVENT_NEW, o->index);
|
||||
|
||||
|
|
@ -127,7 +127,7 @@ static void source_output_free(pa_source_output* o) {
|
|||
if (o->state != PA_SOURCE_OUTPUT_DISCONNECTED)
|
||||
pa_source_output_disconnect(o);
|
||||
|
||||
pa_log_info(__FILE__": freed %u \"%s\"\n", o->index, o->name);
|
||||
pa_log_info(__FILE__": freed %u \"%s\"", o->index, o->name);
|
||||
|
||||
if (o->resampler)
|
||||
pa_resampler_free(o->resampler);
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ pa_source* pa_source_new(
|
|||
assert(s->index != PA_IDXSET_INVALID && r >= 0);
|
||||
|
||||
pa_sample_spec_snprint(st, sizeof(st), spec);
|
||||
pa_log_info(__FILE__": created %u \"%s\" with sample spec \"%s\"\n", s->index, s->name, st);
|
||||
pa_log_info(__FILE__": created %u \"%s\" with sample spec \"%s\"", s->index, s->name, st);
|
||||
|
||||
pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_SOURCE | PA_SUBSCRIPTION_EVENT_NEW, s->index);
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ static void source_free(pa_source *s) {
|
|||
if (s->state != PA_SOURCE_DISCONNECTED)
|
||||
pa_source_disconnect(s);
|
||||
|
||||
pa_log_info(__FILE__": freed %u \"%s\"\n", s->index, s->name);
|
||||
pa_log_info(__FILE__": freed %u \"%s\"", s->index, s->name);
|
||||
|
||||
pa_idxset_free(s->outputs, NULL, NULL);
|
||||
|
||||
|
|
|
|||
|
|
@ -120,10 +120,10 @@ void pa_make_nonblock_fd(int fd) {
|
|||
u_long arg = 1;
|
||||
if (ioctlsocket(fd, FIONBIO, &arg) < 0) {
|
||||
if (WSAGetLastError() == WSAENOTSOCK)
|
||||
pa_log_warn(__FILE__": WARNING: Only sockets can be made non-blocking!\n");
|
||||
pa_log_warn(__FILE__": WARNING: Only sockets can be made non-blocking!");
|
||||
}
|
||||
#else
|
||||
pa_log_warn(__FILE__": WARNING: Non-blocking I/O not supported.!\n");
|
||||
pa_log_warn(__FILE__": WARNING: Non-blocking I/O not supported.!");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -242,7 +242,7 @@ void pa_check_signal_is_blocked(int sig) {
|
|||
if (pthread_sigmask(SIG_SETMASK, NULL, &set) < 0) {
|
||||
#endif
|
||||
if (sigprocmask(SIG_SETMASK, NULL, &set) < 0) {
|
||||
pa_log(__FILE__": sigprocmask() failed: %s\n", strerror(errno));
|
||||
pa_log(__FILE__": sigprocmask() failed: %s", strerror(errno));
|
||||
return;
|
||||
}
|
||||
#ifdef HAVE_PTHREAD
|
||||
|
|
@ -255,16 +255,16 @@ void pa_check_signal_is_blocked(int sig) {
|
|||
/* Check whether the signal is trapped */
|
||||
|
||||
if (sigaction(sig, NULL, &sa) < 0) {
|
||||
pa_log(__FILE__": sigaction() failed: %s\n", strerror(errno));
|
||||
pa_log(__FILE__": sigaction() failed: %s", strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
if (sa.sa_handler != SIG_DFL)
|
||||
return;
|
||||
|
||||
pa_log(__FILE__": WARNING: %s is not trapped. This might cause malfunction!\n", pa_strsignal(sig));
|
||||
pa_log(__FILE__": WARNING: %s is not trapped. This might cause malfunction!", pa_strsignal(sig));
|
||||
#else /* HAVE_SIGACTION */
|
||||
pa_log(__FILE__": WARNING: %s might not be trapped. This might cause malfunction!\n", pa_strsignal(sig));
|
||||
pa_log(__FILE__": WARNING: %s might not be trapped. This might cause malfunction!", pa_strsignal(sig));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -366,7 +366,7 @@ char *pa_get_user_name(char *s, size_t l) {
|
|||
char *pa_get_host_name(char *s, size_t l) {
|
||||
assert(s && l > 0);
|
||||
if (gethostname(s, l) < 0) {
|
||||
pa_log(__FILE__": gethostname(): %s\n", strerror(errno));
|
||||
pa_log(__FILE__": gethostname(): %s", strerror(errno));
|
||||
return NULL;
|
||||
}
|
||||
s[l-1] = 0;
|
||||
|
|
@ -393,12 +393,12 @@ char *pa_get_home_dir(char *s, size_t l) {
|
|||
#ifdef HAVE_PWD_H
|
||||
#ifdef HAVE_GETPWUID_R
|
||||
if (getpwuid_r(getuid(), &pw, buf, sizeof(buf), &r) != 0 || !r) {
|
||||
pa_log(__FILE__": getpwuid_r() failed\n");
|
||||
pa_log(__FILE__": getpwuid_r() failed");
|
||||
#else
|
||||
/* XXX Not thread-safe, but needed on OSes (e.g. FreeBSD 4.X)
|
||||
* that do not support getpwuid_r. */
|
||||
if ((r = getpwuid(getuid())) == NULL) {
|
||||
pa_log(__FILE__": getpwuid_r() failed\n");
|
||||
pa_log(__FILE__": getpwuid_r() failed");
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -534,9 +534,9 @@ void pa_raise_priority(void) {
|
|||
|
||||
#ifdef HAVE_SYS_RESOURCE_H
|
||||
if (setpriority(PRIO_PROCESS, 0, NICE_LEVEL) < 0)
|
||||
pa_log_warn(__FILE__": setpriority() failed: %s\n", strerror(errno));
|
||||
pa_log_warn(__FILE__": setpriority() failed: %s", strerror(errno));
|
||||
else
|
||||
pa_log_info(__FILE__": Successfully gained nice level %i.\n", NICE_LEVEL);
|
||||
pa_log_info(__FILE__": Successfully gained nice level %i.", NICE_LEVEL);
|
||||
#endif
|
||||
|
||||
#ifdef _POSIX_PRIORITY_SCHEDULING
|
||||
|
|
@ -544,25 +544,25 @@ void pa_raise_priority(void) {
|
|||
struct sched_param sp;
|
||||
|
||||
if (sched_getparam(0, &sp) < 0) {
|
||||
pa_log(__FILE__": sched_getparam() failed: %s\n", strerror(errno));
|
||||
pa_log(__FILE__": sched_getparam() failed: %s", strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
sp.sched_priority = 1;
|
||||
if (sched_setscheduler(0, SCHED_FIFO, &sp) < 0) {
|
||||
pa_log_warn(__FILE__": sched_setscheduler() failed: %s\n", strerror(errno));
|
||||
pa_log_warn(__FILE__": sched_setscheduler() failed: %s", strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
pa_log_info(__FILE__": Successfully enabled SCHED_FIFO scheduling.\n");
|
||||
pa_log_info(__FILE__": Successfully enabled SCHED_FIFO scheduling.");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef OS_IS_WIN32
|
||||
if (!SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS))
|
||||
pa_log_warn(__FILE__": SetPriorityClass() failed: 0x%08X\n", GetLastError());
|
||||
pa_log_warn(__FILE__": SetPriorityClass() failed: 0x%08X", GetLastError());
|
||||
else
|
||||
pa_log_info(__FILE__": Successfully gained high priority class.\n");
|
||||
pa_log_info(__FILE__": Successfully gained high priority class.");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -741,7 +741,7 @@ static int is_group(gid_t gid, const char *name) {
|
|||
data = pa_xmalloc(n);
|
||||
|
||||
if (getgrgid_r(gid, &group, data, n, &result) < 0 || !result) {
|
||||
pa_log(__FILE__ ": getgrgid_r(%u) failed: %s\n", gid, strerror(errno));
|
||||
pa_log(__FILE__ ": getgrgid_r(%u) failed: %s", gid, strerror(errno));
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
|
@ -754,7 +754,7 @@ finish:
|
|||
/* XXX Not thread-safe, but needed on OSes (e.g. FreeBSD 4.X) that do not
|
||||
* support getgrgid_r. */
|
||||
if ((result = getgrgid(gid)) == NULL) {
|
||||
pa_log(__FILE__ ": getgrgid(%u) failed: %s\n", gid, strerror(errno));
|
||||
pa_log(__FILE__ ": getgrgid(%u) failed: %s", gid, strerror(errno));
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
|
@ -777,7 +777,7 @@ int pa_uid_in_group(const char *name, gid_t *gid) {
|
|||
gids = pa_xmalloc(sizeof(GETGROUPS_T)*n);
|
||||
|
||||
if ((n = getgroups(n, gids)) < 0) {
|
||||
pa_log(__FILE__": getgroups() failed: %s\n", strerror(errno));
|
||||
pa_log(__FILE__": getgroups() failed: %s", strerror(errno));
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
|
@ -834,7 +834,7 @@ int pa_lock_fd(int fd, int b) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
pa_log(__FILE__": %slock failed: %s\n", !b ? "un" : "", strerror(errno));
|
||||
pa_log(__FILE__": %slock failed: %s", !b ? "un" : "", strerror(errno));
|
||||
#endif
|
||||
|
||||
#ifdef OS_IS_WIN32
|
||||
|
|
@ -845,7 +845,7 @@ int pa_lock_fd(int fd, int b) {
|
|||
if (!b && UnlockFile(h, 0, 0, 0xFFFFFFFF, 0xFFFFFFFF))
|
||||
return 0;
|
||||
|
||||
pa_log(__FILE__": %slock failed: 0x%08X\n", !b ? "un" : "", GetLastError());
|
||||
pa_log(__FILE__": %slock failed: 0x%08X", !b ? "un" : "", GetLastError());
|
||||
#endif
|
||||
|
||||
return -1;
|
||||
|
|
@ -868,17 +868,17 @@ int pa_lock_lockfile(const char *fn) {
|
|||
struct stat st;
|
||||
|
||||
if ((fd = open(fn, O_CREAT|O_RDWR, S_IRUSR|S_IWUSR)) < 0) {
|
||||
pa_log(__FILE__": failed to create lock file '%s': %s\n", fn, strerror(errno));
|
||||
pa_log(__FILE__": failed to create lock file '%s': %s", fn, strerror(errno));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (pa_lock_fd(fd, 1) < 0) {
|
||||
pa_log(__FILE__": failed to lock file '%s'.\n", fn);
|
||||
pa_log(__FILE__": failed to lock file '%s'.", fn);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (fstat(fd, &st) < 0) {
|
||||
pa_log(__FILE__": failed to fstat() file '%s'.\n", fn);
|
||||
pa_log(__FILE__": failed to fstat() file '%s'.", fn);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -887,12 +887,12 @@ int pa_lock_lockfile(const char *fn) {
|
|||
break;
|
||||
|
||||
if (pa_lock_fd(fd, 0) < 0) {
|
||||
pa_log(__FILE__": failed to unlock file '%s'.\n", fn);
|
||||
pa_log(__FILE__": failed to unlock file '%s'.", fn);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (close(fd) < 0) {
|
||||
pa_log(__FILE__": failed to close file '%s'.\n", fn);
|
||||
pa_log(__FILE__": failed to close file '%s'.", fn);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -915,17 +915,17 @@ int pa_unlock_lockfile(const char *fn, int fd) {
|
|||
assert(fn && fd >= 0);
|
||||
|
||||
if (unlink(fn) < 0) {
|
||||
pa_log_warn(__FILE__": WARNING: unable to remove lock file '%s': %s\n", fn, strerror(errno));
|
||||
pa_log_warn(__FILE__": WARNING: unable to remove lock file '%s': %s", fn, strerror(errno));
|
||||
r = -1;
|
||||
}
|
||||
|
||||
if (pa_lock_fd(fd, 0) < 0) {
|
||||
pa_log_warn(__FILE__": WARNING: failed to unlock file '%s'.\n", fn);
|
||||
pa_log_warn(__FILE__": WARNING: failed to unlock file '%s'.", fn);
|
||||
r = -1;
|
||||
}
|
||||
|
||||
if (close(fd) < 0) {
|
||||
pa_log_warn(__FILE__": WARNING: failed to close lock file '%s': %s\n", fn, strerror(errno));
|
||||
pa_log_warn(__FILE__": WARNING: failed to close lock file '%s': %s", fn, strerror(errno));
|
||||
r = -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ static pa_x11_wrapper* x11_wrapper_new(pa_core *c, const char *name, const char
|
|||
int r;
|
||||
|
||||
if (!(d = XOpenDisplay(name))) {
|
||||
pa_log(__FILE__": XOpenDisplay() failed\n");
|
||||
pa_log(__FILE__": XOpenDisplay() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue