mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
![Brooks Davis](/assets/img/avatar_default.png)
This is part of the interface to the kernel and some syscall wrappers depend on it so move it there. Reviewed by: kib, emaste, imp Pull Request: https://github.com/freebsd/freebsd-src/pull/908
106 lines
3.4 KiB
Groff
106 lines
3.4 KiB
Groff
.\"
|
|
.\" Copyright (c) 2019 Ian Lepore <ian@freebsd.org>
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modification, are permitted provided that the following conditions
|
|
.\" are met:
|
|
.\"
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
.\"
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
.\"
|
|
.Dd September 16, 2022
|
|
.Dt ELF_AUX_INFO 3
|
|
.Os
|
|
.Sh NAME
|
|
.Nm elf_aux_info
|
|
.Nd extract data from the elf auxiliary vector of the current process
|
|
.Sh LIBRARY
|
|
.Lb libc
|
|
.Sh SYNOPSIS
|
|
.In sys/auxv.h
|
|
.Ft int
|
|
.Fn elf_aux_info "int aux" "void *buf" "int buflen"
|
|
.Sh DESCRIPTION
|
|
The
|
|
.Fn elf_aux_info
|
|
function retrieves the auxiliary info vector requested in
|
|
.Va aux .
|
|
The information is stored into the provided buffer if it will fit.
|
|
The following values, defined in
|
|
.In sys/elf_common.h
|
|
can be requested (corresponding buffer sizes are specified in parenthesis):
|
|
.Bl -tag -width AT_OSRELDATE
|
|
.It AT_CANARY
|
|
The canary value for SSP (arbitrary sized buffer, as many bytes are
|
|
returned as it fits into it, rest is zeroed).
|
|
.It AT_EXECPATH
|
|
The path of executed program
|
|
.Dv (MAXPATHLEN).
|
|
This may not be present if the process was initialized by
|
|
.Xr fexecve 2
|
|
and the namecache no longer contains the file's name.
|
|
.It AT_HWCAP
|
|
CPU / hardware feature flags
|
|
.Dv (sizeof(u_long)).
|
|
.It AT_HWCAP2
|
|
CPU / hardware feature flags
|
|
.Dv (sizeof(u_long)).
|
|
.It AT_NCPUS
|
|
Number of CPUs
|
|
.Dv (sizeof(int)).
|
|
.It AT_OSRELDATE
|
|
The
|
|
.Dv OSRELDATE
|
|
of the kernel or jail the program is running on
|
|
.Dv (sizeof(int)).
|
|
.It AT_PAGESIZES
|
|
Vector of page sizes (arbitrary sized buffer, as many elements of the
|
|
.Dv pagesizes
|
|
array are returned as it fits).
|
|
.It AT_PAGESZ
|
|
Page size in bytes
|
|
.Dv (sizeof(int)).
|
|
.It AT_TIMEKEEP
|
|
Pointer to VDSO timehands (for library internal use,
|
|
.Dv sizeof(void *)).
|
|
.It AT_USRSTACKBASE
|
|
Top of the user stack for main thread.
|
|
.It AT_USRSTACKLIM
|
|
Limit for grow of the user stack for main thread.
|
|
.El
|
|
.Sh RETURN VALUES
|
|
Returns zero on success, or an error number on failure.
|
|
.Sh ERRORS
|
|
.Bl -tag -width Er
|
|
.It Bq Er EINVAL
|
|
An unknown item was requested.
|
|
.It Bq Er EINVAL
|
|
The provided buffer was not the right size for the requested item.
|
|
.It Bq Er ENOENT
|
|
The requested item is not available.
|
|
.El
|
|
.Sh HISTORY
|
|
The
|
|
.Fn elf_aux_info
|
|
function appeared in
|
|
.Fx 12.0 .
|
|
.Sh BUGS
|
|
Only a small subset of available auxiliary info vector items are
|
|
accessible with this function.
|
|
Some items require a "right-sized" buffer while others just require a
|
|
"big enough" buffer.
|