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 | 11 ++---------
9 2 files changed, 7 insertions(+), 12 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..b318fc8 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 @@ -2175,19 +2175,12 @@ int main(int argc, char **argv)
58 if (sigaction(SIGPIPE, &sa, NULL))
59 fatal_e(-errno, "failed to ignore SIGPIPE");
61 - /* determine slave path and check for availability */
62 - ret = readlink("/proc/self/exe", path_buf, PATH_MAX - 1);
64 - fatal_e(-errno, "failed to determine executable path");
65 - path_buf[ret] = '\0';
66 - dir = dirname(path_buf);
68 if (param.dsp_slave_path) {
69 strncpy(dsp_slave_path, param.dsp_slave_path, PATH_MAX - 1);
70 dsp_slave_path[PATH_MAX - 1] = '\0';
72 ret = snprintf(dsp_slave_path, PATH_MAX, "%s/%s",
74 + SLAVE_DEFAULT_PATH, "ossp-padsp");
76 fatal("dsp slave pathname too long");