Lines 1-561
Link Here
|
1 |
--- include/asoundlib-head.h.orig 2009-09-09 20:34:54.000000000 +0800 |
|
|
2 |
+++ include/asoundlib-head.h 2009-09-15 00:35:55.000000000 +0800 |
3 |
@@ -34,7 +34,11 @@ |
4 |
#include <string.h> |
5 |
#include <fcntl.h> |
6 |
#include <assert.h> |
7 |
+#ifdef __FreeBSD__ |
8 |
+#include <sys/endian.h> |
9 |
+#else |
10 |
#include <endian.h> |
11 |
+#endif |
12 |
#include <sys/poll.h> |
13 |
#include <errno.h> |
14 |
#include <stdarg.h> |
15 |
@@ -46,3 +50,31 @@ |
16 |
#include <alsa/output.h> |
17 |
#include <alsa/error.h> |
18 |
#include <alsa/conf.h> |
19 |
+ |
20 |
+#ifdef __FreeBSD__ |
21 |
+ |
22 |
+#define ESTRPIPE 0x7a69 /* Linux PCM suspend errno, fehh?! */ |
23 |
+#define EBADFD EBADF |
24 |
+ |
25 |
+#define bswap_16(x) bswap16(x) |
26 |
+#define bswap_32(x) bswap32(x) |
27 |
+#define bswap_64(x) bswap64(x) |
28 |
+ |
29 |
+#if __BYTE_ORDER == __LITTLE_ENDIAN |
30 |
+#define __cpu_to_le32(x) (x) |
31 |
+#define __cpu_to_be32(x) bswap_32(x) |
32 |
+#define __cpu_to_le16(x) (x) |
33 |
+#define __cpu_to_be16(x) bswap_16(x) |
34 |
+#else |
35 |
+#define __cpu_to_le32(x) bswap_32(x) |
36 |
+#define __cpu_to_be32(x) (x) |
37 |
+#define __cpu_to_le16(x) bswap_16(x) |
38 |
+#define __cpu_to_be16(x) (x) |
39 |
+#endif |
40 |
+ |
41 |
+#define __le32_to_cpu __cpu_to_le32 |
42 |
+#define __be32_to_cpu __cpu_to_be32 |
43 |
+#define __le16_to_cpu __cpu_to_le16 |
44 |
+#define __be16_to_cpu __cpu_to_be16 |
45 |
+ |
46 |
+#endif /* !__FreeBSD__ */ |
47 |
--- include/global.h.orig 2009-09-09 20:34:54.000000000 +0800 |
48 |
+++ include/global.h 2009-09-15 00:39:54.000000000 +0800 |
49 |
@@ -133,7 +133,7 @@ |
50 |
|
51 |
int snd_user_file(const char *file, char **result); |
52 |
|
53 |
-#if !defined(_POSIX_C_SOURCE) && !defined(_POSIX_SOURCE) |
54 |
+#if !defined(_POSIX_C_SOURCE) && !defined(_POSIX_SOURCE) && !defined(__FreeBSD__) |
55 |
struct timeval { |
56 |
time_t tv_sec; /* seconds */ |
57 |
long tv_usec; /* microseconds */ |
58 |
--- include/local.h.orig 2009-09-09 20:34:54.000000000 +0800 |
59 |
+++ include/local.h 2009-09-15 00:26:08.000000000 +0800 |
60 |
@@ -28,11 +28,19 @@ |
61 |
#include <string.h> |
62 |
#include <fcntl.h> |
63 |
#include <assert.h> |
64 |
+#ifdef __FreeBSD__ |
65 |
+#include <sys/endian.h> |
66 |
+#else |
67 |
#include <endian.h> |
68 |
+#endif |
69 |
#include <stdarg.h> |
70 |
#include <sys/poll.h> |
71 |
#include <errno.h> |
72 |
+#ifdef __linux__ |
73 |
#include <linux/ioctl.h> |
74 |
+#else |
75 |
+#include <sys/ioctl.h> |
76 |
+#endif |
77 |
|
78 |
#include "config.h" |
79 |
#ifdef SUPPORT_RESMGR |
80 |
--- include/search.h.orig 2009-09-09 20:34:54.000000000 +0800 |
81 |
+++ include/search.h 2009-09-15 00:49:10.000000000 +0800 |
82 |
@@ -20,7 +20,9 @@ |
83 |
#ifndef _SEARCH_H |
84 |
#define _SEARCH_H 1 |
85 |
|
86 |
+#ifndef __FreeBSD__ |
87 |
#include <features.h> |
88 |
+#endif |
89 |
|
90 |
#define __need_size_t |
91 |
#include <stddef.h> |
92 |
@@ -49,10 +51,18 @@ |
93 |
#endif |
94 |
|
95 |
|
96 |
+#ifdef __FreeBSD__ |
97 |
+#define __PMT __P |
98 |
+#endif |
99 |
+ |
100 |
/* For use with hsearch(3). */ |
101 |
#ifndef __COMPAR_FN_T |
102 |
# define __COMPAR_FN_T |
103 |
+#ifdef __FreeBSD__ |
104 |
+typedef int (*__compar_fn_t) __PMT ((__const void *, __const void *)); |
105 |
+#else |
106 |
typedef int (*__compar_fn_t) __PMT ((__const __ptr_t, __const __ptr_t)); |
107 |
+#endif |
108 |
|
109 |
# ifdef __USE_GNU |
110 |
typedef __compar_fn_t comparison_fn_t; |
111 |
--- include/sound/asound.h.orig 2009-09-09 20:34:54.000000000 +0800 |
112 |
+++ include/sound/asound.h 2009-09-15 00:44:37.000000000 +0800 |
113 |
@@ -23,9 +23,42 @@ |
114 |
#ifndef _UAPI__SOUND_ASOUND_H |
115 |
#define _UAPI__SOUND_ASOUND_H |
116 |
|
117 |
+#ifdef __linux__ |
118 |
#include <linux/types.h> |
119 |
+#else |
120 |
+#define __bitwise |
121 |
+typedef uint32_t __u32; |
122 |
+typedef int __kernel_pid_t; |
123 |
+#endif |
124 |
+ |
125 |
|
126 |
+#ifdef __FreeBSD__ |
127 |
+#define ESTRPIPE 0x7a69 /* Linux PCM suspend errno, fehh?! */ |
128 |
+#define EBADFD EBADF |
129 |
+ |
130 |
+typedef uint64_t __u64; |
131 |
+ |
132 |
+#define bswap_16(x) bswap16(x) |
133 |
+#define bswap_32(x) bswap32(x) |
134 |
+#define bswap_64(x) bswap64(x) |
135 |
+ |
136 |
+#if __BYTE_ORDER == __LITTLE_ENDIAN |
137 |
+#define __cpu_to_le32(x) (x) |
138 |
+#define __cpu_to_be32(x) bswap_32(x) |
139 |
+#define __cpu_to_le16(x) (x) |
140 |
+#define __cpu_to_be16(x) bswap_16(x) |
141 |
+#else |
142 |
+#define __cpu_to_le32(x) bswap_32(x) |
143 |
+#define __cpu_to_be32(x) (x) |
144 |
+#define __cpu_to_le16(x) bswap_16(x) |
145 |
+#define __cpu_to_be16(x) (x) |
146 |
+#endif |
147 |
|
148 |
+#define __le32_to_cpu __cpu_to_le32 |
149 |
+#define __be32_to_cpu __cpu_to_be32 |
150 |
+#define __le16_to_cpu __cpu_to_le16 |
151 |
+#define __be16_to_cpu __cpu_to_be16 |
152 |
+#endif |
153 |
/* |
154 |
* protocol version |
155 |
*/ |
156 |
--- include/sound/type_compat.h.orig 2009-09-09 20:34:54.000000000 +0800 |
157 |
+++ include/sound/type_compat.h 2009-09-15 00:36:14.000000000 +0800 |
158 |
@@ -10,8 +10,15 @@ |
159 |
typedef int16_t __s16; |
160 |
typedef int32_t __s32; |
161 |
|
162 |
+#ifdef __FreeBSD__ |
163 |
+#include <sys/endian.h> |
164 |
+#define bswap_16(x) bswap16(x) |
165 |
+#define bswap_32(x) bswap32(x) |
166 |
+#define bswap_64(x) bswap64(x) |
167 |
+#else |
168 |
#include <endian.h> |
169 |
#include <byteswap.h> |
170 |
+#endif |
171 |
#if __BYTE_ORDER == __LITTLE_ENDIAN |
172 |
#define __cpu_to_le32(x) (x) |
173 |
#define __cpu_to_be32(x) bswap_32(x) |
174 |
$NetBSD: patch-bk,v 1.1 2008/12/25 13:18:00 hasso Exp $ |
175 |
|
176 |
--- src/async.c.orig 2008-12-25 08:18:22 +0200 |
177 |
+++ src/async.c 2008-12-25 08:20:39 +0200 |
178 |
@@ -51,6 +51,15 @@ static LIST_HEAD(snd_async_handlers); |
179 |
|
180 |
static void snd_async_handler(int signo ATTRIBUTE_UNUSED, siginfo_t *siginfo, void *context ATTRIBUTE_UNUSED) |
181 |
{ |
182 |
+#if defined(__DragonFly__) || defined(__FreeBSD__) |
183 |
+ /* XXX XXX XXX */ |
184 |
+ struct list_head *i; |
185 |
+ list_for_each(i, &snd_async_handlers) { |
186 |
+ snd_async_handler_t *h = list_entry(i, snd_async_handler_t, glist); |
187 |
+ if (h->callback) |
188 |
+ h->callback(h); |
189 |
+ } |
190 |
+#else |
191 |
int fd; |
192 |
struct list_head *i; |
193 |
//assert(siginfo->si_code == SI_SIGIO); |
194 |
@@ -60,6 +61,7 @@ |
195 |
if (h->fd == fd && h->callback) |
196 |
h->callback(h); |
197 |
} |
198 |
+#endif |
199 |
} |
200 |
|
201 |
/** |
202 |
--- src/compat/hsearch_r.c.orig 2009-09-09 20:34:54.000000000 +0800 |
203 |
+++ src/compat/hsearch_r.c 2009-09-15 00:22:11.000000000 +0800 |
204 |
@@ -18,7 +18,11 @@ |
205 |
Boston, MA 02111-1307, USA. */ |
206 |
|
207 |
#include <errno.h> |
208 |
+#ifdef __GLIBC__ |
209 |
#include <malloc.h> |
210 |
+#else |
211 |
+#include <stdlib.h> |
212 |
+#endif |
213 |
#include <string.h> |
214 |
|
215 |
#define __USE_GNU |
216 |
--- src/conf.c.orig |
217 |
+++ src/conf.c |
218 |
@@ -428,7 +428,11 @@ beginning:</P> |
219 |
|
220 |
#ifdef HAVE_LIBPTHREAD |
221 |
static pthread_mutex_t snd_config_update_mutex = |
222 |
+#ifdef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP |
223 |
PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; |
224 |
+#else |
225 |
+ PTHREAD_MUTEX_INITIALIZER; |
226 |
+#endif |
227 |
#endif |
228 |
|
229 |
struct _snd_config { |
230 |
--- src/pcm/pcm.c.orig 2009-09-09 20:34:54.000000000 +0800 |
231 |
+++ src/pcm/pcm.c 2009-09-15 00:19:09.000000000 +0800 |
232 |
@@ -630,7 +630,9 @@ |
233 |
|
234 |
#include <stdio.h> |
235 |
#include <string.h> |
236 |
+#ifndef __FreeBSD__ |
237 |
#include <malloc.h> |
238 |
+#endif |
239 |
#include <stdarg.h> |
240 |
#include <signal.h> |
241 |
#include <sys/poll.h> |
242 |
--- src/pcm/pcm_adpcm.c.orig 2009-09-09 20:34:54.000000000 +0800 |
243 |
+++ src/pcm/pcm_adpcm.c 2009-09-15 00:19:14.000000000 +0800 |
244 |
@@ -56,7 +56,9 @@ |
245 |
come across a good description of XA yet. |
246 |
*/ |
247 |
|
248 |
+#ifndef __FreeBSD__ |
249 |
#include <byteswap.h> |
250 |
+#endif |
251 |
#include "pcm_local.h" |
252 |
#include "pcm_plugin.h" |
253 |
|
254 |
--- src/pcm/pcm_alaw.c.orig 2009-09-09 20:34:54.000000000 +0800 |
255 |
+++ src/pcm/pcm_alaw.c 2009-09-15 00:19:19.000000000 +0800 |
256 |
@@ -26,7 +26,9 @@ |
257 |
* |
258 |
*/ |
259 |
|
260 |
+#ifndef __FreeBSD__ |
261 |
#include <byteswap.h> |
262 |
+#endif |
263 |
#include "pcm_local.h" |
264 |
#include "pcm_plugin.h" |
265 |
|
266 |
--- src/pcm/pcm_copy.c.orig 2009-09-09 20:34:54.000000000 +0800 |
267 |
+++ src/pcm/pcm_copy.c 2009-09-15 00:21:29.000000000 +0800 |
268 |
@@ -26,7 +26,9 @@ |
269 |
* |
270 |
*/ |
271 |
|
272 |
+#ifndef __FreeBSD__ |
273 |
#include <byteswap.h> |
274 |
+#endif |
275 |
#include "pcm_local.h" |
276 |
#include "pcm_plugin.h" |
277 |
|
278 |
--- src/pcm/pcm_direct.c.orig 2009-09-09 20:34:54.000000000 +0800 |
279 |
+++ src/pcm/pcm_direct.c 2009-09-15 00:45:34.000000000 +0800 |
280 |
@@ -44,12 +44,14 @@ |
281 |
* |
282 |
*/ |
283 |
|
284 |
+#ifndef __FreeBSD__ |
285 |
union semun { |
286 |
int val; /* Value for SETVAL */ |
287 |
struct semid_ds *buf; /* Buffer for IPC_STAT, IPC_SET */ |
288 |
unsigned short *array; /* Array for GETALL, SETALL */ |
289 |
struct seminfo *__buf; /* Buffer for IPC_INFO (Linux specific) */ |
290 |
}; |
291 |
+#endif |
292 |
|
293 |
/* |
294 |
* FIXME: |
295 |
--- src/pcm/pcm_dmix_generic.c.orig 2009-09-09 20:34:54.000000000 +0800 |
296 |
+++ src/pcm/pcm_dmix_generic.c 2009-09-15 00:18:52.000000000 +0800 |
297 |
@@ -125,7 +125,9 @@ |
298 |
(1ULL << SND_PCM_FORMAT_S24_3LE) | \ |
299 |
(1ULL << SND_PCM_FORMAT_U8)) |
300 |
|
301 |
+#ifndef __FreeBSD__ |
302 |
#include <byteswap.h> |
303 |
+#endif |
304 |
|
305 |
static void generic_mix_areas_16_native(unsigned int size, |
306 |
volatile signed short *dst, |
307 |
--- src/pcm/pcm_file.c.orig 2009-09-09 20:34:54.000000000 +0800 |
308 |
+++ src/pcm/pcm_file.c 2009-09-15 00:21:10.000000000 +0800 |
309 |
@@ -26,8 +26,12 @@ |
310 |
* |
311 |
*/ |
312 |
|
313 |
+#ifdef __FreeBSD__ |
314 |
+#include <sys/endian.h> |
315 |
+#else |
316 |
#include <endian.h> |
317 |
#include <byteswap.h> |
318 |
+#endif |
319 |
#include <ctype.h> |
320 |
#include <string.h> |
321 |
#include "pcm_local.h" |
322 |
--- src/pcm/pcm_iec958.c.orig 2009-09-09 20:34:54.000000000 +0800 |
323 |
+++ src/pcm/pcm_iec958.c 2009-09-15 00:19:44.000000000 +0800 |
324 |
@@ -26,7 +26,9 @@ |
325 |
* |
326 |
*/ |
327 |
|
328 |
+#ifndef __FreeBSD__ |
329 |
#include <byteswap.h> |
330 |
+#endif |
331 |
#include "pcm_local.h" |
332 |
#include "pcm_plugin.h" |
333 |
|
334 |
--- src/pcm/pcm_lfloat.c.orig 2009-09-09 20:34:54.000000000 +0800 |
335 |
+++ src/pcm/pcm_lfloat.c 2009-09-15 00:21:48.000000000 +0800 |
336 |
@@ -26,7 +26,9 @@ |
337 |
* |
338 |
*/ |
339 |
|
340 |
+#ifndef __FreeBSD__ |
341 |
#include <byteswap.h> |
342 |
+#endif |
343 |
#include "pcm_local.h" |
344 |
#include "pcm_plugin.h" |
345 |
|
346 |
--- src/pcm/pcm_linear.c.orig 2009-09-09 20:34:54.000000000 +0800 |
347 |
+++ src/pcm/pcm_linear.c 2009-09-15 00:21:37.000000000 +0800 |
348 |
@@ -26,7 +26,9 @@ |
349 |
* |
350 |
*/ |
351 |
|
352 |
+#ifndef __FreeBSD__ |
353 |
#include <byteswap.h> |
354 |
+#endif |
355 |
#include "pcm_local.h" |
356 |
#include "pcm_plugin.h" |
357 |
|
358 |
--- src/pcm/pcm_meter.c.orig 2009-09-09 20:34:54.000000000 +0800 |
359 |
+++ src/pcm/pcm_meter.c 2009-09-15 00:18:38.000000000 +0800 |
360 |
@@ -27,7 +27,9 @@ |
361 |
*/ |
362 |
|
363 |
|
364 |
+#ifndef __FreeBSD__ |
365 |
#include <byteswap.h> |
366 |
+#endif |
367 |
#include <time.h> |
368 |
#include <pthread.h> |
369 |
#include <dlfcn.h> |
370 |
--- src/pcm/pcm_misc.c.orig 2009-09-09 20:34:54.000000000 +0800 |
371 |
+++ src/pcm/pcm_misc.c 2009-09-15 00:18:31.000000000 +0800 |
372 |
@@ -23,7 +23,9 @@ |
373 |
#include <stdlib.h> |
374 |
#include <unistd.h> |
375 |
#include <string.h> |
376 |
+#ifndef __FreeBSD__ |
377 |
#include <byteswap.h> |
378 |
+#endif |
379 |
#include "pcm_local.h" |
380 |
|
381 |
|
382 |
--- src/pcm/pcm_mmap.c.orig 2009-09-09 20:34:54.000000000 +0800 |
383 |
+++ src/pcm/pcm_mmap.c 2009-09-15 00:17:43.000000000 +0800 |
384 |
@@ -19,7 +19,9 @@ |
385 |
*/ |
386 |
|
387 |
#include <stdio.h> |
388 |
+#ifndef __FreeBSD__ |
389 |
#include <malloc.h> |
390 |
+#endif |
391 |
#include <string.h> |
392 |
#include <sys/poll.h> |
393 |
#include <sys/mman.h> |
394 |
--- src/pcm/pcm_mulaw.c.orig 2009-09-09 20:34:54.000000000 +0800 |
395 |
+++ src/pcm/pcm_mulaw.c 2009-09-15 00:21:21.000000000 +0800 |
396 |
@@ -26,7 +26,9 @@ |
397 |
* |
398 |
*/ |
399 |
|
400 |
+#ifndef __FreeBSD__ |
401 |
#include <byteswap.h> |
402 |
+#endif |
403 |
#include "pcm_local.h" |
404 |
#include "pcm_plugin.h" |
405 |
|
406 |
--- src/pcm/pcm_null.c.orig 2009-09-09 20:34:54.000000000 +0800 |
407 |
+++ src/pcm/pcm_null.c 2009-09-15 00:19:32.000000000 +0800 |
408 |
@@ -26,7 +26,9 @@ |
409 |
* |
410 |
*/ |
411 |
|
412 |
+#ifndef __FreeBSD__ |
413 |
#include <byteswap.h> |
414 |
+#endif |
415 |
#include <limits.h> |
416 |
#include <sys/shm.h> |
417 |
#include "pcm_local.h" |
418 |
--- src/pcm/pcm_rate.c.orig 2009-09-09 20:34:54.000000000 +0800 |
419 |
+++ src/pcm/pcm_rate.c 2009-09-15 00:21:43.000000000 +0800 |
420 |
@@ -28,7 +28,9 @@ |
421 |
* |
422 |
*/ |
423 |
#include <inttypes.h> |
424 |
+#ifndef __FreeBSD__ |
425 |
#include <byteswap.h> |
426 |
+#endif |
427 |
#include "pcm_local.h" |
428 |
#include "pcm_plugin.h" |
429 |
#include "pcm_rate.h" |
430 |
--- src/pcm/pcm_rate_linear.c.orig 2009-09-09 20:34:54.000000000 +0800 |
431 |
+++ src/pcm/pcm_rate_linear.c 2009-09-15 00:19:26.000000000 +0800 |
432 |
@@ -21,7 +21,9 @@ |
433 |
*/ |
434 |
|
435 |
#include <inttypes.h> |
436 |
+#ifndef __FreeBSD__ |
437 |
#include <byteswap.h> |
438 |
+#endif |
439 |
#include "pcm_local.h" |
440 |
#include "pcm_plugin.h" |
441 |
#include "pcm_rate.h" |
442 |
--- src/pcm/pcm_route.c.orig 2009-09-09 20:34:54.000000000 +0800 |
443 |
+++ src/pcm/pcm_route.c 2009-09-15 00:19:38.000000000 +0800 |
444 |
@@ -26,7 +26,9 @@ |
445 |
* |
446 |
*/ |
447 |
|
448 |
+#ifndef __FreeBSD__ |
449 |
#include <byteswap.h> |
450 |
+#endif |
451 |
#include <math.h> |
452 |
#include "pcm_local.h" |
453 |
#include "pcm_plugin.h" |
454 |
--- src/pcm/pcm_softvol.c.orig 2009-09-09 20:34:54.000000000 +0800 |
455 |
+++ src/pcm/pcm_softvol.c 2009-09-15 00:19:02.000000000 +0800 |
456 |
@@ -26,7 +26,9 @@ |
457 |
* |
458 |
*/ |
459 |
|
460 |
+#ifndef __FreeBSD__ |
461 |
#include <byteswap.h> |
462 |
+#endif |
463 |
#include <math.h> |
464 |
#include "pcm_local.h" |
465 |
#include "pcm_plugin.h" |
466 |
--- src/seq/seq_midi_event.c.orig 2009-09-09 20:34:54.000000000 +0800 |
467 |
+++ src/seq/seq_midi_event.c 2009-09-15 00:21:55.000000000 +0800 |
468 |
@@ -28,7 +28,9 @@ |
469 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
470 |
*/ |
471 |
|
472 |
+#ifndef __FreeBSD__ |
473 |
#include <malloc.h> |
474 |
+#endif |
475 |
#include "local.h" |
476 |
|
477 |
#ifndef DOC_HIDDEN |
478 |
--- src/shmarea.c.orig 2009-09-09 20:34:54.000000000 +0800 |
479 |
+++ src/shmarea.c 2009-09-15 00:22:00.000000000 +0800 |
480 |
@@ -19,7 +19,11 @@ |
481 |
*/ |
482 |
|
483 |
#include <stdio.h> |
484 |
+#ifdef __GLIBC__ |
485 |
#include <malloc.h> |
486 |
+#else |
487 |
+#include <stdlib.h> |
488 |
+#endif |
489 |
#include <string.h> |
490 |
#include <errno.h> |
491 |
#include <sys/poll.h> |
492 |
--- src/userfile.c.orig 2009-09-09 20:34:54.000000000 +0800 |
493 |
+++ src/userfile.c 2009-09-18 00:57:22.000000000 +0800 |
494 |
@@ -19,9 +19,47 @@ |
495 |
*/ |
496 |
|
497 |
#include <config.h> |
498 |
+#ifdef __FreeBSD__ |
499 |
+#include <stdlib.h> |
500 |
+#endif |
501 |
#include <string.h> |
502 |
#include <errno.h> |
503 |
|
504 |
+/* |
505 |
+ * XXX Something is definitely wrong, very very wrong, here or there. |
506 |
+ * Apparently mplayer (so far) is the only app that break, returning |
507 |
+ * WRDE_SYNTAX. For now, this simple home/path expansion should work. |
508 |
+ * I'll investigate this further in future. |
509 |
+ */ |
510 |
+#ifdef __FreeBSD__ |
511 |
+int snd_user_file(const char *file, char **result) |
512 |
+{ |
513 |
+ |
514 |
+ if (file == NULL) |
515 |
+ return -EINVAL; |
516 |
+ |
517 |
+ if (strlen(file) > 2 && strncmp(file, "~/", 2) == 0) { |
518 |
+ char *homedir, *path; |
519 |
+ |
520 |
+ homedir = getenv("HOME"); |
521 |
+ if (homedir == NULL) |
522 |
+ return -EINVAL; |
523 |
+ |
524 |
+ /* offset -1 by removing '~' */ |
525 |
+ path = malloc(strlen(homedir) + strlen(file)); |
526 |
+ if (path == NULL) |
527 |
+ return -ENOMEM; |
528 |
+ |
529 |
+ strcpy(path, homedir); /* copy home directory */ |
530 |
+ strcat(path, file + 1); /* discard '~', start with '/' */ |
531 |
+ |
532 |
+ *result = path; |
533 |
+ } else |
534 |
+ *result = strdup(file); |
535 |
+ |
536 |
+ return 0; |
537 |
+} |
538 |
+#else |
539 |
/** |
540 |
* \brief Get the full file name |
541 |
* \param file The file name string to parse |
542 |
@@ -70,3 +108,4 @@ |
543 |
return 0; |
544 |
} |
545 |
#endif /* HAVE_WORDEXP_H */ |
546 |
+#endif /* __FreeBSD__ */ |
547 |
--- src/timer/timer_hw.c.orig 2009-09-09 20:34:54.000000000 +0800 |
548 |
+++ src/timer/timer_hw.c 2009-09-15 00:46:06.000000000 +0800 |
549 |
@@ -92,10 +92,12 @@ |
550 |
} |
551 |
if (sig < 0) |
552 |
return 0; |
553 |
+#ifndef __FreeBSD__ |
554 |
if (fcntl(fd, F_SETSIG, (long)sig) < 0) { |
555 |
SYSERR("F_SETSIG failed"); |
556 |
return -errno; |
557 |
} |
558 |
+#endif |
559 |
if (fcntl(fd, F_SETOWN, (long)pid) < 0) { |
560 |
SYSERR("F_SETOWN failed"); |
561 |
return -errno; |