Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Rev 170 | Rev 211 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

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
@@ -3308,7 +3308,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,,,[
@@ -7933,7 +7933,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
@@ -79597,7 +79597,7 @@ for ac_header in 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
@@ -79746,7 +79746,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
@@ -104594,7 +104594,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/machine.h.in
+++ b/src/machine.h.in
@@ -875,6 +875,9 @@
 /* Define to 1 if you have the <mach/mach_init.h> header file. */
 #undef HAVE_MACH_MACH_INIT_H
 
+/* Define to 1 if you have the <mach/message.h> header file. */
+#undef HAVE_MACH_MESSAGE_H
+
 /* Define to 1 if you have the <mach-o/dyld.h> header file. */
 #undef HAVE_MACH_O_DYLD_H