12de3b87aSKai Wang.\" Copyright (c) 2006,2008 Joseph Koshy. All rights reserved. 22de3b87aSKai Wang.\" 32de3b87aSKai Wang.\" Redistribution and use in source and binary forms, with or without 42de3b87aSKai Wang.\" modification, are permitted provided that the following conditions 52de3b87aSKai Wang.\" are met: 62de3b87aSKai Wang.\" 1. Redistributions of source code must retain the above copyright 72de3b87aSKai Wang.\" notice, this list of conditions and the following disclaimer. 82de3b87aSKai Wang.\" 2. Redistributions in binary form must reproduce the above copyright 92de3b87aSKai Wang.\" notice, this list of conditions and the following disclaimer in the 102de3b87aSKai Wang.\" documentation and/or other materials provided with the distribution. 112de3b87aSKai Wang.\" 122de3b87aSKai Wang.\" This software is provided by Joseph Koshy ``as is'' and 132de3b87aSKai Wang.\" any express or implied warranties, including, but not limited to, the 142de3b87aSKai Wang.\" implied warranties of merchantability and fitness for a particular purpose 152de3b87aSKai Wang.\" are disclaimed. in no event shall Joseph Koshy be liable 162de3b87aSKai Wang.\" for any direct, indirect, incidental, special, exemplary, or consequential 172de3b87aSKai Wang.\" damages (including, but not limited to, procurement of substitute goods 182de3b87aSKai Wang.\" or services; loss of use, data, or profits; or business interruption) 192de3b87aSKai Wang.\" however caused and on any theory of liability, whether in contract, strict 202de3b87aSKai Wang.\" liability, or tort (including negligence or otherwise) arising in any way 212de3b87aSKai Wang.\" out of the use of this software, even if advised of the possibility of 222de3b87aSKai Wang.\" such damage. 232de3b87aSKai Wang.\" 24*ae500c1fSEd Maste.\" $Id: gelf_getehdr.3 3639 2018-10-14 14:07:02Z jkoshy $ 252de3b87aSKai Wang.\" 262de3b87aSKai Wang.Dd December 16, 2006 272de3b87aSKai Wang.Dt GELF_GETEHDR 3 28*ae500c1fSEd Maste.Os 292de3b87aSKai Wang.Sh NAME 302de3b87aSKai Wang.Nm elf32_getehdr , 312de3b87aSKai Wang.Nm elf64_getehdr , 322de3b87aSKai Wang.Nm gelf_getehdr 332de3b87aSKai Wang.Nd retrieve the object file header 342de3b87aSKai Wang.Sh LIBRARY 352de3b87aSKai Wang.Lb libelf 362de3b87aSKai Wang.Sh SYNOPSIS 372de3b87aSKai Wang.In libelf.h 382de3b87aSKai Wang.Ft "Elf32_Ehdr *" 392de3b87aSKai Wang.Fn elf32_getehdr "Elf *elf" 402de3b87aSKai Wang.Ft "Elf64_Ehdr *" 412de3b87aSKai Wang.Fn elf64_getehdr "Elf *elf" 422de3b87aSKai Wang.In gelf.h 432de3b87aSKai Wang.Ft "GElf_Ehdr *" 442de3b87aSKai Wang.Fn gelf_getehdr "Elf *elf" "GElf_Ehdr *dst" 452de3b87aSKai Wang.Sh DESCRIPTION 462de3b87aSKai WangThese functions retrieve the ELF object file 472de3b87aSKai Wangheader from the ELF descriptor 482de3b87aSKai Wang.Ar elf 492de3b87aSKai Wangand return a translated header descriptor to their callers. 502de3b87aSKai Wang.Pp 512de3b87aSKai WangFunctions 522de3b87aSKai Wang.Fn elf32_getehdr 532de3b87aSKai Wangand 542de3b87aSKai Wang.Fn elf64_getehdr 552de3b87aSKai Wangreturn a pointer to the appropriate class-specific header descriptor 562de3b87aSKai Wangif it exists in the file referenced by descriptor 572de3b87aSKai Wang.Ar elf . 582de3b87aSKai WangThese functions return 592de3b87aSKai Wang.Dv NULL 602de3b87aSKai Wangif an ELF header was not found in file 612de3b87aSKai Wang.Ar elf . 622de3b87aSKai Wang.Pp 632de3b87aSKai WangFunction 642de3b87aSKai Wang.Fn gelf_getehdr 652de3b87aSKai Wangstores a translated copy of the header for ELF file 662de3b87aSKai Wang.Ar elf 672de3b87aSKai Wanginto the descriptor pointed to by argument 682de3b87aSKai Wang.Ar dst . 692de3b87aSKai WangIt returns argument 702de3b87aSKai Wang.Ar dst 712de3b87aSKai Wangif successful or 722de3b87aSKai Wang.Dv NULL 732de3b87aSKai Wangin case of failure. 742de3b87aSKai Wang.Sh RETURN VALUES 752de3b87aSKai WangThese functions return a pointer to a translated header descriptor 762de3b87aSKai Wangif successful, or NULL on failure. 772de3b87aSKai Wang.Sh ERRORS 782de3b87aSKai WangThese functions can fail with the following errors: 792de3b87aSKai Wang.Bl -tag -width "[ELF_E_RESOURCE]" 802de3b87aSKai Wang.It Bq Er ELF_E_ARGUMENT 812de3b87aSKai WangThe argument 822de3b87aSKai Wang.Ar elf 832de3b87aSKai Wangwas null. 842de3b87aSKai Wang.It Bq Er ELF_E_ARGUMENT 852de3b87aSKai WangArgument 862de3b87aSKai Wang.Ar elf 872de3b87aSKai Wangwas not a descriptor for an ELF file. 882de3b87aSKai Wang.It Bq Er ELF_E_ARGUMENT 892de3b87aSKai WangThe elf class of descriptor 902de3b87aSKai Wang.Ar elf 912de3b87aSKai Wangwas not recognized. 922de3b87aSKai Wang.It Bq Er ELF_E_ARGUMENT 932de3b87aSKai WangArgument 942de3b87aSKai Wang.Ar dst 952de3b87aSKai Wangwas null. 962de3b87aSKai Wang.It Bq Er ELF_E_CLASS 972de3b87aSKai WangThe ELF class of descriptor 982de3b87aSKai Wang.Ar elf 992de3b87aSKai Wangdid not match that of the API function being called. 1002de3b87aSKai Wang.It Bq Er ELF_E_HEADER 1012de3b87aSKai WangELF descriptor 1022de3b87aSKai Wang.Ar elf 1032de3b87aSKai Wangdoes not have an associated header. 1042de3b87aSKai Wang.It Bq Er ELF_E_RESOURCE 1052de3b87aSKai WangAn out of memory condition was detected during execution. 1062de3b87aSKai Wang.It Bq Er ELF_E_SECTION 1072de3b87aSKai WangThe ELF descriptor in argument 1082de3b87aSKai Wang.Ar elf 1092de3b87aSKai Wangdid not adhere to the conventions used for extended numbering. 1102de3b87aSKai Wang.It Bq Er ELF_E_VERSION 1112de3b87aSKai WangThe ELF descriptor 1122de3b87aSKai Wang.Ar elf 1132de3b87aSKai Wanghad an unsupported ELF version number. 1142de3b87aSKai Wang.El 1152de3b87aSKai Wang.Sh SEE ALSO 1162de3b87aSKai Wang.Xr elf 3 , 1172de3b87aSKai Wang.Xr elf32_newehdr 3 , 1182de3b87aSKai Wang.Xr elf64_newehdr 3 , 1192de3b87aSKai Wang.Xr elf_flagehdr 3 , 1202de3b87aSKai Wang.Xr elf_getident 3 , 1212de3b87aSKai Wang.Xr gelf 3 , 1222de3b87aSKai Wang.Xr gelf_newehdr 3 , 1232de3b87aSKai Wang.Xr elf 5 124