Hi Aaron,

On Sun, 2025-06-22 at 19:02 -0400, Aaron Merey wrote:
> Signed-off-by: Aaron Merey <ame...@redhat.com>
> ---
>  doc/Makefile.am |  1 +
>  doc/elf_cntl.3  | 66 +++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 67 insertions(+)
>  create mode 100644 doc/elf_cntl.3
> 
> diff --git a/doc/Makefile.am b/doc/Makefile.am
> index d0ec20da..de0106bb 100644
> --- a/doc/Makefile.am
> +++ b/doc/Makefile.am
> @@ -51,6 +51,7 @@ notrans_dist_man3_MANS= elf32_checksum.3 \
>                       elf64_xlatetom.3 \
>                       elf_begin.3 \
>                       elf_clone.3 \
> +                     elf_cntl.3 \
>                       elf_end.3 \
>                       elf_errmsg.3 \
>                       elf_errno.3 \

OK.

> diff --git a/doc/elf_cntl.3 b/doc/elf_cntl.3
> new file mode 100644
> index 00000000..2ef3e6b9
> --- /dev/null
> +++ b/doc/elf_cntl.3
> @@ -0,0 +1,66 @@
> +.TH ELF_CNTL 3 2025-06-17 "Libelf" "Libelf Programmer's Manual"
> +
> +.SH NAME
> +elf_cntl \- perform control operations on an ELF descriptor
> +
> +.SH SYNOPSIS
> +.nf
> +#include <libelf.h>
> +
> +int elf_cntl(Elf *elf, Elf_Cmd cmd);
> +.fi
> +.SH DESCRIPTION
> +Perform control operations on the ELF descriptor
> +.I elf
> +according to the operation specified by
> +.IR cmd .
> +
> +The following commands are supported:
> +
> +.TP
> +.B ELF_C_FDDONE
> +This command tells
> +.B libelf
> +that the application is done using the file descriptor associated with the
> +.I elf
> +object. The file descriptor may then be closed immediately without affecting 
> the
> +in-memory ELF data.

Maybe add something like: Unless all data has been read already from
the file descriptor (see ELF_C_FDREAD) future operations on the ELF
descriptor may fail if they still need to read any data.

> +
> +.TP
> +.B ELF_C_FDREAD
> +This command causes
> +.B libelf
> +to read the entire contents of the underlying file into memory immediately.
> +.B libelf
> +generally reads and parses elements of ELF files only when they are required.
> +This command instead triggers
> +.B libelf
> +to read all elements immediately.

Maybe add something like: After reading all data acts like
ELF_C_FDDONE. The file descriptor associated with the ELF descriptor
may be closed.

> +.SH RETURN VALUE
> +On success, returns 0.
> +
> +On failure, it returns \-1 and sets an error that can be retrieved with
> +.BR elf_errmsg (3).
> +
> +
> +.SH SEE ALSO
> +.BR libelf (3),
> +.BR elf_errmsg (3),
> +.BR elf (5)
> +
> +.SH ATTRIBUTES
> +.TS
> +allbox;
> +lbx lb lb
> +l l l.
> +Interface       Attribute       Value
> +T{
> +.na
> +.nh
> +.BR elf_cntl ()
> +T}      Thread safety   MT-Safe
> +.TE
> +
> +.SH REPORTING BUGS
> +Report bugs to <elfutils-devel@sourceware.org> or 
> https://sourceware.org/bugzilla/.

Looks good,

Mark

Reply via email to