xref: /openbsd-src/lib/libc/gen/elf_aux_info.3 (revision ef873df06dac50249b2dd380dc6100eee3b0d23d)
1.\"	$OpenBSD: elf_aux_info.3,v 1.1 2024/07/14 09:48:48 jca Exp $
2.\"
3.\" Origin: FreeBSD auxv.3
4.\"
5.\" Copyright (c) 2019 Ian Lepore <ian@freebsd.org>
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\"
11.\" 1. Redistributions of source code must retain the above copyright
12.\"    notice, this list of conditions and the following disclaimer.
13.\" 2. Redistributions in binary form must reproduce the above copyright
14.\"    notice, this list of conditions and the following disclaimer in the
15.\"    documentation and/or other materials provided with the distribution.
16.\"
17.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27.\"
28.Dd $Mdocdate: July 14 2024 $
29.Dt ELF_AUX_INFO 3
30.Os
31.Sh NAME
32.Nm elf_aux_info
33.Nd extract data from the elf auxiliary vector of the current process
34.Sh SYNOPSIS
35.In sys/auxv.h
36.Ft int
37.Fn elf_aux_info "int aux" "void *buf" "int buflen"
38.Sh DESCRIPTION
39The
40.Fn elf_aux_info
41function retrieves the auxiliary info vector requested in
42.Va aux .
43The information is stored into the provided buffer if it will fit.
44The following values can be requested (corresponding buffer sizes are
45specified in parenthesis):
46.Bl -tag -width AT_HWCAP2
47.It AT_HWCAP
48CPU / hardware feature flags
49.Dv (sizeof(unsigned long)) .
50.It AT_HWCAP2
51CPU / hardware feature flags
52.Dv (sizeof(unsigned long)) .
53.It AT_PAGESZ
54Page size in bytes
55.Dv (sizeof(int)) .
56.El
57.Sh RETURN VALUES
58Returns zero on success, or an error number on failure.
59.Sh ERRORS
60.Bl -tag -width Er
61.It Bq Er EINVAL
62An unknown item was requested.
63.It Bq Er EINVAL
64The provided buffer was not the right size for the requested item.
65.It Bq Er ENOENT
66The requested item is not available.
67.El
68.Sh HISTORY
69The
70.Fn elf_aux_info
71function appeared in
72.Fx 12.0
73and was first available in
74.Ox 7.6 .
75