Rev 198 | Rev 238 | 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 |
||
211 | holmgren | 55 | @@ -3246,7 +3246,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 \ |
||
198 | holmgren | 63 | mach/mach.h mach/thread_act.h mach/clock.h urcu.h,,,[ |
211 | holmgren | 64 | @@ -7561,7 +7561,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";; |
||
73 | --- a/src/configure |
||
74 | +++ b/src/configure |
||
211 | holmgren | 75 | @@ -64931,7 +64931,7 @@ fi |
168 | holmgren | 76 | float.h sys/priocntl.h sys/sched.h winbase.h errno.h \ |
211 | holmgren | 77 | stddef.h sys/termio.h sys/termios.h \ |
168 | holmgren | 78 | ws2tcpip.h valgrind/memcheck.h memcheck.h valgrind.h \ |
79 | - sys/prctl.h sys/ioctl.h mach/task_info.h mach/task.h \ |
||
80 | + sys/prctl.h sys/ioctl.h mach/message.h mach/task_info.h mach/task.h \ |
||
81 | mach/mach_init.h syscall.h sys/syscall.h devices/timer.h \ |
||
82 | direct.h CoreServices/CoreServices.h execinfo.h \ |
||
198 | holmgren | 83 | mach/mach.h mach/thread_act.h mach/clock.h urcu.h |
211 | holmgren | 84 | @@ -65034,7 +65034,7 @@ done |
166 | holmgren | 85 | float.h sys/priocntl.h sys/sched.h winbase.h errno.h \ |
211 | holmgren | 86 | stddef.h sys/termio.h sys/termios.h \ |
166 | holmgren | 87 | ws2tcpip.h valgrind/memcheck.h memcheck.h valgrind.h \ |
88 | - sys/prctl.h sys/ioctl.h mach/task_info.h mach/task.h \ |
||
89 | + sys/prctl.h sys/ioctl.h mach/message.h mach/task_info.h mach/task.h \ |
||
90 | mach/mach_init.h syscall.h sys/syscall.h devices/timer.h \ |
||
91 | direct.h CoreServices/CoreServices.h execinfo.h \ |
||
198 | holmgren | 92 | mach/mach.h mach/thread_act.h mach/clock.h urcu.h |
211 | holmgren | 93 | @@ -77631,7 +77631,7 @@ if test -z "$LDSHARED" ; then |
166 | holmgren | 94 | next*) LDSHARED="$REALCC $CFLAGS -nostdlib -r";; |
95 | Linux*) LDSHARED="$REALCC -shared";; |
||
96 | GNU/kFreeBSD*) LDSHARED="$REALCC -shared";; |
||
97 | - GNU*) LDSHARED="$REALCC -Wl,-Bshareable";; |
||
98 | + GNU*) LDSHARED="$REALCC -shared";; |
||
99 | FreeBSD*) LDSHARED="$REALCC -Wl,-Bshareable";; |
||
100 | NetBSD*) LDSHARED="$REALCC -Wl,-Bshareable";; |
||
101 | OpenBSD*) LDSHARED="$REALCC -Wl,-Bshareable";; |
||
170 | holmgren | 102 | --- a/src/machine.h.in |
103 | +++ b/src/machine.h.in |
||
211 | holmgren | 104 | @@ -894,6 +894,9 @@ |
170 | holmgren | 105 | /* Define to 1 if you have the <mach/mach_init.h> header file. */ |
106 | #undef HAVE_MACH_MACH_INIT_H |
||
107 | |||
108 | +/* Define to 1 if you have the <mach/message.h> header file. */ |
||
109 | +#undef HAVE_MACH_MESSAGE_H |
||
110 | + |
||
111 | /* Define to 1 if you have the <mach-o/dyld.h> header file. */ |
||
112 | #undef HAVE_MACH_O_DYLD_H |
||
113 |