0,0 → 1,92 |
Description: Fixes to make Pike build on GNU/Hurd |
1. Let realpath() allocate memory itself. |
2. Include mach/message.h directly where mach_msg_type_number_t is used. |
3. Don't build shared objects any differently than on Linux. |
Forwarded: yes |
|
--- a/src/modules/system/system.c |
+++ b/src/modules/system/system.c |
@@ -411,6 +411,13 @@ void f_resolvepath(INT32 args) |
#endif /* ENAMETOOLONG */ |
(len >= buflen - 1)); |
#elif defined(HAVE_REALPATH) |
+#ifdef __GNU__ |
+ if ((buf = realpath(path, NULL))) { |
+ len = strlen(buf); |
+ } else if (errno == ENOMEM) { |
+ Pike_error("resolvepath(): Out of memory\n"); |
+ } |
+#else |
buflen = PATH_MAX+1; |
|
if (!(buf = alloca(buflen))) { |
@@ -420,6 +427,7 @@ void f_resolvepath(INT32 args) |
if ((buf = realpath(path, buf))) { |
len = strlen(buf); |
} |
+#endif |
#else /* !HAVE_RESOLVEPATH && !HAVE_REALPATH */ |
#error "f_resolvepath with neither resolvepath nor realpath." |
#endif /* HAVE_RESOLVEPATH */ |
@@ -429,6 +437,9 @@ void f_resolvepath(INT32 args) |
} |
pop_n_elems(args); |
push_string(make_shared_binary_string(buf, len)); |
+#ifdef __GNU__ |
+ free(buf); |
+#endif |
} |
#endif /* HAVE_RESOLVEPATH || HAVE_REALPATH */ |
|
--- a/src/pike_threadlib.h |
+++ b/src/pike_threadlib.h |
@@ -94,6 +94,9 @@ PMOD_EXPORT extern struct program *threa |
#ifdef HAVE_MACH_TASK_INFO_H |
#include <mach/task_info.h> |
#endif |
+#ifdef HAVE_MACH_MESSAGE_H |
+#include <mach/message.h> |
+#endif |
#ifdef HAVE_MACH_TASK_H |
#include <mach/task.h> |
#endif |
--- a/src/configure.in |
+++ b/src/configure.in |
@@ -3276,7 +3276,7 @@ AC_CHECK_HEADERS(winsock2.h sys/rusage.h |
float.h sys/priocntl.h sys/sched.h winbase.h errno.h \ |
stddef.h mmx.h asm/mmx.h sys/termio.h sys/termios.h \ |
ws2tcpip.h valgrind/memcheck.h memcheck.h valgrind.h \ |
- sys/prctl.h sys/ioctl.h mach/task_info.h mach/task.h \ |
+ sys/prctl.h sys/ioctl.h mach/message.h mach/task_info.h mach/task.h \ |
mach/mach_init.h syscall.h sys/syscall.h devices/timer.h \ |
direct.h CoreServices/CoreServices.h execinfo.h \ |
mach/mach.h mach/thread_act.h mach/clock.h,,,[ |
@@ -7893,7 +7893,7 @@ if test -z "$LDSHARED" ; then |
next*) LDSHARED="$REALCC $CFLAGS -nostdlib -r";; |
Linux*) LDSHARED="$REALCC -shared";; |
GNU/kFreeBSD*) LDSHARED="$REALCC -shared";; |
- GNU*) LDSHARED="$REALCC -Wl,-Bshareable";; |
+ GNU*) LDSHARED="$REALCC -shared";; |
FreeBSD*) LDSHARED="$REALCC -Wl,-Bshareable";; |
NetBSD*) LDSHARED="$REALCC -Wl,-Bshareable";; |
OpenBSD*) LDSHARED="$REALCC -Wl,-Bshareable";; |
--- a/src/configure |
+++ b/src/configure |
@@ -81886,7 +81886,7 @@ done |
float.h sys/priocntl.h sys/sched.h winbase.h errno.h \ |
stddef.h mmx.h asm/mmx.h sys/termio.h sys/termios.h \ |
ws2tcpip.h valgrind/memcheck.h memcheck.h valgrind.h \ |
- sys/prctl.h sys/ioctl.h mach/task_info.h mach/task.h \ |
+ sys/prctl.h sys/ioctl.h mach/message.h mach/task_info.h mach/task.h \ |
mach/mach_init.h syscall.h sys/syscall.h devices/timer.h \ |
direct.h CoreServices/CoreServices.h execinfo.h \ |
mach/mach.h mach/thread_act.h mach/clock.h |
@@ -104588,7 +104588,7 @@ if test -z "$LDSHARED" ; then |
next*) LDSHARED="$REALCC $CFLAGS -nostdlib -r";; |
Linux*) LDSHARED="$REALCC -shared";; |
GNU/kFreeBSD*) LDSHARED="$REALCC -shared";; |
- GNU*) LDSHARED="$REALCC -Wl,-Bshareable";; |
+ GNU*) LDSHARED="$REALCC -shared";; |
FreeBSD*) LDSHARED="$REALCC -Wl,-Bshareable";; |
NetBSD*) LDSHARED="$REALCC -Wl,-Bshareable";; |
OpenBSD*) LDSHARED="$REALCC -Wl,-Bshareable";; |