sbcl 2.1.11 rebuild
[arch-packages.git] / ossp / trunk / 0001-Log-the-right-slave-program-name.patch
blob6baeb7f28582ff7c8408678e00104e51ef473749
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
3 Date: Fri, 18 Dec 2020 23:08:02 +0000
4 Subject: [PATCH] Log the right slave program name
6 ---
7 ossp-alsap.c | 2 +-
8 ossp-padsp.c | 2 +-
9 ossp-slave.c | 40 ++++++++++++++++++++--------------------
10 ossp-slave.h | 2 +-
11 4 files changed, 23 insertions(+), 23 deletions(-)
13 diff --git a/ossp-alsap.c b/ossp-alsap.c
14 index 72f3bd5..6b8228b 100644
15 --- a/ossp-alsap.c
16 +++ b/ossp-alsap.c
17 @@ -577,7 +577,7 @@ int main(int argc, char **argv)
19 int rc;
21 - ossp_slave_init(argc, argv);
22 + ossp_slave_init("ossp-alsap", argc, argv);
24 page_size = sysconf(_SC_PAGE_SIZE);
26 diff --git a/ossp-padsp.c b/ossp-padsp.c
27 index 3143960..c505b57 100644
28 --- a/ossp-padsp.c
29 +++ b/ossp-padsp.c
30 @@ -1479,7 +1479,7 @@ int main(int argc, char **argv)
32 int rc;
34 - ossp_slave_init(argc, argv);
35 + ossp_slave_init("ossp-padsp", argc, argv);
37 page_size = sysconf(_SC_PAGE_SIZE);
39 diff --git a/ossp-slave.c b/ossp-slave.c
40 index a290636..a0a9590 100644
41 --- a/ossp-slave.c
42 +++ b/ossp-slave.c
43 @@ -21,27 +21,27 @@
45 #include "ossp-slave.h"
47 -static const char *usage =
48 -"usage: ossp-SLAVE [options]\n"
49 -"\n"
50 -"proxies commands from osspd to pulseaudio\n"
51 -"\n"
52 -"options:\n"
53 -" -u UID uid to use\n"
54 -" -g GID gid to use\n"
55 -" -c CMD_FD fd to receive commands from osspd\n"
56 -" -n NOTIFY_FD fd to send async notifications to osspd\n"
57 -" -m MMAP_FD fd to use for mmap\n"
58 -" -o MMAP_OFFSET mmap offset\n"
59 -" -s MMAP_SIZE mmap size\n"
60 -" -l LOG_LEVEL set log level\n"
61 -" -t enable log timestamps\n";
62 +#define USAGE \
63 + "usage: %s [options]\n" \
64 + "\n" \
65 + "proxies commands from osspd to audio output\n" \
66 + "\n" \
67 + "options:\n" \
68 + " -u UID uid to use\n" \
69 + " -g GID gid to use\n" \
70 + " -c CMD_FD fd to receive commands from osspd\n" \
71 + " -n NOTIFY_FD fd to send async notifications to osspd\n" \
72 + " -m MMAP_FD fd to use for mmap\n" \
73 + " -o MMAP_OFFSET mmap offset\n" \
74 + " -s MMAP_SIZE mmap size\n" \
75 + " -l LOG_LEVEL set log level\n" \
76 + " -t enable log timestamps\n"
78 char ossp_user_name[OSSP_USER_NAME_LEN];
79 int ossp_cmd_fd = -1, ossp_notify_fd = -1;
80 void *ossp_mmap_addr[2];
82 -void ossp_slave_init(int argc, char **argv)
83 +void ossp_slave_init(const char *slave_name, int argc, char **argv)
85 int have_uid = 0, have_gid = 0;
86 uid_t uid;
87 @@ -89,23 +89,23 @@ void ossp_slave_init(int argc, char **argv)
90 if (!have_uid || !have_gid || ossp_cmd_fd < 0 || ossp_notify_fd < 0) {
91 - fputs(usage, stderr);
92 + fprintf(stderr, USAGE, slave_name);
93 _exit(1);
96 snprintf(ossp_user_name, sizeof(ossp_user_name), "uid%d", uid);
97 if (getpwuid_r(uid, &pw_buf, pw_sbuf, sizeof(pw_sbuf), &pw) == 0)
98 snprintf(ossp_user_name, sizeof(ossp_user_name), "%s",
99 pw->pw_name);
101 - snprintf(ossp_log_name, sizeof(ossp_log_name), "ossp-padsp[%s:%d]",
102 - ossp_user_name, getpid());
103 + snprintf(ossp_log_name, sizeof(ossp_log_name), "%s[%s:%d]",
104 + slave_name, ossp_user_name, getpid());
106 if (mmap_fd >= 0) {
107 void *p;
109 if (!mmap_off || !mmap_size) {
110 - fputs(usage, stderr);
111 + fprintf(stderr, USAGE, slave_name);
112 _exit(1);
115 diff --git a/ossp-slave.h b/ossp-slave.h
116 index 10c22cd..02522d9 100644
117 --- a/ossp-slave.h
118 +++ b/ossp-slave.h
119 @@ -19,7 +19,7 @@ extern char ossp_user_name[OSSP_USER_NAME_LEN];
120 extern int ossp_cmd_fd, ossp_notify_fd;
121 extern void *ossp_mmap_addr[2];
123 -void ossp_slave_init(int argc, char **argv);
124 +void ossp_slave_init(const char *slave_name, int argc, char **argv);
125 int ossp_slave_process_command(int cmd_fd,
126 ossp_action_fn_t const *action_fn_tbl,
127 int (*action_pre_fn)(void),