Hi Aaron,

Similar comments as for gelf_getauxv.

On Wed, 2025-12-31 at 21:50 -0500, Aaron Merey wrote:
> Signed-off-by: Aaron Merey <[email protected]>
> ---
>  doc/Makefile.am        |  1 +
>  doc/gelf_update_auxv.3 | 89 ++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 90 insertions(+)
>  create mode 100644 doc/gelf_update_auxv.3
> 
> diff --git a/doc/Makefile.am b/doc/Makefile.am
> index fbcc6a8b..5d12f0a7 100644
> --- a/doc/Makefile.am
> +++ b/doc/Makefile.am
> @@ -115,6 +115,7 @@ notrans_dist_man3_MANS= elf32_checksum.3 \
>                       gelf_newehdr.3 \
>                       gelf_newphdr.3 \
>                       gelf_offscn.3 \
> +                     gelf_update_auxv.3 \
>                       gelf_update_ehdr.3 \
>                       gelf_update_dyn.3 \
>                       gelf_update_lib.3 \

OK.

> diff --git a/doc/gelf_update_auxv.3 b/doc/gelf_update_auxv.3
> new file mode 100644
> index 00000000..8150d221
> --- /dev/null
> +++ b/doc/gelf_update_auxv.3
> @@ -0,0 +1,89 @@
> +.TH GELF_UPDATE_AUXV 3 2025-12-31 "Libelf" "Libelf Programmer's Manual"
> +
> +.SH NAME
> +gelf_update_auxv \- Update information in the auxiliary vector at the given 
> index
> +
> +.SH SYNOPSIS
> +.nf
> +.B #include <gelf.h>
> +
> +.BI "int gelf_update_auxv (Elf_Data *" data ", int " ndx ", GElf_auxv_t *" 
> src ");"

OK.

> +.SH DESCRIPTION
> +Copy a class\-independent auxiliary vector entry from
> +.I src
> +into the
> +.B NT_AUXV
> +note associated with
> +.I data
> +at index
> +.IR ndx .
> +See
> +.BR getauxval (3)
> +for more information regarding the auxiliary vector.

This is kind of tricky because they data doesn't really map to an Elf
section. You have to extract it from a segment of memory, a core
file note or grab it from /proc/pid/auxv. But that means the data-
>d_buf might not actually point to something that really gets written
back.

> +.SH PARAMETERS
> +.TP
> +.I data
> +Pointer to an
> +.B Elf_Data
> +associated with an
> +.B NT_AUXV
> +ELF note

data->d_type should be ELF_T_AUXV.

> +.TP
> +.I ndx
> +Zero\-based index of the auxiliary vector entry to be updated within
> +.IR data .
> +
> +.TP
> +.I src
> +Pointer to a caller\-provided auxiliary vector entry.  For
> +.B ELFCLASS32
> +binaries,
> +.B a_type
> +and
> +.B a_val
> +must fit within unsigned 32-bit values.
> +.I src
> +must not be NULL.

OK.

> +.SH RETURN VALUE
> +On success, this function returns a non-zero value, updates the
> +auxiliary vector entry at index
> +.I ndx
> +in
> +.IR data ,
> +and marks the section or segment associated with
> +.I data
> +with
> +.BR ELF_F_DIRTY .
> +On failure, zero is returned and elf_errno is set.  If
> +.I data
> +is NULL, then zero is returned without setting elf_errno.

OK.

> +.SH SEE ALSO
> +.BR gelf_getauxv (3),
> +.BR getauxval (3),
> +.BR libelf (3),
> +.BR elf (5)

Where is GElf_auxv_t described?

> +.SH ATTRIBUTES
> +.TS
> +allbox;
> +lbx lb lb
> +l l l.
> +Interface    Attribute       Value
> +T{
> +.na
> +.nh
> +.BR gelf_update_auxv ()
> +T}   Thread safety   MT-Safe
> +.TE
> +
> +.SH REPORTING BUGS
> +Report bugs to <[email protected]> or 
> https://sourceware.org/bugzilla/.
> +
> +.SH HISTORY
> +.B gelf_update_auxv
> +first appeared in elfutils 0.130.

This is an elfutils libelf extension and will most likely not be found
in any other libelf implementation.

Thanks,

Mark

Reply via email to