diff mbox series

[PULL,02/31] util/getauxval: Porting to FreeBSD getauxval feature

Message ID 20200624105048.375353-2-pbonzini@redhat.com
State New
Headers show
Series Misc patches for 2020-06-24 | expand

Commit Message

Paolo Bonzini June 24, 2020, 10:50 a.m. UTC
From: David CARLIER <devnexen@gmail.com>

FreeBSD has a similar API for auxiliary vector.

Signed-off-by: David Carlier <devnexen@gmail.com>
Message-Id: <CA+XhMqxTU6PUSQBpbA9VrS1QZfqgrCAKUCtUF-x2aF=fCMTDOw@mail.gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 util/getauxval.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/util/getauxval.c b/util/getauxval.c
index 36afdfb9e6..b124107d61 100644
--- a/util/getauxval.c
+++ b/util/getauxval.c
@@ -98,6 +98,16 @@  unsigned long qemu_getauxval(unsigned long type)
     return 0;
 }
 
+#elif defined(__FreeBSD__)
+#include <sys/auxv.h>
+
+unsigned long qemu_getauxval(unsigned long type)
+{
+    unsigned long aux = 0;
+    elf_aux_info(type, &aux, sizeof(aux));
+    return aux;
+}
+
 #else
 
 unsigned long qemu_getauxval(unsigned long type)