Rev 275 | Rev 300 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
166 | holmgren | 1 | Description: Fixes to make Pike build on GNU/Hurd |
2 | 1. Let realpath() allocate memory itself. |
||
3 | 2. Include mach/message.h directly where mach_msg_type_number_t is used. |
||
4 | 3. Don't build shared objects any differently than on Linux. |
||
5 | Forwarded: yes |
||
6 | |||
7 | --- a/src/modules/system/system.c |
||
8 | +++ b/src/modules/system/system.c |
||
198 | holmgren | 9 | @@ -412,6 +412,13 @@ void f_resolvepath(INT32 args) |
166 | holmgren | 10 | #endif /* ENAMETOOLONG */ |
11 | (len >= buflen - 1)); |
||
12 | #elif defined(HAVE_REALPATH) |
||
13 | +#ifdef __GNU__ |
||
14 | + if ((buf = realpath(path, NULL))) { |
||
15 | + len = strlen(buf); |
||
16 | + } else if (errno == ENOMEM) { |
||
17 | + Pike_error("resolvepath(): Out of memory\n"); |
||
18 | + } |
||
19 | +#else |
||
20 | buflen = PATH_MAX+1; |
||
21 | |||
22 | if (!(buf = alloca(buflen))) { |
||
198 | holmgren | 23 | @@ -421,6 +428,7 @@ void f_resolvepath(INT32 args) |
166 | holmgren | 24 | if ((buf = realpath(path, buf))) { |
25 | len = strlen(buf); |
||
26 | } |
||
27 | +#endif |
||
28 | #else /* !HAVE_RESOLVEPATH && !HAVE_REALPATH */ |
||
29 | #error "f_resolvepath with neither resolvepath nor realpath." |
||
30 | #endif /* HAVE_RESOLVEPATH */ |
||
198 | holmgren | 31 | @@ -430,6 +438,9 @@ void f_resolvepath(INT32 args) |
166 | holmgren | 32 | } |
33 | pop_n_elems(args); |
||
34 | push_string(make_shared_binary_string(buf, len)); |
||
35 | +#ifdef __GNU__ |
||
36 | + free(buf); |
||
37 | +#endif |
||
38 | } |
||
39 | #endif /* HAVE_RESOLVEPATH || HAVE_REALPATH */ |
||
40 | |||
41 | --- a/src/pike_threadlib.h |
||
42 | +++ b/src/pike_threadlib.h |
||
198 | holmgren | 43 | @@ -88,6 +88,9 @@ |
166 | holmgren | 44 | #ifdef HAVE_MACH_TASK_INFO_H |
45 | #include <mach/task_info.h> |
||
46 | #endif |
||
47 | +#ifdef HAVE_MACH_MESSAGE_H |
||
48 | +#include <mach/message.h> |
||
49 | +#endif |
||
50 | #ifdef HAVE_MACH_TASK_H |
||
51 | #include <mach/task.h> |
||
52 | #endif |
||
53 | --- a/src/configure.in |
||
54 | +++ b/src/configure.in |
||
275 | holmgren | 55 | @@ -3233,7 +3233,7 @@ AC_CHECK_HEADERS(winsock2.h sys/rusage.h |
166 | holmgren | 56 | float.h sys/priocntl.h sys/sched.h winbase.h errno.h \ |
211 | holmgren | 57 | stddef.h sys/termio.h sys/termios.h \ |
166 | holmgren | 58 | ws2tcpip.h valgrind/memcheck.h memcheck.h valgrind.h \ |
59 | - sys/prctl.h sys/ioctl.h mach/task_info.h mach/task.h \ |
||
60 | + sys/prctl.h sys/ioctl.h mach/message.h mach/task_info.h mach/task.h \ |
||
61 | mach/mach_init.h syscall.h sys/syscall.h devices/timer.h \ |
||
62 | direct.h CoreServices/CoreServices.h execinfo.h \ |
||
278 | holmgren | 63 | mach/mach.h mach/thread_act.h mach/clock.h urcu.h \ |
64 | @@ -7582,7 +7582,7 @@ if test -z "$LDSHARED" ; then |
||
166 | holmgren | 65 | next*) LDSHARED="$REALCC $CFLAGS -nostdlib -r";; |
66 | Linux*) LDSHARED="$REALCC -shared";; |
||
67 | GNU/kFreeBSD*) LDSHARED="$REALCC -shared";; |
||
68 | - GNU*) LDSHARED="$REALCC -Wl,-Bshareable";; |
||
69 | + GNU*) LDSHARED="$REALCC -shared";; |
||
70 | FreeBSD*) LDSHARED="$REALCC -Wl,-Bshareable";; |
||
71 | NetBSD*) LDSHARED="$REALCC -Wl,-Bshareable";; |
||
72 | OpenBSD*) LDSHARED="$REALCC -Wl,-Bshareable";; |
||
170 | holmgren | 73 | --- a/src/machine.h.in |
74 | +++ b/src/machine.h.in |
||
278 | holmgren | 75 | @@ -912,6 +912,9 @@ |
170 | holmgren | 76 | /* Define to 1 if you have the <mach/mach_init.h> header file. */ |
77 | #undef HAVE_MACH_MACH_INIT_H |
||
78 | |||
79 | +/* Define to 1 if you have the <mach/message.h> header file. */ |
||
80 | +#undef HAVE_MACH_MESSAGE_H |
||
81 | + |
||
82 | /* Define to 1 if you have the <mach-o/dyld.h> header file. */ |
||
83 | #undef HAVE_MACH_O_DYLD_H |
||
84 |