Rev 181 | 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 |
||
| 9 | @@ -411,6 +411,13 @@ void f_resolvepath(INT32 args) |
||
| 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))) { |
||
| 23 | @@ -420,6 +427,7 @@ void f_resolvepath(INT32 args) |
||
| 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 */ |
||
| 31 | @@ -429,6 +437,9 @@ void f_resolvepath(INT32 args) |
||
| 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 |
||
| 43 | @@ -94,6 +94,9 @@ PMOD_EXPORT extern struct program *threa |
||
| 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 |
||
| 55 | @@ -3276,7 +3276,7 @@ AC_CHECK_HEADERS(winsock2.h sys/rusage.h |
||
| 56 | float.h sys/priocntl.h sys/sched.h winbase.h errno.h \ |
||
| 57 | stddef.h mmx.h asm/mmx.h sys/termio.h sys/termios.h \ |
||
| 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 \ |
||
| 63 | mach/mach.h mach/thread_act.h mach/clock.h,,,[ |
||
| 64 | @@ -7893,7 +7893,7 @@ if test -z "$LDSHARED" ; then |
||
| 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 |
||
| 168 | holmgren | 75 | @@ -81740,7 +81740,7 @@ for ac_header in winsock2.h sys/rusage.h |
| 76 | float.h sys/priocntl.h sys/sched.h winbase.h errno.h \ |
||
| 77 | stddef.h mmx.h asm/mmx.h sys/termio.h sys/termios.h \ |
||
| 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 \ |
||
| 83 | mach/mach.h mach/thread_act.h mach/clock.h |
||
| 166 | holmgren | 84 | @@ -81886,7 +81886,7 @@ done |
| 85 | float.h sys/priocntl.h sys/sched.h winbase.h errno.h \ |
||
| 86 | stddef.h mmx.h asm/mmx.h sys/termio.h sys/termios.h \ |
||
| 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 \ |
||
| 92 | mach/mach.h mach/thread_act.h mach/clock.h |
||
| 93 | @@ -104588,7 +104588,7 @@ if test -z "$LDSHARED" ; then |
||
| 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 |
||
| 104 | @@ -875,6 +875,9 @@ |
||
| 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 |