diff options
author | Ed Maste <emaste@FreeBSD.org> | 2019-06-29 15:27:18 +0000 |
---|---|---|
committer | Ed Maste <emaste@FreeBSD.org> | 2019-06-29 15:27:18 +0000 |
commit | a5b08c1484eac2c6a65e726f550b3189ff84c6c8 (patch) | |
tree | 01cd9d6d76e2c378b391422460c6f233ead08179 /documentation | |
parent | 2b92b30119ed91ed88f102ba9ecc40cd1c046a65 (diff) |
Notes
Diffstat (limited to 'documentation')
-rw-r--r-- | documentation/libelf-by-example/libelf-by-example.tex | 8 | ||||
-rw-r--r-- | documentation/libelf-by-example/prog3.txt | 3 | ||||
-rw-r--r-- | documentation/libelf-by-example/prog4.txt | 4 | ||||
-rw-r--r-- | documentation/libelf-by-example/prog6.txt | 8 |
4 files changed, 15 insertions, 8 deletions
diff --git a/documentation/libelf-by-example/libelf-by-example.tex b/documentation/libelf-by-example/libelf-by-example.tex index 2183465bb52b..2389c6c80393 100644 --- a/documentation/libelf-by-example/libelf-by-example.tex +++ b/documentation/libelf-by-example/libelf-by-example.tex @@ -24,7 +24,7 @@ % out of the use of this software, even if advised of the possibility of % such damage. % -% $Id: libelf-by-example.tex 2457 2012-03-09 14:38:10Z jkoshy $ +% $Id: libelf-by-example.tex 3699 2019-02-28 06:34:53Z jkoshy $ % \documentclass[a4paper,pdftex]{book} @@ -2700,6 +2700,12 @@ typedef struct { \emph{parent} archive descriptor (referenced by variable \parameter{ar} in this example) to return the next archive member on the next call to function \function{elf\_begin}. + + The \function{elf\_next} function ordinarily returns the value + \constant{ELF\_C\_READ}, allowing the traversal of the archive to + continue normally. In the event of an error the function + returns the value \constant{ELF\_C\_NULL}, which causes the function + \function{elf\_begin} to stop archive traversal. \item[\coref{6}] It is good programming practice to call \function{elf\_end} on descriptors that are no longer needed. \end{description} diff --git a/documentation/libelf-by-example/prog3.txt b/documentation/libelf-by-example/prog3.txt index 8d1b350bce68..0b49555ec5e1 100644 --- a/documentation/libelf-by-example/prog3.txt +++ b/documentation/libelf-by-example/prog3.txt @@ -1,7 +1,7 @@ /* * Print the ELF Program Header Table in an ELF object. * - * $Id: prog3.txt 2133 2011-11-10 08:28:22Z jkoshy $ + * $Id: prog3.txt 3686 2019-02-22 07:54:47Z jkoshy $ */ #include <err.h> @@ -11,7 +11,6 @@ #include <stdint.h> #include <stdlib.h> #include <unistd.h> -#include <vis.h> void print_ptype(size_t pt) @\co{7}@ diff --git a/documentation/libelf-by-example/prog4.txt b/documentation/libelf-by-example/prog4.txt index 465f9df595d7..919e4f5dc1aa 100644 --- a/documentation/libelf-by-example/prog4.txt +++ b/documentation/libelf-by-example/prog4.txt @@ -1,7 +1,7 @@ /* * Print the names of ELF sections. * - * $Id: prog4.txt 2133 2011-11-10 08:28:22Z jkoshy $ + * $Id: prog4.txt 3687 2019-02-22 07:55:09Z jkoshy $ */ #include <err.h> @@ -18,11 +18,11 @@ main(int argc, char **argv) { int fd; Elf *e; - char *name, *p, pc[4*sizeof(char)]; Elf_Scn *scn; Elf_Data *data; GElf_Shdr shdr; size_t n, shstrndx, sz; + char *name, *p, pc[(4 * sizeof(char)) + 1]; if (argc != 2) errx(EXIT_FAILURE, "usage: %s file-name", argv[0]); diff --git a/documentation/libelf-by-example/prog6.txt b/documentation/libelf-by-example/prog6.txt index d895d3681e78..f2ad3388bc85 100644 --- a/documentation/libelf-by-example/prog6.txt +++ b/documentation/libelf-by-example/prog6.txt @@ -1,7 +1,7 @@ /* * Iterate through an ar(1) archive. * - * $Id: prog6.txt 2135 2011-11-10 08:59:47Z jkoshy $ + * $Id: prog6.txt 3699 2019-02-28 06:34:53Z jkoshy $ */ #include <err.h> @@ -16,6 +16,7 @@ main(int argc, char **argv) { int fd; Elf *ar, *e; + Elf_Cmd cmd; Elf_Arhdr *arh; if (argc != 2) @@ -39,7 +40,8 @@ main(int argc, char **argv) errx(EXIT_FAILURE, "%s is not an ar(1) archive.", argv[1]); - while ((e = elf_begin(fd, ELF_C_READ, ar)) != NULL) { @\co{3}@ + cmd = ELF_C_READ; + while ((e = elf_begin(fd, cmd, ar)) != NULL) { @\co{3}@ if ((arh = elf_getarhdr(e)) == NULL) @\co{4}@ errx(EXIT_FAILURE, "elf_getarhdr() failed: %s.", elf_errmsg(-1)); @@ -47,7 +49,7 @@ main(int argc, char **argv) (void) printf("%20s %zd\n", arh->ar_name, arh->ar_size); - (void) elf_next(e); @\co{5}@ + cmd = elf_next(e); @\co{5}@ (void) elf_end(e); @\co{6}@ } |