mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 07:37:02 +02:00
MINOR: tools: add FreeBSD support to get_exec_path()
FreeBSD stores the absolute path into the auxiliary vector as well. The auxiliary vector is found in __elf_aux_vector there.
This commit is contained in:
parent
1e7bef17df
commit
c4e5232db8
14
src/tools.c
14
src/tools.c
@ -16,6 +16,12 @@
|
|||||||
#include <link.h>
|
#include <link.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__FreeBSD__)
|
||||||
|
#include <elf.h>
|
||||||
|
#include <dlfcn.h>
|
||||||
|
extern void *__elf_aux_vector;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__NetBSD__)
|
#if defined(__NetBSD__)
|
||||||
#include <sys/exec_elf.h>
|
#include <sys/exec_elf.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
@ -4766,6 +4772,14 @@ const char *get_exec_path()
|
|||||||
|
|
||||||
if (execfn && execfn != ENOENT)
|
if (execfn && execfn != ENOENT)
|
||||||
ret = (const char *)execfn;
|
ret = (const char *)execfn;
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
|
Elf_Auxinfo *auxv;
|
||||||
|
for (auxv = __elf_aux_vector; auxv->a_type != AT_NULL; ++auxv) {
|
||||||
|
if (auxv->a_type == AT_EXECPATH) {
|
||||||
|
ret = (const char *)auxv->a_un.a_ptr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
#elif defined(__NetBSD__)
|
#elif defined(__NetBSD__)
|
||||||
AuxInfo *auxv;
|
AuxInfo *auxv;
|
||||||
for (auxv = _dlauxinfo(); auxv->a_type != AT_NULL; ++auxv) {
|
for (auxv = _dlauxinfo(); auxv->a_type != AT_NULL; ++auxv) {
|
||||||
|
Loading…
Reference in New Issue
Block a user