2215
|
1 |
diff -Naur jack-audio-connection-kit-0.116.2/config/cpu/Makefile.am jack-audio-connection-kit-0.116.2-patch/config/cpu/Makefile.am
|
|
2 |
--- jack-audio-connection-kit-0.116.2/config/cpu/Makefile.am 2007-04-12 21:08:32.000000000 +0200
|
|
3 |
+++ jack-audio-connection-kit-0.116.2-patch/config/cpu/Makefile.am 2009-09-20 19:20:09.718140719 +0200
|
|
4 |
@@ -1,2 +1,2 @@
|
|
5 |
MAINTAINERCLEANFILES = Makefile.in
|
|
6 |
-DIST_SUBDIRS = alpha cris generic i386 i486 ia64 m68k mips powerpc s390
|
|
7 |
+DIST_SUBDIRS = alpha cris generic i386 i486 ia64 m68k mips powerpc s390 sparc
|
|
8 |
diff -Naur jack-audio-connection-kit-0.116.2/config/cpu/i386/atomicity.h jack-audio-connection-kit-0.116.2-patch/config/cpu/i386/atomicity.h
|
|
9 |
--- jack-audio-connection-kit-0.116.2/config/cpu/i386/atomicity.h 2007-04-12 21:08:32.000000000 +0200
|
|
10 |
+++ jack-audio-connection-kit-0.116.2-patch/config/cpu/i386/atomicity.h 2009-09-20 19:20:09.719047630 +0200
|
|
11 |
@@ -30,6 +30,10 @@
|
|
12 |
|
|
13 |
typedef int _Atomic_word;
|
|
14 |
|
|
15 |
+#if defined(__SUNPRO_C)
|
|
16 |
+#pragma error_messages (off,E_ASM_UNUSED_PARAM)
|
|
17 |
+#endif
|
|
18 |
+
|
|
19 |
static inline _Atomic_word
|
|
20 |
__attribute__ ((__unused__))
|
|
21 |
__exchange_and_add(volatile _Atomic_word* __mem, int __val)
|
|
22 |
@@ -49,4 +53,8 @@
|
|
23 |
: "=m" (*__mem) : "ir" (__val), "m" (*__mem));
|
|
24 |
}
|
|
25 |
|
|
26 |
+#if defined(__SUNPRO_C)
|
|
27 |
+#pragma error_messages (default,E_ASM_UNUSED_PARAM)
|
|
28 |
+#endif
|
|
29 |
+
|
|
30 |
#endif /* atomicity.h */
|
|
31 |
diff -Naur jack-audio-connection-kit-0.116.2/config/cpu/sparc/atomicity.h jack-audio-connection-kit-0.116.2-patch/config/cpu/sparc/atomicity.h
|
|
32 |
--- jack-audio-connection-kit-0.116.2/config/cpu/sparc/atomicity.h 1970-01-01 01:00:00.000000000 +0100
|
|
33 |
+++ jack-audio-connection-kit-0.116.2-patch/config/cpu/sparc/atomicity.h 2009-09-20 19:20:09.720666259 +0200
|
|
34 |
@@ -0,0 +1,41 @@
|
|
35 |
+/* Low-level functions for atomic operations. Stub version.
|
|
36 |
+ Copyright (C) 1997,2001 Free Software Foundation, Inc.
|
|
37 |
+ This file is part of the GNU C Library.
|
|
38 |
+
|
|
39 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
40 |
+ modify it under the terms of the GNU Lesser General Public
|
|
41 |
+ License as published by the Free Software Foundation; either
|
|
42 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
43 |
+
|
|
44 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
45 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
46 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
47 |
+ Lesser General Public License for more details.
|
|
48 |
+
|
|
49 |
+ You should have received a copy of the GNU Lesser General Public
|
|
50 |
+ License along with the GNU C Library; if not, write to the Free
|
|
51 |
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
52 |
+ 02111-1307 USA. */
|
|
53 |
+
|
|
54 |
+#ifndef _ATOMICITY_H
|
|
55 |
+#define _ATOMICITY_H 1
|
|
56 |
+
|
|
57 |
+#warning "stub atomicity functions are not atomic on this platform"
|
|
58 |
+
|
|
59 |
+typedef int _Atomic_word;
|
|
60 |
+
|
|
61 |
+static inline _Atomic_word
|
|
62 |
+__exchange_and_add(volatile _Atomic_word* mem, int val)
|
|
63 |
+{
|
|
64 |
+ int result = *mem;
|
|
65 |
+ *mem += val;
|
|
66 |
+ return result;
|
|
67 |
+}
|
|
68 |
+
|
|
69 |
+static inline void
|
|
70 |
+__atomic_add(volatile _Atomic_word* mem, int val)
|
|
71 |
+{
|
|
72 |
+ *mem += val;
|
|
73 |
+}
|
|
74 |
+
|
|
75 |
+#endif /* atomicity.h */
|
|
76 |
diff -Naur jack-audio-connection-kit-0.116.2/config/cpu/sparc/cycles.h jack-audio-connection-kit-0.116.2-patch/config/cpu/sparc/cycles.h
|
|
77 |
--- jack-audio-connection-kit-0.116.2/config/cpu/sparc/cycles.h 1970-01-01 01:00:00.000000000 +0100
|
|
78 |
+++ jack-audio-connection-kit-0.116.2-patch/config/cpu/sparc/cycles.h 2009-09-20 19:20:09.721456565 +0200
|
|
79 |
@@ -0,0 +1,48 @@
|
|
80 |
+/*
|
|
81 |
+ Copyright (C) 2001 Paul Davis
|
|
82 |
+
|
|
83 |
+ This program is free software; you can redistribute it and/or modify
|
|
84 |
+ it under the terms of the GNU General Public License as published by
|
|
85 |
+ the Free Software Foundation; either version 2 of the License, or
|
|
86 |
+ (at your option) any later version.
|
|
87 |
+
|
|
88 |
+ This program is distributed in the hope that it will be useful,
|
|
89 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
90 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
91 |
+ GNU General Public License for more details.
|
|
92 |
+
|
|
93 |
+ You should have received a copy of the GNU General Public License
|
|
94 |
+ along with this program; if not, write to the Free Software
|
|
95 |
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
96 |
+
|
|
97 |
+*/
|
|
98 |
+
|
|
99 |
+#ifndef __jack_cycles_h__
|
|
100 |
+#define __jack_cycles_h__
|
|
101 |
+
|
|
102 |
+/* generic solution that is not really a solution at all */
|
|
103 |
+
|
|
104 |
+#if !defined(sun)
|
|
105 |
+#warning You are compiling JACK on a platform for which jack/config/sysdep/cycles.h needs work
|
|
106 |
+#endif
|
|
107 |
+#include <sys/time.h>
|
|
108 |
+
|
|
109 |
+typedef long cycles_t;
|
|
110 |
+
|
|
111 |
+static inline cycles_t get_cycles(void)
|
|
112 |
+{
|
|
113 |
+#if defined(sun)
|
|
114 |
+ /*
|
|
115 |
+ * gethrtime() returns nanoseconds. We need usec.
|
|
116 |
+ * Thus divide by 1000....
|
|
117 |
+ */
|
|
118 |
+ return((cycles_t)(gethrtime()/1000));
|
|
119 |
+#else
|
|
120 |
+ struct timeval tv;
|
|
121 |
+ gettimeofday (&tv, NULL);
|
|
122 |
+
|
|
123 |
+ return ((cycles_t) tv.tv_sec * 1000000) + tv.tv_usec;
|
|
124 |
+#endif
|
|
125 |
+}
|
|
126 |
+
|
|
127 |
+#endif /* __jack_cycles_h__ */
|
|
128 |
diff -Naur jack-audio-connection-kit-0.116.2/config/os/Makefile.am jack-audio-connection-kit-0.116.2-patch/config/os/Makefile.am
|
|
129 |
--- jack-audio-connection-kit-0.116.2/config/os/Makefile.am 2007-04-12 21:08:32.000000000 +0200
|
|
130 |
+++ jack-audio-connection-kit-0.116.2-patch/config/os/Makefile.am 2009-09-20 19:20:09.722127482 +0200
|
|
131 |
@@ -1,3 +1,3 @@
|
|
132 |
MAINTAINERCLEANFILES = Makefile.in
|
|
133 |
-DIST_SUBDIRS = generic gnu-linux macosx
|
|
134 |
+DIST_SUBDIRS = generic gnu-linux macosx solaris
|
|
135 |
|
|
136 |
diff -Naur jack-audio-connection-kit-0.116.2/config/os/solaris/Makefile.am jack-audio-connection-kit-0.116.2-patch/config/os/solaris/Makefile.am
|
|
137 |
--- jack-audio-connection-kit-0.116.2/config/os/solaris/Makefile.am 1970-01-01 01:00:00.000000000 +0100
|
|
138 |
+++ jack-audio-connection-kit-0.116.2-patch/config/os/solaris/Makefile.am 2009-09-20 19:20:09.722968581 +0200
|
|
139 |
@@ -0,0 +1,2 @@
|
|
140 |
+MAINTAINERCLEANFILES = Makefile.in
|
|
141 |
+noinst_HEADERS = ipc.h poll.h time.c time.h
|
|
142 |
diff -Naur jack-audio-connection-kit-0.116.2/config/os/solaris/ipc.h jack-audio-connection-kit-0.116.2-patch/config/os/solaris/ipc.h
|
|
143 |
--- jack-audio-connection-kit-0.116.2/config/os/solaris/ipc.h 1970-01-01 01:00:00.000000000 +0100
|
|
144 |
+++ jack-audio-connection-kit-0.116.2-patch/config/os/solaris/ipc.h 2009-09-20 19:20:09.723790365 +0200
|
|
145 |
@@ -0,0 +1,27 @@
|
|
146 |
+/*
|
|
147 |
+ Copyright (C) 2004 Jack O'Quin
|
|
148 |
+
|
|
149 |
+ Generic version, overridden by OS-specific defines when needed.
|
|
150 |
+
|
|
151 |
+ This program is free software; you can redistribute it and/or modify
|
|
152 |
+ it under the terms of the GNU Lesser General Public License as published by
|
|
153 |
+ the Free Software Foundation; either version 2.1 of the License, or
|
|
154 |
+ (at your option) any later version.
|
|
155 |
+
|
|
156 |
+ This program is distributed in the hope that it will be useful,
|
|
157 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
158 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
159 |
+ GNU Lesser General Public License for more details.
|
|
160 |
+
|
|
161 |
+ You should have received a copy of the GNU Lesser General Public License
|
|
162 |
+ along with this program; if not, write to the Free Software
|
|
163 |
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
164 |
+
|
|
165 |
+*/
|
|
166 |
+
|
|
167 |
+#ifndef _jack_sys_ipc
|
|
168 |
+#define _jack_sys_ipc 1
|
|
169 |
+
|
|
170 |
+#include <sys/ipc.h>
|
|
171 |
+
|
|
172 |
+#endif /* _jack_sys_ipc */
|
|
173 |
diff -Naur jack-audio-connection-kit-0.116.2/config/os/solaris/poll.h jack-audio-connection-kit-0.116.2-patch/config/os/solaris/poll.h
|
|
174 |
--- jack-audio-connection-kit-0.116.2/config/os/solaris/poll.h 1970-01-01 01:00:00.000000000 +0100
|
|
175 |
+++ jack-audio-connection-kit-0.116.2-patch/config/os/solaris/poll.h 2009-09-20 19:20:09.724608083 +0200
|
|
176 |
@@ -0,0 +1,27 @@
|
|
177 |
+/*
|
|
178 |
+ Copyright (C) 2004 Jack O'Quin
|
|
179 |
+
|
|
180 |
+ Generic version, overridden by OS-specific defines when needed.
|
|
181 |
+
|
|
182 |
+ This program is free software; you can redistribute it and/or modify
|
|
183 |
+ it under the terms of the GNU Lesser General Public License as published by
|
|
184 |
+ the Free Software Foundation; either version 2.1 of the License, or
|
|
185 |
+ (at your option) any later version.
|
|
186 |
+
|
|
187 |
+ This program is distributed in the hope that it will be useful,
|
|
188 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
189 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
190 |
+ GNU Lesser General Public License for more details.
|
|
191 |
+
|
|
192 |
+ You should have received a copy of the GNU Lesser General Public License
|
|
193 |
+ along with this program; if not, write to the Free Software
|
|
194 |
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
195 |
+
|
|
196 |
+*/
|
|
197 |
+
|
|
198 |
+#ifndef _jack_sys_poll
|
|
199 |
+#define _jack_sys_poll 1
|
|
200 |
+
|
|
201 |
+#include <sys/poll.h>
|
|
202 |
+
|
|
203 |
+#endif /* _jack_sys_poll */
|
|
204 |
diff -Naur jack-audio-connection-kit-0.116.2/config/os/solaris/time.c jack-audio-connection-kit-0.116.2-patch/config/os/solaris/time.c
|
|
205 |
--- jack-audio-connection-kit-0.116.2/config/os/solaris/time.c 1970-01-01 01:00:00.000000000 +0100
|
|
206 |
+++ jack-audio-connection-kit-0.116.2-patch/config/os/solaris/time.c 2009-09-20 19:20:09.725405547 +0200
|
|
207 |
@@ -0,0 +1,30 @@
|
|
208 |
+/*
|
|
209 |
+ Copyright (C) 2001-2004 Paul Davis, Tilman Linneweh
|
|
210 |
+
|
|
211 |
+ Generic version, overridden by OS-specific definition when needed.
|
|
212 |
+
|
|
213 |
+ This program is free software; you can redistribute it and/or modify
|
|
214 |
+ it under the terms of the GNU Lesser General Public License as published by
|
|
215 |
+ the Free Software Foundation; either version 2.1 of the License, or
|
|
216 |
+ (at your option) any later version.
|
|
217 |
+
|
|
218 |
+ This program is distributed in the hope that it will be useful,
|
|
219 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
220 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
221 |
+ GNU Lesser General Public License for more details.
|
|
222 |
+
|
|
223 |
+ You should have received a copy of the GNU Lesser General Public License
|
|
224 |
+ along with this program; if not, write to the Free Software
|
|
225 |
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
226 |
+
|
|
227 |
+*/
|
|
228 |
+
|
|
229 |
+void jack_init_time ()
|
|
230 |
+{
|
|
231 |
+ /* nothing to do on a generic system - we use the system clock */
|
|
232 |
+}
|
|
233 |
+void jack_set_clock_source (jack_timer_type_t clocksrc)
|
|
234 |
+{
|
|
235 |
+ /* only one clock source on a generic system */
|
|
236 |
+}
|
|
237 |
+
|
|
238 |
diff -Naur jack-audio-connection-kit-0.116.2/config/os/solaris/time.h jack-audio-connection-kit-0.116.2-patch/config/os/solaris/time.h
|
|
239 |
--- jack-audio-connection-kit-0.116.2/config/os/solaris/time.h 1970-01-01 01:00:00.000000000 +0100
|
|
240 |
+++ jack-audio-connection-kit-0.116.2-patch/config/os/solaris/time.h 2009-09-20 19:20:09.726165687 +0200
|
|
241 |
@@ -0,0 +1,33 @@
|
|
242 |
+/*
|
|
243 |
+ Copyright (C) 2001-2004 Paul Davis, Tilman Linneweh
|
|
244 |
+
|
|
245 |
+ Generic version, overridden by OS-specific definition when needed.
|
|
246 |
+
|
|
247 |
+ This program is free software; you can redistribute it and/or modify
|
|
248 |
+ it under the terms of the GNU Lesser General Public License as published by
|
|
249 |
+ the Free Software Foundation; either version 2.1 of the License, or
|
|
250 |
+ (at your option) any later version.
|
|
251 |
+
|
|
252 |
+ This program is distributed in the hope that it will be useful,
|
|
253 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
254 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
255 |
+ GNU Lesser General Public License for more details.
|
|
256 |
+
|
|
257 |
+ You should have received a copy of the GNU Lesser General Public License
|
|
258 |
+ along with this program; if not, write to the Free Software
|
|
259 |
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
260 |
+
|
|
261 |
+*/
|
|
262 |
+#ifndef __jack_time_h__
|
|
263 |
+#define __jack_time_h__
|
|
264 |
+
|
|
265 |
+#include <jack/types.h>
|
|
266 |
+
|
|
267 |
+extern jack_time_t jack_get_microseconds_from_system (void);
|
|
268 |
+
|
|
269 |
+static inline jack_time_t
|
|
270 |
+jack_get_microseconds (void) {
|
|
271 |
+ return jack_get_microseconds_from_system ();
|
|
272 |
+}
|
|
273 |
+
|
|
274 |
+#endif /* __jack_time_h__ */
|
|
275 |
diff -Naur jack-audio-connection-kit-0.116.2/config/sysdeps/atomicity.h jack-audio-connection-kit-0.116.2-patch/config/sysdeps/atomicity.h
|
|
276 |
--- jack-audio-connection-kit-0.116.2/config/sysdeps/atomicity.h 2007-04-12 21:08:32.000000000 +0200
|
|
277 |
+++ jack-audio-connection-kit-0.116.2-patch/config/sysdeps/atomicity.h 2009-09-20 19:20:09.726850024 +0200
|
|
278 |
@@ -1,11 +1,11 @@
|
|
279 |
#ifndef _jack_sysdep_atomicity_h_
|
|
280 |
#define _jack_sysdep_atomicity_h_
|
|
281 |
|
|
282 |
-#if defined(__i386__)
|
|
283 |
+#if defined(__i386__) || (defined(__i386) && __SUNPRO_C >= 0x590)
|
|
284 |
|
|
285 |
#include <config/cpu/i386/atomicity.h>
|
|
286 |
|
|
287 |
-#elif defined(__x86_64)
|
|
288 |
+#elif defined(__x86_64) || (defined(__amd64) && __SUNPRO_C >= 0x590)
|
|
289 |
|
|
290 |
/* x86_64 can use rdtsc just like i[456]86 */
|
|
291 |
|
|
292 |
diff -Naur jack-audio-connection-kit-0.116.2/config/sysdeps/cycles.h jack-audio-connection-kit-0.116.2-patch/config/sysdeps/cycles.h
|
|
293 |
--- jack-audio-connection-kit-0.116.2/config/sysdeps/cycles.h 2007-04-12 21:08:32.000000000 +0200
|
|
294 |
+++ jack-audio-connection-kit-0.116.2-patch/config/sysdeps/cycles.h 2009-09-20 19:20:09.727737823 +0200
|
|
295 |
@@ -1,7 +1,7 @@
|
|
296 |
#ifndef _jack_sysdep_cycles_h_
|
|
297 |
#define _jack_sysdep_cycles_h_
|
|
298 |
|
|
299 |
-#if defined(__i386__)
|
|
300 |
+#if defined(__i386__) || (defined(__i386) && __SUNPRO_C >= 0x590)
|
|
301 |
|
|
302 |
/* technically, i386 doesn't have a cycle counter, but
|
|
303 |
running JACK on a real i386 seems like a ridiculuous
|
|
304 |
@@ -11,7 +11,7 @@
|
|
305 |
|
|
306 |
#include <config/cpu/i386/cycles.h>
|
|
307 |
|
|
308 |
-#elif defined(__x86_64)
|
|
309 |
+#elif defined(__x86_64) || (defined(__amd64) && __SUNPRO_C >= 0x590)
|
|
310 |
|
|
311 |
#include <config/cpu/i486/cycles.h>
|
|
312 |
|
|
313 |
@@ -19,6 +19,10 @@
|
|
314 |
|
|
315 |
#include <config/cpu/powerpc/cycles.h>
|
|
316 |
|
|
317 |
+#elif defined(__sparc)
|
|
318 |
+
|
|
319 |
+#include <config/cpu/sparc/cycles.h>
|
|
320 |
+
|
|
321 |
#else
|
|
322 |
|
|
323 |
#include <config/cpu/generic/cycles.h>
|
|
324 |
diff -Naur jack-audio-connection-kit-0.116.2/config/sysdeps/time.c jack-audio-connection-kit-0.116.2-patch/config/sysdeps/time.c
|
|
325 |
--- jack-audio-connection-kit-0.116.2/config/sysdeps/time.c 2007-04-12 21:08:32.000000000 +0200
|
|
326 |
+++ jack-audio-connection-kit-0.116.2-patch/config/sysdeps/time.c 2009-09-20 19:20:09.728388378 +0200
|
|
327 |
@@ -5,6 +5,8 @@
|
|
328 |
#include <config/os/gnu-linux/time.c>
|
|
329 |
#elif defined(__MACH__) && defined(__APPLE__)
|
|
330 |
#include <config/os/macosx/time.c>
|
|
331 |
+#elif defined(sun)
|
|
332 |
+#include <config/os/solaris/time.c>
|
|
333 |
#else
|
|
334 |
#include <config/os/generic/time.c>
|
|
335 |
#endif
|
|
336 |
diff -Naur jack-audio-connection-kit-0.116.2/config/sysdeps/time.h jack-audio-connection-kit-0.116.2-patch/config/sysdeps/time.h
|
|
337 |
--- jack-audio-connection-kit-0.116.2/config/sysdeps/time.h 2007-04-12 21:08:32.000000000 +0200
|
|
338 |
+++ jack-audio-connection-kit-0.116.2-patch/config/sysdeps/time.h 2009-09-20 19:20:09.729033592 +0200
|
|
339 |
@@ -5,6 +5,8 @@
|
|
340 |
#include <config/os/gnu-linux/time.h>
|
|
341 |
#elif defined(__MACH__) && defined(__APPLE__)
|
|
342 |
#include <config/os/macosx/time.h>
|
|
343 |
+#elif defined(sun)
|
|
344 |
+#include <config/os/solaris/time.h>
|
|
345 |
#else
|
|
346 |
#include <config/os/generic/time.h>
|
|
347 |
#endif
|
|
348 |
diff -Naur jack-audio-connection-kit-0.116.2/configure.ac jack-audio-connection-kit-0.116.2-patch/configure.ac
|
|
349 |
--- jack-audio-connection-kit-0.116.2/configure.ac 2009-02-06 11:40:56.000000000 +0100
|
|
350 |
+++ jack-audio-connection-kit-0.116.2-patch/configure.ac 2009-09-20 19:23:52.924391619 +0200
|
|
351 |
@@ -97,6 +97,23 @@
|
|
352 |
|
|
353 |
CFLAGS="$ORIGINAL_CFLAGS"
|
|
354 |
|
|
355 |
+AC_MSG_CHECKING([Sun C compiler])
|
|
356 |
+AC_COMPILE_IFELSE(
|
|
357 |
+ [AC_LANG_PROGRAM(
|
|
358 |
+ [[
|
|
359 |
+#ifndef __SUNPRO_C
|
|
360 |
+#error We r not him
|
|
361 |
+#endif
|
|
362 |
+#include <stdio.h>
|
|
363 |
+ ]],[[
|
|
364 |
+ (void)printf("JAVA CC");;
|
|
365 |
+ ]]
|
|
366 |
+ )],
|
|
367 |
+ [SUNCC=true
|
|
368 |
+ AC_MSG_RESULT(yes)],
|
|
369 |
+ [SUNCC=false
|
|
370 |
+ AC_MSG_RESULT(no)])
|
|
371 |
+
|
|
372 |
AC_MSG_CHECKING([platform dependencies])
|
|
373 |
|
|
374 |
HOST_DEFAULT_TMP_DIR=/dev/shm
|
|
375 |
@@ -121,6 +138,14 @@
|
|
376 |
TRY_POSIX_SHM=yes # POSIX shm works better
|
|
377 |
HOST_DEFAULT_TMP_DIR=/tmp
|
|
378 |
;;
|
|
379 |
+ solaris*)
|
|
380 |
+ JACK_CPP_VARARGS_BROKEN=1;
|
|
381 |
+ OS_LDFLAGS="-Wl,-z,muldefs"
|
|
382 |
+ if $SUNCC ; then
|
|
383 |
+ CPPFLAGS="-D__FUNCTION__=__func__"
|
|
384 |
+ CFLAGS="-xc99 -erroff=E_ARGUEMENT_MISMATCH $CFLAGS"
|
|
385 |
+ fi
|
|
386 |
+ ;;
|
|
387 |
esac
|
|
388 |
|
|
389 |
AC_SUBST(OS_LDFLAGS)
|
|
390 |
@@ -249,7 +274,7 @@
|
|
391 |
AM_CONDITIONAL(USE_POSIX_SHM, $USE_POSIX_SHM)
|
|
392 |
|
|
393 |
JACK_CORE_CFLAGS="-I\$(top_srcdir)/config -I\$(top_srcdir) \
|
|
394 |
--I\$(top_srcdir) -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -Wall"
|
|
395 |
+-I\$(top_srcdir) -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
|
|
396 |
|
|
397 |
JACK_LIBC_HELPER_FLAGS=
|
|
398 |
AC_ARG_ENABLE(ancient_libc,
|
|
399 |
@@ -705,6 +730,27 @@
|
|
400 |
fi
|
|
401 |
AM_CONDITIONAL(HAVE_PA, $HAVE_PA)
|
|
402 |
|
|
403 |
+#
|
|
404 |
+# Solaris does not have endian.h, so we check for the alsa hack version
|
|
405 |
+#
|
|
406 |
+AC_CHECK_HEADERS(endian.h alsa/endian-compat.h)
|
|
407 |
+#
|
|
408 |
+# Headers needed for Solaris
|
|
409 |
+#
|
|
410 |
+AC_CHECK_HEADERS(sys/rtpriocntl.h sys/priocntl.h limits.h stropts.h priv.h)
|
|
411 |
+
|
|
412 |
+#
|
|
413 |
+# If we find exec_attr.h, we assume we can use RBAC
|
|
414 |
+#
|
|
415 |
+USE_RBAC=false
|
|
416 |
+AC_CHECK_HEADER(exec_attr.h,[
|
|
417 |
+ AC_MSG_RESULT([*** Using Solaris RBAC ***])
|
|
418 |
+ USE_RBAC=true
|
|
419 |
+ AC_DEFINE(USE_RBAC,1,"Adding Solaris RBAC mods")
|
|
420 |
+])
|
|
421 |
+
|
|
422 |
+AM_CONDITIONAL(USE_RBAC,$USE_RBAC)
|
|
423 |
+
|
|
424 |
AC_ARG_ENABLE(coreaudio, AC_HELP_STRING([--disable-coreaudio], [ignore CoreAudio driver]),
|
|
425 |
TRY_COREAUDIO=$enableval , TRY_COREAUDIO=yes )
|
|
426 |
HAVE_COREAUDIO="false"
|
|
427 |
@@ -795,6 +841,14 @@
|
|
428 |
HAVE_ALSA_MIDI=$HAVE_ALSA
|
|
429 |
AM_CONDITIONAL(HAVE_ALSA_MIDI, $HAVE_ALSA_MIDI)
|
|
430 |
|
|
431 |
+case "${host_os}" in
|
|
432 |
+ solaris*)
|
|
433 |
+ if test "x$HAVE_OSS" != "x" ; then
|
|
434 |
+ JACK_DEFAULT_DRIVER=\"oss\"
|
|
435 |
+ fi
|
|
436 |
+ ;;
|
|
437 |
+esac
|
|
438 |
+
|
|
439 |
if test "$JACK_DEFAULT_DRIVER" = \"dummy\"; then
|
|
440 |
AC_MSG_WARN([Only the dummy driver can be built])
|
|
441 |
fi
|
|
442 |
diff -Naur jack-audio-connection-kit-0.116.2/drivers/alsa/memops.c jack-audio-connection-kit-0.116.2-patch/drivers/alsa/memops.c
|
|
443 |
--- jack-audio-connection-kit-0.116.2/drivers/alsa/memops.c 2008-11-22 12:54:59.000000000 +0100
|
|
444 |
+++ jack-audio-connection-kit-0.116.2-patch/drivers/alsa/memops.c 2009-09-20 19:27:17.137024449 +0200
|
|
445 |
@@ -30,7 +30,11 @@
|
|
446 |
#include <stdlib.h>
|
|
447 |
#include <stdint.h>
|
|
448 |
#include <limits.h>
|
|
449 |
+#if defined(HAVE_ENDIAN_H)
|
|
450 |
#include <endian.h>
|
|
451 |
+#elif defined(HAVE_ALSA_ENDIAN_COMPAT_H)
|
|
452 |
+#include <alsa/endian_compat.h>
|
|
453 |
+#endif
|
|
454 |
|
|
455 |
#include <jack/memops.h>
|
|
456 |
|
|
457 |
@@ -162,8 +166,15 @@
|
|
458 |
/* Linear Congruential noise generator. From the music-dsp list
|
|
459 |
* less random than rand(), but good enough and 10x faster
|
|
460 |
*/
|
|
461 |
-
|
|
462 |
-inline unsigned int fast_rand() {
|
|
463 |
+#ifndef __SUNPRO_C
|
|
464 |
+inline
|
|
465 |
+#endif
|
|
466 |
+unsigned int fast_rand();
|
|
467 |
+
|
|
468 |
+#ifndef __SUNPRO_C
|
|
469 |
+inline
|
|
470 |
+#endif
|
|
471 |
+unsigned int fast_rand() {
|
|
472 |
static unsigned int seed = 22222;
|
|
473 |
seed = (seed * 96314165) + 907633515;
|
|
474 |
|
|
475 |
diff -Naur jack-audio-connection-kit-0.116.2/drivers/netjack/net_driver.c jack-audio-connection-kit-0.116.2-patch/drivers/netjack/net_driver.c
|
|
476 |
--- jack-audio-connection-kit-0.116.2/drivers/netjack/net_driver.c 2009-02-06 11:34:50.000000000 +0100
|
|
477 |
+++ jack-audio-connection-kit-0.116.2-patch/drivers/netjack/net_driver.c 2009-09-20 21:53:27.939374212 +0200
|
|
478 |
@@ -41,6 +41,10 @@
|
|
479 |
#include <sys/socket.h>
|
|
480 |
#include <netinet/in.h>
|
|
481 |
|
|
482 |
+#if defined(__sun)
|
|
483 |
+#include <alloca.h>
|
|
484 |
+#endif
|
|
485 |
+
|
|
486 |
#include "config.h"
|
|
487 |
|
|
488 |
#if HAVE_SAMPLERATE
|
|
489 |
@@ -497,7 +501,7 @@
|
|
490 |
{
|
|
491 |
int r;
|
|
492 |
|
|
493 |
-#ifdef __APPLE__
|
|
494 |
+#if defined (__APPLE__) || defined (__sun)
|
|
495 |
static const int flag = 0;
|
|
496 |
#else
|
|
497 |
static const int flag = MSG_CONFIRM;
|
|
498 |
diff -Naur jack-audio-connection-kit-0.116.2/drivers/oss/oss_driver.c jack-audio-connection-kit-0.116.2-patch/drivers/oss/oss_driver.c
|
|
499 |
--- jack-audio-connection-kit-0.116.2/drivers/oss/oss_driver.c 2008-07-03 08:47:34.000000000 +0200
|
|
500 |
+++ jack-audio-connection-kit-0.116.2-patch/drivers/oss/oss_driver.c 2009-09-20 19:20:09.738289833 +0200
|
|
501 |
@@ -51,6 +51,9 @@
|
|
502 |
#include <stdarg.h>
|
|
503 |
#include <getopt.h>
|
|
504 |
#include <semaphore.h>
|
|
505 |
+#ifdef HAVE_STROPTS_H
|
|
506 |
+#include <stropts.h>
|
|
507 |
+#endif
|
|
508 |
|
|
509 |
#include <sys/types.h>
|
|
510 |
#include <sys/stat.h>
|
|
511 |
@@ -167,7 +170,7 @@
|
|
512 |
driver->period_size = new_period_size;
|
|
513 |
|
|
514 |
driver->period_usecs =
|
|
515 |
- ((double) driver->period_size /
|
|
516 |
+ ((double) driver->period_size * 1.2 /
|
|
517 |
(double) driver->sample_rate) * 1e6;
|
|
518 |
driver->last_wait_ust = 0;
|
|
519 |
driver->last_periodtime = jack_get_microseconds();
|
|
520 |
@@ -610,7 +613,7 @@
|
|
521 |
period_size);
|
|
522 |
driver->period_size = period_size;
|
|
523 |
driver->period_usecs =
|
|
524 |
- ((double) driver->period_size /
|
|
525 |
+ ((double) driver->period_size * 1.2 /
|
|
526 |
(double) driver->sample_rate) * 1e6;
|
|
527 |
driver->engine->set_buffer_size(driver->engine,
|
|
528 |
driver->period_size);
|
|
529 |
@@ -646,7 +649,7 @@
|
|
530 |
period_size);
|
|
531 |
driver->period_size = period_size;
|
|
532 |
driver->period_usecs =
|
|
533 |
- ((double) driver->period_size /
|
|
534 |
+ ((double) driver->period_size * 1.2 /
|
|
535 |
(double) driver->sample_rate) * 1e6;
|
|
536 |
driver->engine->set_buffer_size(driver->engine,
|
|
537 |
driver->period_size);
|
|
538 |
diff -Naur jack-audio-connection-kit-0.116.2/jack/internal.h jack-audio-connection-kit-0.116.2-patch/jack/internal.h
|
|
539 |
--- jack-audio-connection-kit-0.116.2/jack/internal.h 2008-11-30 10:56:08.000000000 +0100
|
|
540 |
+++ jack-audio-connection-kit-0.116.2-patch/jack/internal.h 2009-09-20 19:51:18.139099446 +0200
|
|
541 |
@@ -44,6 +44,9 @@
|
|
542 |
compiler.
|
|
543 |
*/
|
|
544 |
#define POST_PACKED_STRUCTURE __attribute__((__packed__))
|
|
545 |
+#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5100)
|
|
546 |
+/* Available from Sun Studio 12 u1 */
|
|
547 |
+#define POST_PACKED_STRUCTURE __attribute__((__packed__))
|
|
548 |
#else
|
|
549 |
/* Add other things here for non-gcc platforms */
|
|
550 |
#endif
|
|
551 |
diff -Naur jack-audio-connection-kit-0.116.2/jack/transport.h jack-audio-connection-kit-0.116.2-patch/jack/transport.h
|
|
552 |
--- jack-audio-connection-kit-0.116.2/jack/transport.h 2008-11-24 10:32:58.000000000 +0100
|
|
553 |
+++ jack-audio-connection-kit-0.116.2-patch/jack/transport.h 2009-09-20 19:52:01.590508514 +0200
|
|
554 |
@@ -37,6 +37,9 @@
|
|
555 |
compiler.
|
|
556 |
*/
|
|
557 |
#define POST_PACKED_STRUCTURE __attribute__((__packed__))
|
|
558 |
+#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5100)
|
|
559 |
+/* Available from Sun Studio 12 u1 */
|
|
560 |
+#define POST_PACKED_STRUCTURE __attribute__((__packed__))
|
|
561 |
#else
|
|
562 |
/* Add other things here for non-gcc platforms */
|
|
563 |
#endif
|
|
564 |
diff -Naur jack-audio-connection-kit-0.116.2/jackd/Makefile.am jack-audio-connection-kit-0.116.2-patch/jackd/Makefile.am
|
|
565 |
--- jack-audio-connection-kit-0.116.2/jackd/Makefile.am 2008-12-02 12:13:14.000000000 +0100
|
|
566 |
+++ jack-audio-connection-kit-0.116.2-patch/jackd/Makefile.am 2009-09-20 19:30:06.741357835 +0200
|
|
567 |
@@ -1,5 +1,10 @@
|
|
568 |
MAINTAINERCLEANFILES = Makefile.in jackd.1 jack_md5.h
|
|
569 |
|
|
570 |
+if USE_RBAC
|
|
571 |
+RBAC_PROGS = jackstart
|
|
572 |
+RBAC_LIBS = -lsecdb
|
|
573 |
+endif
|
|
574 |
+
|
|
575 |
if USE_CAPABILITIES
|
|
576 |
CAP_PROGS = jackstart
|
|
577 |
CAP_LIBS = -lcap
|
|
578 |
@@ -19,12 +24,13 @@
|
|
579 |
@echo "Nothing to make for $@."
|
|
580 |
endif
|
|
581 |
|
|
582 |
-bin_PROGRAMS = jackd $(CAP_PROGS)
|
|
583 |
+bin_PROGRAMS = jackd $(CAP_PROGS) $(RBAC_PROGS)
|
|
584 |
+
|
|
585 |
|
|
586 |
AM_CFLAGS = $(JACK_CFLAGS) -DJACK_LOCATION=\"$(bindir)\"
|
|
587 |
|
|
588 |
jackd_SOURCES = jackd.c
|
|
589 |
-jackd_LDADD = libjackserver.la $(CAP_LIBS) @OS_LDFLAGS@
|
|
590 |
+jackd_LDADD = libjackserver.la $(CAP_LIBS) $(RBAC_LIBS) @OS_LDFLAGS@
|
|
591 |
|
|
592 |
noinst_HEADERS = jack_md5.h md5.h md5_loc.h \
|
|
593 |
clientengine.h transengine.h
|
|
594 |
@@ -38,7 +44,7 @@
|
|
595 |
echo "#define JACKD_MD5_SUM \"`md5sum .libs/jackd | awk '{print $$1}'`\"" > jack_md5.h
|
|
596 |
|
|
597 |
jackstart_SOURCES = jackstart.c md5.c
|
|
598 |
-jackstart_LDFLAGS = -lcap
|
|
599 |
+jackstart_LDFLAGS = $(CAP_LIBS) $(RBAC_LIBS)
|
|
600 |
|
|
601 |
lib_LTLIBRARIES = libjackserver.la
|
|
602 |
|
|
603 |
diff -Naur jack-audio-connection-kit-0.116.2/jackd/engine.c jack-audio-connection-kit-0.116.2-patch/jackd/engine.c
|
|
604 |
--- jack-audio-connection-kit-0.116.2/jackd/engine.c 2008-12-02 17:29:23.000000000 +0100
|
|
605 |
+++ jack-audio-connection-kit-0.116.2-patch/jackd/engine.c 2009-09-20 19:55:10.686511825 +0200
|
|
606 |
@@ -52,10 +52,13 @@
|
|
607 |
#include <sys/mman.h>
|
|
608 |
#endif /* USE_MLOCK */
|
|
609 |
|
|
610 |
-#ifdef USE_CAPABILITIES
|
|
611 |
+#if defined(USE_CAPABILITIES)
|
|
612 |
/* capgetp and capsetp are linux only extensions, not posix */
|
|
613 |
#undef _POSIX_SOURCE
|
|
614 |
#include <sys/capability.h>
|
|
615 |
+#elif defined(USE_RBAC)
|
|
616 |
+#undef _POSIX_SOURCE
|
|
617 |
+#include <priv.h>
|
|
618 |
#endif
|
|
619 |
|
|
620 |
#include "clientengine.h"
|
|
621 |
@@ -1202,6 +1205,76 @@
|
|
622 |
|
|
623 |
#endif /* USE_CAPABILITIES */
|
|
624 |
|
|
625 |
+#ifdef USE_RBAC
|
|
626 |
+static int check_privs (jack_engine_t *engine){
|
|
627 |
+ int have_all_privs = 1;
|
|
628 |
+ priv_set_t *effective;
|
|
629 |
+ priv_ptype_t *p;
|
|
630 |
+
|
|
631 |
+ priv_ptype_t priv_list[] = {
|
|
632 |
+ PRIV_PROC_PRIOCNTL,
|
|
633 |
+ PRIV_PROC_LOCK_MEMORY,
|
|
634 |
+ PRIV_SYS_RESOURCE,
|
|
635 |
+ (priv_ptype_t)NULL };
|
|
636 |
+
|
|
637 |
+ effective=priv_allocset();
|
|
638 |
+ if (effective == NULL) {
|
|
639 |
+ VERBOSE (engine, "check: could not allocate privileges working storage\n");
|
|
640 |
+ return 0;
|
|
641 |
+ }
|
|
642 |
+ getppriv(PRIV_EFFECTIVE,effective);
|
|
643 |
+
|
|
644 |
+ p = priv_list;
|
|
645 |
+ while (*p!=(priv_ptype_t)NULL) {
|
|
646 |
+ if (!priv_ismember(effective,*p)){
|
|
647 |
+ have_all_privs = 0;
|
|
648 |
+ break;
|
|
649 |
+ }
|
|
650 |
+ p++;
|
|
651 |
+ }
|
|
652 |
+
|
|
653 |
+ priv_freeset(effective);
|
|
654 |
+ return(have_all_privs);
|
|
655 |
+}
|
|
656 |
+
|
|
657 |
+/*
|
|
658 |
+ * Fix Me. I want code.....
|
|
659 |
+ *
|
|
660 |
+ */
|
|
661 |
+static int give_privs (jack_engine_t *engine, pid_t pid){
|
|
662 |
+ char buf[1024];
|
|
663 |
+ static char client_privs[] =
|
|
664 |
+ "A+proc_priocntl,proc_lock_memory,sys_resource";
|
|
665 |
+ snprintf(buf,1024,"/usr/bin/ppriv -s %s %d",client_privs,pid);
|
|
666 |
+ system(buf);
|
|
667 |
+ return(0);
|
|
668 |
+}
|
|
669 |
+
|
|
670 |
+static int
|
|
671 |
+jack_set_client_privs (jack_engine_t *engine, pid_t priv_pid){
|
|
672 |
+ int ret = -1;
|
|
673 |
+
|
|
674 |
+ /* before sending this request the client has
|
|
675 |
+ already checked that the engine has
|
|
676 |
+ realtime privileges, that it is running
|
|
677 |
+ realtime and that the pid is defined
|
|
678 |
+ */
|
|
679 |
+
|
|
680 |
+ if ((ret = give_privs (engine, priv_pid)) != 0) {
|
|
681 |
+ jack_error ("could not give privileges to "
|
|
682 |
+ "process %d\n",
|
|
683 |
+ priv_pid);
|
|
684 |
+ } else {
|
|
685 |
+ VERBOSE (engine, "gave privileges to"
|
|
686 |
+ " process %d\n",
|
|
687 |
+ priv_pid);
|
|
688 |
+ }
|
|
689 |
+
|
|
690 |
+ return ret;
|
|
691 |
+}
|
|
692 |
+
|
|
693 |
+#endif
|
|
694 |
+
|
|
695 |
/* perform internal or external client request
|
|
696 |
*
|
|
697 |
* reply_fd is NULL for internal requests
|
|
698 |
@@ -1284,6 +1357,11 @@
|
|
699 |
req->x.cap_pid);
|
|
700 |
break;
|
|
701 |
#endif /* USE_CAPABILITIES */
|
|
702 |
+#ifdef USE_RBAC
|
|
703 |
+ case SetClientCapabilities:
|
|
704 |
+ req->status = jack_set_client_privs (engine, req->x.cap_pid);
|
|
705 |
+ break;
|
|
706 |
+#endif
|
|
707 |
|
|
708 |
case GetPortConnections:
|
|
709 |
case GetPortNConnections:
|
|
710 |
@@ -1399,6 +1477,12 @@
|
|
711 |
#endif /* JACK_USE_MACH_THREADS */
|
|
712 |
return 1;
|
|
713 |
} else {
|
|
714 |
+#ifdef sun
|
|
715 |
+ if (errno==EAGAIN){
|
|
716 |
+// jack_client_disconnect(engine, client->request_fd);
|
|
717 |
+ return(0);
|
|
718 |
+ }
|
|
719 |
+#endif
|
|
720 |
jack_error ("cannot read request from client (%d/%d/%s)",
|
|
721 |
r, sizeof(req), strerror (errno));
|
|
722 |
// XXX: shouldnt we mark this client as error now ?
|
|
723 |
@@ -1919,6 +2003,23 @@
|
|
724 |
}
|
|
725 |
#endif /* USE_CAPABILITIES */
|
|
726 |
|
|
727 |
+#ifdef USE_RBAC
|
|
728 |
+ /* only try to use privileges if not running as root */
|
|
729 |
+ engine->control->has_capabilities = check_privs(engine);
|
|
730 |
+ if (engine->control->has_capabilities == 0) {
|
|
731 |
+ VERBOSE (engine, "required capabilities privileges are not "
|
|
732 |
+ "available\n");
|
|
733 |
+ }
|
|
734 |
+ if (engine->verbose) {
|
|
735 |
+ priv_set_t *effective;
|
|
736 |
+ effective=priv_allocset();
|
|
737 |
+ getppriv(PRIV_EFFECTIVE,effective);
|
|
738 |
+ VERBOSE (engine, "privileges: %s\n",
|
|
739 |
+ priv_set_to_str(effective,',',PRIV_STR_PORT));
|
|
740 |
+ priv_freeset(effective);
|
|
741 |
+ }
|
|
742 |
+#endif /* USE_RBAC */
|
|
743 |
+
|
|
744 |
engine->control->engine_ok = 1;
|
|
745 |
|
|
746 |
snprintf (engine->fifo_prefix, sizeof (engine->fifo_prefix),
|
|
747 |
diff -Naur jack-audio-connection-kit-0.116.2/jackd/jackd.c jack-audio-connection-kit-0.116.2-patch/jackd/jackd.c
|
|
748 |
--- jack-audio-connection-kit-0.116.2/jackd/jackd.c 2008-07-03 08:47:33.000000000 +0200
|
|
749 |
+++ jack-audio-connection-kit-0.116.2-patch/jackd/jackd.c 2009-09-20 19:20:09.747343995 +0200
|
|
750 |
@@ -40,7 +40,7 @@
|
|
751 |
#include <jack/driver_parse.h>
|
|
752 |
#include <jack/messagebuffer.h>
|
|
753 |
|
|
754 |
-#ifdef USE_CAPABILITIES
|
|
755 |
+#if defined(USE_CAPABILITIES)
|
|
756 |
|
|
757 |
#include <sys/stat.h>
|
|
758 |
/* capgetp and capsetp are linux only extensions, not posix */
|
|
759 |
@@ -49,7 +49,14 @@
|
|
760 |
#include <jack/start.h>
|
|
761 |
|
|
762 |
static struct stat pipe_stat;
|
|
763 |
+#elif defined(USE_RBAC)
|
|
764 |
+#include <sys/stat.h>
|
|
765 |
+#include <priv.h>
|
|
766 |
+/* RBAC is a Solaris only extensions, not posix */
|
|
767 |
+#undef _POSIX_SOURCE
|
|
768 |
+#include <jack/start.h>
|
|
769 |
|
|
770 |
+static struct stat pipe_stat;
|
|
771 |
#endif /* USE_CAPABILITIES */
|
|
772 |
|
|
773 |
static JSList *drivers = NULL;
|
|
774 |
@@ -469,7 +476,7 @@
|
|
775 |
static void
|
|
776 |
maybe_use_capabilities ()
|
|
777 |
{
|
|
778 |
-#ifdef USE_CAPABILITIES
|
|
779 |
+#if defined(USE_CAPABILITIES) || defined(USE_RBAC)
|
|
780 |
int status;
|
|
781 |
|
|
782 |
/* check to see if there is a pipe in the right descriptor */
|
|
783 |
@@ -545,6 +552,9 @@
|
|
784 |
|
|
785 |
setvbuf (stdout, NULL, _IOLBF, 0);
|
|
786 |
|
|
787 |
+#if defined(USE_RBAC)
|
|
788 |
+ (void)setpflags(PRIV_AWARE,1);
|
|
789 |
+#endif
|
|
790 |
maybe_use_capabilities ();
|
|
791 |
|
|
792 |
opterr = 0;
|
|
793 |
diff -Naur jack-audio-connection-kit-0.116.2/jackd/jackstart.c jack-audio-connection-kit-0.116.2-patch/jackd/jackstart.c
|
|
794 |
--- jack-audio-connection-kit-0.116.2/jackd/jackstart.c 2007-04-12 21:08:34.000000000 +0200
|
|
795 |
+++ jack-audio-connection-kit-0.116.2-patch/jackd/jackstart.c 2009-09-20 19:20:09.748740380 +0200
|
|
796 |
@@ -35,7 +35,15 @@
|
|
797 |
#include <config.h>
|
|
798 |
|
|
799 |
#undef _POSIX_SOURCE
|
|
800 |
+#if defined(USE_CAPABILITIES)
|
|
801 |
#include <sys/capability.h>
|
|
802 |
+#elif defined(USE_RBAC)
|
|
803 |
+#include <pwd.h>
|
|
804 |
+#include <priv.h>
|
|
805 |
+#include <exec_attr.h>
|
|
806 |
+#else
|
|
807 |
+#warning Unknown System
|
|
808 |
+#endif
|
|
809 |
|
|
810 |
#include "jack/start.h"
|
|
811 |
#include "md5.h"
|
|
812 |
@@ -49,6 +57,7 @@
|
|
813 |
static char *jackd_md5_sum = JACKD_MD5_SUM;
|
|
814 |
|
|
815 |
|
|
816 |
+#if defined(USE_CAPABILITIES)
|
|
817 |
static int check_capabilities (void)
|
|
818 |
{
|
|
819 |
cap_t caps = cap_init();
|
|
820 |
@@ -121,6 +130,103 @@
|
|
821 |
cap_free (caps);
|
|
822 |
return 0;
|
|
823 |
}
|
|
824 |
+#endif
|
|
825 |
+
|
|
826 |
+#if defined(USE_RBAC)
|
|
827 |
+
|
|
828 |
+int check_jackd_rbac(uid_t uid, char *binpath){
|
|
829 |
+
|
|
830 |
+ execattr_t *exec;
|
|
831 |
+ struct passwd *pwent;
|
|
832 |
+ priv_set_t *iset = NULL;
|
|
833 |
+ char *inh;
|
|
834 |
+ priv_ptype_t *p;
|
|
835 |
+
|
|
836 |
+ priv_ptype_t priv_list[] =
|
|
837 |
+ { PRIV_PROC_PRIOCNTL,
|
|
838 |
+ PRIV_PROC_LOCK_MEMORY,
|
|
839 |
+ PRIV_SYS_RESOURCE,
|
|
840 |
+ (priv_ptype_t)NULL };
|
|
841 |
+
|
|
842 |
+ if ((pwent = getpwuid(uid)) == NULL) {
|
|
843 |
+ fprintf(stderr,"Error: Cannot find a username for %d\n",uid);
|
|
844 |
+ goto fail;
|
|
845 |
+ }
|
|
846 |
+
|
|
847 |
+ if ((exec=getexecuser(pwent->pw_name,KV_COMMAND,
|
|
848 |
+ binpath, GET_ONE)) == NULL) {
|
|
849 |
+ fprintf(stderr, "Error: Cannot get execution attributes\n");
|
|
850 |
+ goto fail;
|
|
851 |
+ }
|
|
852 |
+
|
|
853 |
+ if ((inh = kva_match(exec->attr, EXECATTR_IPRIV_KW)) == NULL) {
|
|
854 |
+ fprintf(stderr, "Error: Cannot get inherited privs\n");
|
|
855 |
+ goto fail;
|
|
856 |
+ }
|
|
857 |
+
|
|
858 |
+ if ((iset = priv_str_to_set(inh, ",", NULL)) == NULL) {
|
|
859 |
+ fprintf(stderr, "Error: Cannot get inherited privs\n");
|
|
860 |
+ goto fail;
|
|
861 |
+ }
|
|
862 |
+
|
|
863 |
+ p = priv_list;
|
|
864 |
+ while (*p!=(priv_ptype_t)NULL) {
|
|
865 |
+ if (!priv_ismember(iset,*p)){
|
|
866 |
+ fprintf(stderr, "Error: Missing %s privilege\n",*p);
|
|
867 |
+ goto fail;
|
|
868 |
+ }
|
|
869 |
+ p++;
|
|
870 |
+ }
|
|
871 |
+
|
|
872 |
+ if (exec) free_execattr(exec);
|
|
873 |
+ if (iset) priv_freeset(iset);
|
|
874 |
+ return(0);
|
|
875 |
+fail:
|
|
876 |
+ if (exec) free_execattr(exec);
|
|
877 |
+ if (iset) priv_freeset(iset);
|
|
878 |
+
|
|
879 |
+ fprintf(stderr,"\n");
|
|
880 |
+ fprintf(stderr,"Error: For jackd to use change it's priority to realtime, %s\n",binpath);
|
|
881 |
+ fprintf(stderr," requires the following privileges -\n");
|
|
882 |
+ p = priv_list;
|
|
883 |
+ while (*p!=(priv_ptype_t)NULL) {
|
|
884 |
+ fprintf(stderr," - %s\n",*p++);
|
|
885 |
+ }
|
|
886 |
+ fprintf(stderr,"\n");
|
|
887 |
+ return(-1);
|
|
888 |
+}
|
|
889 |
+
|
|
890 |
+int pfexec_execvp(char *binpath, int argc,char **argv){
|
|
891 |
+
|
|
892 |
+ static char *pfexec="/usr/bin/pfexec";
|
|
893 |
+ char **new_argv;
|
|
894 |
+ char **p;
|
|
895 |
+ char **argv_p;
|
|
896 |
+ int i;
|
|
897 |
+
|
|
898 |
+ /*
|
|
899 |
+ * make a new argv with pfexec added at the front.
|
|
900 |
+ */
|
|
901 |
+ if (!binpath) return(-1);
|
|
902 |
+ new_argv=(char **)malloc(sizeof(char *)*(argc+2));
|
|
903 |
+ p=new_argv;
|
|
904 |
+ *p++=pfexec;
|
|
905 |
+ *p++=binpath;
|
|
906 |
+ i=0;
|
|
907 |
+ argv_p=argv;
|
|
908 |
+ argv_p++; /* Skip arg0 */
|
|
909 |
+ while(*argv_p!=(char *)NULL&&i++<16){
|
|
910 |
+ *p++=*argv_p++;
|
|
911 |
+ }
|
|
912 |
+ *p=(char *)NULL;
|
|
913 |
+
|
|
914 |
+ execvp(pfexec,new_argv);
|
|
915 |
+ fprintf (stderr, "jackstart: Cannot exec %s : %s\n",
|
|
916 |
+ jackd_bin_path, strerror(errno));
|
|
917 |
+ free(new_argv);
|
|
918 |
+ return(-1);
|
|
919 |
+}
|
|
920 |
+#endif
|
|
921 |
|
|
922 |
static int check_binary (const char *binpath)
|
|
923 |
{
|
|
924 |
@@ -211,6 +317,7 @@
|
|
925 |
gid = getgid ();
|
|
926 |
euid = geteuid ();
|
|
927 |
|
|
928 |
+#if !defined(USE_RBAC)
|
|
929 |
/* are we running suid root? */
|
|
930 |
if (uid != 0) {
|
|
931 |
if (euid != 0) {
|
|
932 |
@@ -219,6 +326,9 @@
|
|
933 |
fprintf (stderr, " make jackstart suid root or start jackd directly\n\n");
|
|
934 |
}
|
|
935 |
}
|
|
936 |
+#endif
|
|
937 |
+
|
|
938 |
+#if defined(USE_CAPABILITIES)
|
|
939 |
/* see if we can get the required capabilities */
|
|
940 |
if (check_capabilities () == 0) {
|
|
941 |
size_t size;
|
|
942 |
@@ -230,6 +340,10 @@
|
|
943 |
fprintf (stderr, " a suitable kernel would have printed something like \"=eip\"\n\n");
|
|
944 |
}
|
|
945 |
|
|
946 |
+#elif defined(USE_RBAC)
|
|
947 |
+ check_jackd_rbac(euid, jackd_bin_path);
|
|
948 |
+#endif
|
|
949 |
+
|
|
950 |
/* check the executable, owner, permissions, md5 checksum */
|
|
951 |
if (check_binary(jackd_bin_path)) {
|
|
952 |
exit(1);
|
|
953 |
@@ -287,7 +401,11 @@
|
|
954 |
/* set gid and uid */
|
|
955 |
setregid(gid, gid);
|
|
956 |
setreuid(uid, uid);
|
|
957 |
+#if defined(USE_RBAC)
|
|
958 |
+ pfexec_execvp(jackd_bin_path, argc, argv);
|
|
959 |
+#else
|
|
960 |
execvp(jackd_bin_path, argv);
|
|
961 |
+#endif
|
|
962 |
|
|
963 |
/* we could not start jackd, clean up and exit */
|
|
964 |
fprintf(stderr, "jackstart: unable to execute %s: %s\n", jackd_bin_path, strerror(errno));
|
|
965 |
@@ -316,8 +434,10 @@
|
|
966 |
}
|
|
967 |
}
|
|
968 |
|
|
969 |
+#if defined(USE_CAPABILITIES)
|
|
970 |
/* set privileges on jackd process */
|
|
971 |
give_capabilities (parent_pid);
|
|
972 |
+#endif
|
|
973 |
}
|
|
974 |
exit (0);
|
|
975 |
}
|
|
976 |
diff -Naur jack-audio-connection-kit-0.116.2/libjack/client.c jack-audio-connection-kit-0.116.2-patch/libjack/client.c
|
|
977 |
--- jack-audio-connection-kit-0.116.2/libjack/client.c 2009-02-06 11:34:49.000000000 +0100
|
|
978 |
+++ jack-audio-connection-kit-0.116.2-patch/libjack/client.c 2009-09-20 19:20:09.751384143 +0200
|
|
979 |
@@ -668,15 +668,15 @@
|
|
980 |
}
|
|
981 |
|
|
982 |
if (!good) {
|
|
983 |
-#if defined(USE_CAPABILITIES)
|
|
984 |
+#if defined(USE_CAPABILITIES) || defined(USE_RBAC)
|
|
985 |
command = JACK_LOCATION "/jackstart";
|
|
986 |
strncpy(arguments, JACK_LOCATION "/jackstart -T -R -d "
|
|
987 |
JACK_DEFAULT_DRIVER " -p 512", 255);
|
|
988 |
-#else /* !USE_CAPABILITIES */
|
|
989 |
+#else /* !USE_CAPABILITIES && !USE_RBAC */
|
|
990 |
command = JACK_LOCATION "/jackd";
|
|
991 |
strncpy(arguments, JACK_LOCATION "/jackd -T -d "
|
|
992 |
JACK_DEFAULT_DRIVER, 255);
|
|
993 |
-#endif /* USE_CAPABILITIES */
|
|
994 |
+#endif /* USE_CAPABILITIES || USE_RBAC */
|
|
995 |
} else {
|
|
996 |
result = strcspn(arguments, " ");
|
|
997 |
command = (char *) malloc(result+1);
|
|
998 |
@@ -829,9 +829,9 @@
|
|
999 |
snprintf (req.name, sizeof (req.name),
|
|
1000 |
"%s", client_name);
|
|
1001 |
snprintf (req.object_path, sizeof (req.object_path),
|
|
1002 |
- "%s", va->load_name);
|
|
1003 |
+ "%s", va->load_name?va->load_name:"(null)");
|
|
1004 |
snprintf (req.object_data, sizeof (req.object_data),
|
|
1005 |
- "%s", va->load_init);
|
|
1006 |
+ "%s", va->load_init?va->load_init:"(null)");
|
|
1007 |
|
|
1008 |
if (write (*req_fd, &req, sizeof (req)) != sizeof (req)) {
|
|
1009 |
jack_error ("cannot send request to jack server (%s)",
|
|
1010 |
@@ -1955,7 +1955,7 @@
|
|
1011 |
|
|
1012 |
client->control->pid = getpid ();
|
|
1013 |
|
|
1014 |
-#ifdef USE_CAPABILITIES
|
|
1015 |
+#if defined(USE_CAPABILITIES) || defined(USE_RBAC)
|
|
1016 |
|
|
1017 |
if (client->engine->has_capabilities != 0 &&
|
|
1018 |
client->control->pid != 0 && client->engine->real_time != 0) {
|
|
1019 |
@@ -1985,7 +1985,7 @@
|
|
1020 |
"client will run non-realtime");
|
|
1021 |
}
|
|
1022 |
}
|
|
1023 |
-#endif /* USE_CAPABILITIES */
|
|
1024 |
+#endif /* USE_CAPABILITIES || USE_RBAC */
|
|
1025 |
|
|
1026 |
if (client->first_active) {
|
|
1027 |
|
|
1028 |
diff -Naur jack-audio-connection-kit-0.116.2/libjack/thread.c jack-audio-connection-kit-0.116.2-patch/libjack/thread.c
|
|
1029 |
--- jack-audio-connection-kit-0.116.2/libjack/thread.c 2008-10-25 14:29:26.000000000 +0200
|
|
1030 |
+++ jack-audio-connection-kit-0.116.2-patch/libjack/thread.c 2009-09-20 19:20:09.752588950 +0200
|
|
1031 |
@@ -39,6 +39,12 @@
|
|
1032 |
#include <sysdeps/pThreadUtilities.h>
|
|
1033 |
#endif
|
|
1034 |
|
|
1035 |
+#if defined(USE_RBAC)
|
|
1036 |
+#include <sys/types.h>
|
|
1037 |
+#include <sys/priocntl.h>
|
|
1038 |
+#include <sys/rtpriocntl.h>
|
|
1039 |
+#endif
|
|
1040 |
+
|
|
1041 |
static inline void
|
|
1042 |
log_result (char *msg, int res)
|
|
1043 |
{
|
|
1044 |
@@ -52,7 +58,7 @@
|
|
1045 |
static void
|
|
1046 |
maybe_get_capabilities (jack_client_t* client)
|
|
1047 |
{
|
|
1048 |
-#ifdef USE_CAPABILITIES
|
|
1049 |
+#if defined(USE_CAPABILITIES) || defined(USE_RBAC)
|
|
1050 |
|
|
1051 |
if (client != 0) {
|
|
1052 |
|
|
1053 |
@@ -86,7 +92,7 @@
|
|
1054 |
}
|
|
1055 |
}
|
|
1056 |
}
|
|
1057 |
-#endif /* USE_CAPABILITIES */
|
|
1058 |
+#endif /* USE_CAPABILITIES || USE_RBAC */
|
|
1059 |
}
|
|
1060 |
|
|
1061 |
static void*
|
|
1062 |
@@ -257,6 +263,29 @@
|
|
1063 |
int
|
|
1064 |
jack_acquire_real_time_scheduling (pthread_t thread, int priority)
|
|
1065 |
{
|
|
1066 |
+
|
|
1067 |
+#if defined(USE_RBAC)
|
|
1068 |
+ uintptr_t args[8];
|
|
1069 |
+ uintptr_t *argsp = &args[0];
|
|
1070 |
+ pcinfo_t pcinfo;
|
|
1071 |
+ pri_t maxrtpri;
|
|
1072 |
+
|
|
1073 |
+ maxrtpri = 60;
|
|
1074 |
+ if (priority<0) priority=0;
|
|
1075 |
+ if (priority>maxrtpri) priority=maxrtpri;
|
|
1076 |
+
|
|
1077 |
+ args[0]=RT_KY_PRI;
|
|
1078 |
+ args[1]=priority;
|
|
1079 |
+ args[2]=0;
|
|
1080 |
+
|
|
1081 |
+ if (priocntl(P_LWPID, thread, PC_SETXPARMS, "RT", argsp[0], argsp[1],
|
|
1082 |
+ argsp[2], 0)!=0){
|
|
1083 |
+ fprintf(stderr,"Error: Cannot change to RT priority : %s\n",
|
|
1084 |
+ strerror(errno));
|
|
1085 |
+ return(-1);
|
|
1086 |
+ }
|
|
1087 |
+ return(0);
|
|
1088 |
+#else
|
|
1089 |
struct sched_param rtparam;
|
|
1090 |
int x;
|
|
1091 |
|
|
1092 |
@@ -273,6 +302,7 @@
|
|
1093 |
}
|
|
1094 |
|
|
1095 |
return 0;
|
|
1096 |
+#endif
|
|
1097 |
}
|
|
1098 |
|
|
1099 |
#endif /* JACK_USE_MACH_THREADS */
|