]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
doc: Add elf_rand.3
authorAaron Merey <amerey@redhat.com>
Tue, 5 Aug 2025 03:24:41 +0000 (23:24 -0400)
committerAaron Merey <amerey@redhat.com>
Fri, 5 Sep 2025 16:41:49 +0000 (12:41 -0400)
Signed-off-by: Aaron Merey <amerey@redhat.com>
doc/Makefile.am
doc/elf_rand.3 [new file with mode: 0644]

index 7201101946ec19ee5b3b5a9e238405e4e45ac2c6..697a0119f9b6a3717a2f3fa7a400338c706c6480 100644 (file)
@@ -76,6 +76,7 @@ notrans_dist_man3_MANS= elf32_checksum.3 \
                        elf_newdata.3 \
                        elf_newscn.3 \
                        elf_nextscn.3 \
+                       elf_rand.3 \
                        elf_rawfile.3 \
                        elf_scnshndx.3 \
                        elf_strptr.3 \
diff --git a/doc/elf_rand.3 b/doc/elf_rand.3
new file mode 100644 (file)
index 0000000..5c07a92
--- /dev/null
@@ -0,0 +1,71 @@
+.TH ELF_RAND 3 2025-06-30 "Libelf" "Libelf Programmer's Manual"
+
+.SH NAME
+elf_rand - Set the offset for the next archive member in an ELF file.
+
+.SH SYNOPSIS
+.nf
+#include <libelf.h>
+
+.BI "size_t elf_rand(Elf *" elf ", size_t " offset ");"
+.fi
+
+.SH DESCRIPTION
+The
+.BR elf_rand ()
+function sets the current archive member offset for the ELF archive descriptor
+.I elf
+to
+.IR offset .
+
+This function is only valid when
+.I elf
+refers to an archive descriptor (i.e., its kind is
+.BR ELF_K_AR ).
+
+Archive member offsets can be acquired from the
+.I Elf_Arsym
+array returned by
+.BR elf_getarsym (3).
+
+If the archive header at the given offset cannot be parsed or validated,
+then 0 is returned.
+
+.SH PARAMETERS
+.TP
+.I elf
+A pointer to an ELF archive descriptor.
+
+.TP
+.I offset
+A byte offset to the archive header, indicating the desired member position.
+
+.SH RETURN VALUE
+Returns the input
+.I offset
+if successful. Returns 0 if
+.I elf
+is NULL, is not an archive descriptor, or if an error occurs while reading the member at
+.IR offset .
+
+.SH SEE ALSO
+.BR elf_getarsym (3),
+.BR elf_next (3),
+.BR libelf (3),
+.BR elf (5)
+
+.SH ATTRIBUTES
+.TS
+allbox;
+lbx lb lb
+l l l.
+Interface      Attribute       Value
+T{
+.na
+.nh
+.BR elf_rand ()
+T}     Thread safety   MT-Safe
+.TE
+
+.SH REPORTING BUGS
+Report bugs to <elfutils-devel@sourceware.org> or https://sourceware.org/bugzilla/.