kernel: bwrite_common's 3rd & 4th args can be bools
[unleashed.git] / share / man / man3elf / elf32_getehdr.3elf
blobe75c92feaa5ede8c75557aa52fb2193934f63937
1 '\" te
2 .\"  Copyright 1989 AT&T  Copyright (c) 2002, Sun Microsystems, Inc.  All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH ELF32_GETEHDR 3ELF "Jun 19, 2002"
7 .SH NAME
8 elf32_getehdr, elf32_newehdr, elf64_getehdr, elf64_newehdr \- retrieve
9 class-dependent object file header
10 .SH SYNOPSIS
11 .LP
12 .nf
13 cc [ \fIflag\fR ... ] \fIfile\fR ... \fB-lelf\fR [ \fIlibrary\fR ... ]
14 #include <libelf.h>
16 \fBElf32_Ehdr *\fR\fBelf32_getehdr\fR(\fBElf *\fR\fIelf\fR);
17 .fi
19 .LP
20 .nf
21 \fBElf32_Ehdr *\fR\fBelf32_newehdr\fR(\fBElf *\fR\fIelf\fR);
22 .fi
24 .LP
25 .nf
26 \fBElf64_Ehdr *\fR\fBelf64_getehdr\fR(\fBElf *\fR\fIelf\fR);
27 .fi
29 .LP
30 .nf
31 \fBElf64_Ehdr *\fR\fBelf64_newehdr\fR(\fBElf *\fR\fIelf\fR);
32 .fi
34 .SH DESCRIPTION
35 .sp
36 .LP
37 For a 32-bit class file, \fBelf32_getehdr()\fR returns a pointer to an
38 \fBELF\fR header, if one is available for the \fBELF\fR descriptor \fIelf\fR.
39 If no header exists for the descriptor, \fBelf32_newehdr()\fR allocates a clean
40 one, but it otherwise behaves the same as \fBelf32_getehdr()\fR. It does not
41 allocate a new header if one exists already. If no header exists for
42 \fBelf32_getehdr()\fR, one cannot be created for \fBelf32_newehdr()\fR, a
43 system error occurs, the file is not a 32-bit class file, or \fIelf\fR is
44 \fINULL\fR, both functions return a null pointer.
45 .sp
46 .LP
47 For the 64\(mibit class, replace 32 with 64 as appropriate.
48 .sp
49 .LP
50 The header includes the following members:
51 .sp
52 .in +2
53 .nf
54 unsigned char   e_ident[EI_NIDENT];
55 Elf32_Half      e_type;
56 Elf32_Half      e_machine;
57 Elf32_Word      e_version;
58 Elf32_Addr      e_entry;
59 Elf32_Off       e_phoff;
60 Elf32_Off       e_shoff;
61 Elf32_Word      e_flags;
62 Elf32_Half      e_ehsize;
63 Elf32_Half      e_phentsize;
64 Elf32_Half      e_phnum;
65 Elf32_Half      e_shentsize;
66 Elf32_Half      e_shnum;
67 Elf32_Half      e_shstrndx;
68 .fi
69 .in -2
71 .sp
72 .LP
73 The \fBelf32_newehdr()\fR function automatically sets the \fBELF_F_DIRTY\fR
74 bit. See \fBelf_flagdata\fR(3ELF).
75 .sp
76 .LP
77 An application can use \fBelf_getident()\fR to inspect the identification bytes
78 from a file.
79 .sp
80 .LP
81 An application can use \fBelf_getshnum()\fR and \fBelf_getshstrndx()\fR to
82 obtain section header information. The location of this section header
83 information differs between standard \fBELF\fR files to those that require
84 Extended Sections.
85 .SH ATTRIBUTES
86 .sp
87 .LP
88 See \fBattributes\fR(5) for descriptions of the following attributes:
89 .sp
91 .sp
92 .TS
93 box;
94 c | c
95 l | l .
96 ATTRIBUTE TYPE  ATTRIBUTE VALUE
98 Interface Stability     Stable
100 MT-Level        MT-Safe
103 .SH SEE ALSO
106 \fBelf\fR(3ELF), \fBelf_begin\fR(3ELF), \fBelf_flagdata\fR(3ELF),
107 \fBelf_getident\fR(3ELF), \fBelf_getshnum\fR(3ELF),
108 \fBelf_getshstrndx\fR(3ELF), \fBlibelf\fR(3LIB), \fBattributes\fR(5)