Fix build on FreeBSD
This commit is contained in:
parent
766b06dfa3
commit
cbb38331dd
10
addr2line.c
10
addr2line.c
@ -2504,7 +2504,7 @@ fail:
|
|||||||
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
#if defined(__FreeBSD__) || defined(__DragonFly__)
|
||||||
# include <sys/sysctl.h>
|
# include <sys/sysctl.h>
|
||||||
#endif
|
#endif
|
||||||
/* ssize_t main_exe_path(void)
|
/* ssize_t main_exe_path(FILE *errout)
|
||||||
*
|
*
|
||||||
* store the path of the main executable to `binary_filename`,
|
* store the path of the main executable to `binary_filename`,
|
||||||
* and returns strlen(binary_filename).
|
* and returns strlen(binary_filename).
|
||||||
@ -2512,7 +2512,7 @@ fail:
|
|||||||
*/
|
*/
|
||||||
#if defined(__linux__) || defined(__NetBSD__)
|
#if defined(__linux__) || defined(__NetBSD__)
|
||||||
static ssize_t
|
static ssize_t
|
||||||
main_exe_path(void)
|
main_exe_path(FILE *errout)
|
||||||
{
|
{
|
||||||
# if defined(__linux__)
|
# if defined(__linux__)
|
||||||
# define PROC_SELF_EXE "/proc/self/exe"
|
# define PROC_SELF_EXE "/proc/self/exe"
|
||||||
@ -2526,7 +2526,7 @@ main_exe_path(void)
|
|||||||
}
|
}
|
||||||
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
#elif defined(__FreeBSD__) || defined(__DragonFly__)
|
||||||
static ssize_t
|
static ssize_t
|
||||||
main_exe_path(void)
|
main_exe_path(FILE *errout)
|
||||||
{
|
{
|
||||||
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
|
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
|
||||||
size_t len = PATH_MAX;
|
size_t len = PATH_MAX;
|
||||||
@ -2540,7 +2540,7 @@ main_exe_path(void)
|
|||||||
}
|
}
|
||||||
#elif defined(HAVE_LIBPROC_H)
|
#elif defined(HAVE_LIBPROC_H)
|
||||||
static ssize_t
|
static ssize_t
|
||||||
main_exe_path(void)
|
main_exe_path(FILE *errout)
|
||||||
{
|
{
|
||||||
int len = proc_pidpath(getpid(), binary_filename, PATH_MAX);
|
int len = proc_pidpath(getpid(), binary_filename, PATH_MAX);
|
||||||
if (len == 0) return 0;
|
if (len == 0) return 0;
|
||||||
@ -2614,7 +2614,7 @@ rb_dump_backtrace_with_lines(int num_traces, void **traces, FILE *errout)
|
|||||||
#ifdef HAVE_MAIN_EXE_PATH
|
#ifdef HAVE_MAIN_EXE_PATH
|
||||||
char *main_path = NULL; /* used on printing backtrace */
|
char *main_path = NULL; /* used on printing backtrace */
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
if ((len = main_exe_path()) > 0) {
|
if ((len = main_exe_path(errout)) > 0) {
|
||||||
main_path = (char *)alloca(len + 1);
|
main_path = (char *)alloca(len + 1);
|
||||||
if (main_path) {
|
if (main_path) {
|
||||||
uintptr_t addr;
|
uintptr_t addr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user