1*4639c15bSchristos.\" $NetBSD: elf_getversion.3,v 1.1.1.1 2024/03/03 14:41:47 christos Exp $ 2*4639c15bSchristos.\" 3*4639c15bSchristos.\" Copyright (c) 2021 Joseph Koshy. All rights reserved. 4*4639c15bSchristos.\" 5*4639c15bSchristos.\" Redistribution and use in source and binary forms, with or without 6*4639c15bSchristos.\" modification, are permitted provided that the following conditions 7*4639c15bSchristos.\" are met: 8*4639c15bSchristos.\" 1. Redistributions of source code must retain the above copyright 9*4639c15bSchristos.\" notice, this list of conditions and the following disclaimer. 10*4639c15bSchristos.\" 2. Redistributions in binary form must reproduce the above copyright 11*4639c15bSchristos.\" notice, this list of conditions and the following disclaimer in the 12*4639c15bSchristos.\" documentation and/or other materials provided with the distribution. 13*4639c15bSchristos.\" 14*4639c15bSchristos.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' 15*4639c15bSchristos.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16*4639c15bSchristos.\" THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17*4639c15bSchristos.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS 18*4639c15bSchristos.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 19*4639c15bSchristos.\" OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 20*4639c15bSchristos.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21*4639c15bSchristos.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22*4639c15bSchristos.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 23*4639c15bSchristos.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 24*4639c15bSchristos.\" THE POSSIBILITY OF SUCH DAMAGE. 25*4639c15bSchristos.\" 26*4639c15bSchristos.\" Id: elf_getversion.3 3956 2022-03-12 12:39:30Z jkoshy 27*4639c15bSchristos.\" 28*4639c15bSchristos.Dd March 7, 2021 29*4639c15bSchristos.Dt ELF_GETVERSION 3 30*4639c15bSchristos.Os 31*4639c15bSchristos.Sh NAME 32*4639c15bSchristos.Nm elf_getversion 33*4639c15bSchristos.Nd retrieve the operating version for an ELF object 34*4639c15bSchristos.Sh LIBRARY 35*4639c15bSchristos.Lb libelf 36*4639c15bSchristos.Sh SYNOPSIS 37*4639c15bSchristos.In libelf.h 38*4639c15bSchristos.Ft unsigned int 39*4639c15bSchristos.Fn elf_getversion "Elf *elf" 40*4639c15bSchristos.Sh DESCRIPTION 41*4639c15bSchristos.Em Important : 42*4639c15bSchristosThe function 43*4639c15bSchristos.Fn elf_getversion 44*4639c15bSchristosis an extension to the 45*4639c15bSchristos.Xr ELF 3 46*4639c15bSchristosAPI. 47*4639c15bSchristosApplications that need to be portable to other implementations of 48*4639c15bSchristos.Li libelf 49*4639c15bSchristosshould take care not to use this function. 50*4639c15bSchristos.Pp 51*4639c15bSchristosThe function 52*4639c15bSchristos.Fn elf_getversion 53*4639c15bSchristosreturns the operating version for the ELF descriptor pointed to by 54*4639c15bSchristosargument 55*4639c15bSchristos.Fa elf . 56*4639c15bSchristos.Pp 57*4639c15bSchristosThis descriptor must have been allocated by a previous call to one of 58*4639c15bSchristosthe functions that return an ELF descriptor, such as 59*4639c15bSchristos.Xr elf_begin 3 , 60*4639c15bSchristos.Xr elf_memory 3 , 61*4639c15bSchristos.Xr elf_open 3 62*4639c15bSchristosand 63*4639c15bSchristos.Xr elf_openmemory 3 . 64*4639c15bSchristosThe object associated with the descriptor 65*4639c15bSchristos.Fa elf 66*4639c15bSchristosshould be an ELF object. 67*4639c15bSchristos.Sh RETURN VALUES 68*4639c15bSchristosThe function returns the operating version for the ELF object if 69*4639c15bSchristossuccessful or 70*4639c15bSchristos.Dv EV_NONE 71*4639c15bSchristosif an error occurred. 72*4639c15bSchristos.Sh COMPATIBILITY 73*4639c15bSchristosThis function is an extension to the 74*4639c15bSchristos.Xr ELF 3 75*4639c15bSchristosAPI set. 76*4639c15bSchristos.Sh ERRORS 77*4639c15bSchristosThis function can fail with the following errors: 78*4639c15bSchristos.Bl -tag -width "[ELF_E_ARGUMENT]" 79*4639c15bSchristos.It Bq Er ELF_E_ARGUMENT 80*4639c15bSchristosThe argument 81*4639c15bSchristos.Fa elf 82*4639c15bSchristoswas 83*4639c15bSchristos.Dv NULL . 84*4639c15bSchristos.It Bq Er ELF_E_ARGUMENT 85*4639c15bSchristosThe underlying object referenced by the descriptor 86*4639c15bSchristos.Fa elf 87*4639c15bSchristoswas not an ELF object. 88*4639c15bSchristos.El 89*4639c15bSchristos.Sh SEE ALSO 90*4639c15bSchristos.Xr elf 3 , 91*4639c15bSchristos.Xr elf_begin 3 , 92*4639c15bSchristos.Xr elf_errno 3 , 93*4639c15bSchristos.Xr elf_version 3 94