1nlist(3ELF) ELF Library Functions nlist(3ELF)
2
3
4
6 nlist - get entries from name list
7
9 cc [ flag... ] file ... -lelf [ library ... ]
10 #include <nlist.h>
11
12 int nlist(const char *filename, struct nlist *nl);
13
14
16 nlist() examines the name list in the executable file whose name is
17 pointed to by filename, and selectively extracts a list of values and
18 puts them in the array of nlist() structures pointed to by nl. The name
19 list nl consists of an array of structures containing names of vari‐
20 ables, types, and values. The list is terminated with a null name, that
21 is, a null string is in the name position of the structure. Each vari‐
22 able name is looked up in the name list of the file. If the name is
23 found, the type, value, storage class, and section number of the name
24 are inserted in the other fields. The type field may be set to 0 if the
25 file was not compiled with the -g option to cc.
26
27
28 nlist() will always return the information for an external symbol of a
29 given name if the name exists in the file. If an external symbol does
30 not exist, and there is more than one symbol with the specified name
31 in the file (such as static symbols defined in separate files), the
32 values returned will be for the last occurrence of that name in the
33 file. If the name is not found, all fields in the structure except
34 n_name are set to 0.
35
36
37 This function is useful for examining the system name list kept in the
38 file /dev/ksyms. In this way programs can obtain system addresses that
39 are up to date.
40
42 All value entries are set to 0 if the file cannot be read or if it does
43 not contain a valid name list.
44
45
46 nlist() returns 0 on success, −1 on error.
47
49 See attributes(5) for descriptions of the following attributes:
50
51
52
53
54 ┌─────────────────────────────┬─────────────────────────────┐
55 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
56 ├─────────────────────────────┼─────────────────────────────┤
57 │Interface Stability │Stable │
58 ├─────────────────────────────┼─────────────────────────────┤
59 │MT-Level │Safe │
60 └─────────────────────────────┴─────────────────────────────┘
61
63 elf(3ELF), kvm_nlist(3KVM), kvm_open(3KVM), libelf(3LIB), a.out(4),
64 attributes(5), ksyms(7D), mem(7D)
65
66
67
68SunOS 5.11 11 Jul 2001 nlist(3ELF)