]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - lib/libelf/gelf_getshdr.3
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / lib / libelf / gelf_getshdr.3
1 .\" Copyright (c) 2006 Joseph Koshy.  All rights reserved.
2 .\"
3 .\" Redistribution and use in source and binary forms, with or without
4 .\" modification, are permitted provided that the following conditions
5 .\" are met:
6 .\" 1. Redistributions of source code must retain the above copyright
7 .\"    notice, this list of conditions and the following disclaimer.
8 .\" 2. Redistributions in binary form must reproduce the above copyright
9 .\"    notice, this list of conditions and the following disclaimer in the
10 .\"    documentation and/or other materials provided with the distribution.
11 .\"
12 .\" This software is provided by Joseph Koshy ``as is'' and
13 .\" any express or implied warranties, including, but not limited to, the
14 .\" implied warranties of merchantability and fitness for a particular purpose
15 .\" are disclaimed.  in no event shall Joseph Koshy be liable
16 .\" for any direct, indirect, incidental, special, exemplary, or consequential
17 .\" damages (including, but not limited to, procurement of substitute goods
18 .\" or services; loss of use, data, or profits; or business interruption)
19 .\" however caused and on any theory of liability, whether in contract, strict
20 .\" liability, or tort (including negligence or otherwise) arising in any way
21 .\" out of the use of this software, even if advised of the possibility of
22 .\" such damage.
23 .\"
24 .\" $FreeBSD$
25 .\"
26 .Dd August 27, 2006
27 .Dt GELF_GETSHDR 3
28 .Os
29 .Sh NAME
30 .Nm elf32_getshdr ,
31 .Nm elf64_getshdr ,
32 .Nm gelf_getshdr
33 .Nd retrieve the class-dependent section header
34 .Sh LIBRARY
35 .Lb libelf
36 .Sh SYNOPSIS
37 .In libelf.h
38 .Ft "Elf32_Shdr *"
39 .Fn elf32_getshdr "Elf_Scn *scn"
40 .Ft "Elf64_Shdr *"
41 .Fn elf64_getshdr "Elf_Scn *scn"
42 .In gelf.h
43 .Ft "GElf_Shdr *"
44 .Fn gelf_getshdr "Elf_Scn *scn" "GElf_Shdr *shdr"
45 .Sh DESCRIPTION
46 These functions return a pointer to the ELF Section Header data
47 structure associated with section descriptor
48 .Ar scn .
49 .Pp
50 Function
51 .Fn elf32_getshdr
52 retrieves a pointer to an
53 .Vt Elf32_Shdr
54 structure.
55 Section descriptor
56 .Ar scn
57 must be associated with an ELF descriptor of class
58 .Dv ELFCLASS32 .
59 .Pp
60 Function
61 .Fn elf64_getshdr
62 retrieves a pointer to an
63 .Vt Elf64_Shdr
64 structure.
65 Section descriptor
66 .Ar scn
67 must be associated with an ELF descriptor of class
68 .Dv ELFCLASS64 .
69 .Pp
70 Function
71 .Fn gelf_getshdr
72 copies the values in the section header associated with argument
73 .Ar scn
74 to the structure pointed to be argument
75 .Ar dst .
76 The
77 .Vt GElf_Shdr
78 data structure is described in
79 .Xr gelf 3 .
80 .Sh RETURN VALUES
81 Functions
82 .Fn elf32_getshdr
83 and
84 .Fn elf64_getshdr
85 return a valid pointer to the appropriate section header on success
86 or NULL if an error was encountered.
87 .Pp
88 Function
89 .Fn gelf_getshdr
90 returns argument
91 .Ar dst
92 if successful, or NULL if an error was encountered.
93 .Sh ERRORS
94 These functions may fail with the following errors:
95 .Bl -tag -width "[ELF_E_RESOURCE]"
96 .It Bq Er ELF_E_ARGUMENT
97 Arguments
98 .Ar scn
99 or
100 .Ar shdr
101 were NULL.
102 .It Bq Er ELF_E_ARGUMENT
103 Argument
104 .Ar scn
105 was not associated a descriptor for an ELF object.
106 .It Bq Er ELF_E_CLASS
107 The ELF class associated with the section descriptor
108 .Ar scn
109 did not match the class expected by the API.
110 .El
111 .Sh SEE ALSO
112 .Xr elf 3 ,
113 .Xr elf_getscn 3 ,
114 .Xr gelf 3 ,
115 .Xr gelf_update_shdr 3