1 From: Ralf Jung <post@ralfj.de>
2 Date: Wed, 19 Sep 2012 13:12:58 +0200
3 Subject: Allow to set slave installation path during compilation
8 osspd.c | 12 ++----------
9 2 files changed, 7 insertions(+), 13 deletions(-)
11 diff --git a/Makefile b/Makefile
12 index 8d8fe87..236176e 100644
15 @@ -8,6 +8,7 @@ LDFLAGS := -L. -lossp $(LDFLAGS)
18 UDEVDIR := /etc/udev/rules.d
19 +SLAVESDIR := $(prefix)/sbin
21 ifeq "$(origin OSSPD_CFLAGS)" "undefined"
22 OSSPD_CFLAGS := $(shell pkg-config --cflags fuse)
23 @@ -38,8 +39,9 @@ headers := ossp.h ossp-util.h ossp-slave.h
24 all: osspd ossp-padsp ossp-alsap
27 - mkdir -p $(DESTDIR)$(prefix)/sbin
28 - install -m755 osspd ossp-padsp ossp-alsap $(DESTDIR)$(prefix)/sbin
29 + mkdir -p $(DESTDIR)$(prefix)/sbin $(DESTDIR)$(SLAVESDIR)
30 + install -m755 osspd $(DESTDIR)$(prefix)/sbin
31 + install -m755 ossp-padsp ossp-alsap $(DESTDIR)$(SLAVESDIR)
32 mkdir -p $(DESTDIR)$(UDEVDIR)
33 install -m644 98-osscuse.rules $(DESTDIR)$(UDEVDIR)
35 @@ -50,7 +52,7 @@ libossp.a: ossp.c ossp.h ossp-util.c ossp-util.h ossp-slave.c ossp-slave.h
36 $(AR) rc $@ ossp.o ossp-util.o ossp-slave.o
38 osspd: osspd.c libossp.a $(headers)
39 - $(CC) $(CFLAGS) $(OSSPD_CFLAGS) -o $@ $< $(OSSPD_LDFLAGS) $(LDFLAGS)
40 + $(CC) $(CFLAGS) $(OSSPD_CFLAGS) -DSLAVE_DEFAULT_PATH=\"$(SLAVESDIR)\" -o $@ $< $(OSSPD_LDFLAGS) $(LDFLAGS)
42 ossp-padsp: ossp-padsp.c libossp.a $(headers)
43 $(CC) $(CFLAGS) $(OSSP_PADSP_CFLAGS) -o $@ $< $(OSSP_PADSP_LDFLAGS) $(LDFLAGS)
44 diff --git a/osspd.c b/osspd.c
45 index 1dbe586..6b63c07 100644
48 @@ -2005,7 +2005,7 @@ static const char *usage =
49 " --max=MAX maximum number of open streams (default 256)\n"
50 " --umax=MAX maximum number of open streams per UID (default --max)\n"
51 " --exit-on-idle exit if idle\n"
52 -" --dsp-slave=PATH DSP slave (default ossp-padsp in the same dir)\n"
53 +" --dsp-slave=PATH DSP slave (default: " SLAVE_DEFAULT_PATH "/ossp-padsp)\n"
54 " --log=LEVEL log level (0..6)\n"
55 " --timestamp timestamp log messages\n"
56 " -v increase verbosity, can be specified multiple times\n"
57 @@ -2131,7 +2131,6 @@ int main(int argc, char **argv)
58 .max_streams = DFL_MAX_STREAMS,
60 struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
61 - char path_buf[PATH_MAX], *dir;
62 char adsp_buf[64] = "", mixer_buf[64] = "";
65 @@ -2175,19 +2174,12 @@ int main(int argc, char **argv)
66 if (sigaction(SIGPIPE, &sa, NULL))
67 fatal_e(-errno, "failed to ignore SIGPIPE");
69 - /* determine slave path and check for availability */
70 - ret = readlink("/proc/self/exe", path_buf, PATH_MAX - 1);
72 - fatal_e(-errno, "failed to determine executable path");
73 - path_buf[ret] = '\0';
74 - dir = dirname(path_buf);
76 if (param.dsp_slave_path) {
77 strncpy(dsp_slave_path, param.dsp_slave_path, PATH_MAX - 1);
78 dsp_slave_path[PATH_MAX - 1] = '\0';
80 ret = snprintf(dsp_slave_path, PATH_MAX, "%s/%s",
82 + SLAVE_DEFAULT_PATH, "ossp-padsp");
84 fatal("dsp slave pathname too long");