3 .\" Copyright (c) 2006 Joseph Koshy. All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" This software is provided by Joseph Koshy ``as is'' and
15 .\" any express or implied warranties, including, but not limited to, the
16 .\" implied warranties of merchantability and fitness for a particular purpose
17 .\" are disclaimed. in no event shall Joseph Koshy be liable
18 .\" for any direct, indirect, incidental, special, exemplary, or consequential
19 .\" damages (including, but not limited to, procurement of substitute goods
20 .\" or services; loss of use, data, or profits; or business interruption)
21 .\" however caused and on any theory of liability, whether in contract, strict
22 .\" liability, or tort (including negligence or otherwise) arising in any way
23 .\" out of the use of this software, even if advised of the possibility of
26 .\" $FreeBSD: src/lib/libelf/elf_getdata.3,v 1.2.10.1.2.1 2009/10/25 01:10:29 kensmith Exp $
35 .Nd iterate through or allocate section data
41 .Fn elf_getdata "Elf_Scn *scn" "Elf_Data *data"
43 .Fn elf_newdata "Elf_Scn *scn"
45 .Fn elf_rawdata "Elf_Scn *scn" "Elf_Data *data"
47 These functions are used to access and manipulate data descriptors
48 associated with section descriptors.
49 Data descriptors used by the ELF library are described in
54 will return the next data descriptor associated with section descriptor
56 The returned data descriptor will be setup to contain translated data.
59 may be NULL, in which case the function returns the first data descriptor
60 associated with section
64 is not NULL, it must be a pointer to a data descriptor associated with
69 will return a pointer to the next data descriptor for the section,
70 or NULL when the end of the section's descriptor list is reached.
74 will allocate a new data descriptor and append it to the list of data
75 descriptors associated with section descriptor
77 The new data descriptor will be initialized as follows:
78 .Bl -tag -width "d_version" -compact -offset indent
85 This field is under application control if the
87 flag was set on the ELF descriptor.
94 Set to the current working version of the library, as set by
97 The application must set these values as appropriate before
102 must be associated with an ELF file opened for writing.
103 If the application has not requested full control of layout by
108 then the data referenced by the returned descriptor will be positioned
109 after the existing content of the section, honoring the file alignment
112 On successful completion of a call to
114 the ELF library will mark the section
121 is used to step through the data descriptors associated with
124 In contrast to function
126 this function returns untranslated data.
129 is NULL, the first data descriptor associated with section
134 is not NULL, is must be a data descriptor associated with
139 will return the next data descriptor in the list, or NULL
140 if no further descriptors are present.
148 These functions return a valid pointer to a data descriptor if successful, or
149 NULL if an error occurs.
151 These functions may fail with the following errors:
152 .Bl -tag -width "[ELF_E_RESOURCE]"
153 .It Bq Er ELF_E_ARGUMENT
157 .It Bq Er ELF_E_ARGUMENT
160 was not associated with section descriptor
162 .It Bq Er ELF_E_RESOURCE
163 An out of memory condition was detected.