summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Zander <riggs@FreeBSD.org>2017-09-10 16:49:46 +0000
committerThomas Zander <riggs@FreeBSD.org>2017-09-10 16:49:46 +0000
commitde97c5e9a7bb53f84a70c67aef753ed2668b475a (patch)
treea3508e70630c6e0b4343137cc233ef643b847877
parentbenchmarks/phoronix-test-suite: update to version 7.2.1 (diff)
Allow RUST_BACKTRACE to work without /proc mounted
Submitted by: jbeich Differential Revision: https://reviews.freebsd.org/D11574
Notes
Notes: svn path=/head/; revision=449581
-rw-r--r--lang/rust/Makefile1
-rw-r--r--lang/rust/files/patch-src_libbacktrace_fileline.c42
-rw-r--r--lang/rust/pkg-message12
3 files changed, 43 insertions, 12 deletions
diff --git a/lang/rust/Makefile b/lang/rust/Makefile
index bd01aad4503c..25f2a93356f1 100644
--- a/lang/rust/Makefile
+++ b/lang/rust/Makefile
@@ -3,6 +3,7 @@
PORTNAME= rust
PORTVERSION?= 1.19.0
+PORTREVISION?= 1
CATEGORIES= lang
MASTER_SITES= http://static.rust-lang.org/dist/:src \
https://static.rust-lang.org/dist/:rust_bootstrap \
diff --git a/lang/rust/files/patch-src_libbacktrace_fileline.c b/lang/rust/files/patch-src_libbacktrace_fileline.c
new file mode 100644
index 000000000000..88e16025ddfc
--- /dev/null
+++ b/lang/rust/files/patch-src_libbacktrace_fileline.c
@@ -0,0 +1,42 @@
+--- src/libbacktrace/fileline.c.orig 2017-06-06 00:42:59 UTC
++++ src/libbacktrace/fileline.c
+@@ -38,8 +38,39 @@ POSSIBILITY OF SUCH DAMAGE. */
+ #include <fcntl.h>
+ #include <stdlib.h>
+
++#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__)
++#include <sys/sysctl.h>
++#include <limits.h>
++#endif
++
+ #include "backtrace.h"
+ #include "internal.h"
++
++#if !defined(HAVE_GETEXECNAME) && defined(KERN_PROC_PATHNAME)
++/* Return pathname of executable or 0 on failure. */
++#define HAVE_GETEXECNAME
++static char execname[PATH_MAX + 1];
++static const char *
++getexecname(void)
++{
++ size_t path_len = sizeof(execname);
++ int mib[] = {
++ CTL_KERN,
++#if defined(__NetBSD__)
++ KERN_PROC_ARGS,
++ -1,
++ KERN_PROC_PATHNAME,
++#else
++ KERN_PROC,
++ KERN_PROC_PATHNAME,
++ -1,
++#endif
++ };
++ u_int miblen = sizeof(mib) / sizeof(mib[0]);
++ int rc = sysctl(mib, miblen, execname, &path_len, NULL, 0);
++ return rc ? NULL : execname;
++}
++#endif /* !HAVE_GETEXECNAME && KERN_PROC_PATHNAME */
+
+ #ifndef HAVE_GETEXECNAME
+ #define getexecname() NULL
diff --git a/lang/rust/pkg-message b/lang/rust/pkg-message
deleted file mode 100644
index 2c45f1375f0b..000000000000
--- a/lang/rust/pkg-message
+++ /dev/null
@@ -1,12 +0,0 @@
-======================================================================
-
-Printing Rust backtraces requires procfs(5) mounted on /proc .
-If you have not already done so, please do the following:
-
- mount -t procfs proc /proc
-
-To make it permanent, you need the following lines in /etc/fstab:
-
- proc /proc procfs rw 0 0
-
-======================================================================