summaryrefslogtreecommitdiffstats
path: root/doc/elf64_offscn.3
diff options
context:
space:
mode:
Diffstat (limited to 'doc/elf64_offscn.3')
-rw-r--r--doc/elf64_offscn.372
1 files changed, 72 insertions, 0 deletions
diff --git a/doc/elf64_offscn.3 b/doc/elf64_offscn.3
new file mode 100644
index 00000000..4321944d
--- /dev/null
+++ b/doc/elf64_offscn.3
@@ -0,0 +1,72 @@
+.TH ELF64_OFFSCN 3 "June 2024" "Elfutils" "Library Functions Manual"
+
+.SH NAME
+elf64_offscn \- retrieve a section descriptor by file offset for an ELF64 file
+
+.SH SYNOPSIS
+.B #include <libelf.h>
+
+.BI "Elf_Scn *elf64_offscn(Elf *" elf ", off_t " offset ");"
+
+.SH DESCRIPTION
+The .B elf64_offscn function retrieves the section descriptor for the section at the specified file offset in the ELF64 object referred to by .I elf.
+
+Sections in an ELF file are located at specific offsets within the file. This function allows access to a section based on its file offset, which is particularly useful when parsing or manipulating ELF files at a low level.
+
+.SH PARAMETERS
+.TP
+.I elf
+An .I Elf pointer to the ELF object from which the section descriptor is to be retrieved.
+
+.TP
+.I offset
+An .I off_t value representing the file offset of the section whose descriptor is to be retrieved. The offset is typically obtained from other ELF structures, such as program headers or section headers.
+
+.SH RETURN VALUE
+The .B elf64_offscn function returns a pointer to the .I Elf_Scn structure for the section at the specified offset. If an error occurs, it returns NULL and sets an appropriate error code.
+
+.SH ERRORS
+If .B elf64_offscn fails, it sets the following error codes:
+
+.TP
+.B ELFMEM
+Memory allocation failed.
+
+.TP
+.B ELFARG
+The .I elf parameter is NULL, or .I offset is invalid.
+
+.TP
+.B ELFERR
+An unspecified internal error occurred.
+
+.SH EXAMPLES
+.B "Example 1: Retrieve the section descriptor for a section at a specific offset"
+.nf
+.in +4
+#include <libelf.h>
+
+Elf *elf = ...; // Assume elf is a valid Elf pointer
+off_t offset = ...; // Specify a valid file offset
+
+Elf_Scn *scn = elf64_offscn(elf, offset);
+if (scn == NULL) {
+ // Handle error
+}
+.in -4
+.fi
+
+.SH SEE ALSO
+.BR elf64_getshdr (3),
+.BR elf64_getphdr (3),
+.BR elf_getscn (3),
+.BR elf (3),
+.BR libelf (3)
+
+.SH AUTHORS
+Elfutils was written by the Elfutils development team.
+
+.SH COPYRIGHT
+Copyright © 2024 Elfutils Development Team.
+This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+