1*0a6a1f1dSLionel Sambuc.\" $NetBSD: elf_version.3,v 1.2 2014/03/09 16:58:04 christos Exp $ 2*0a6a1f1dSLionel Sambuc.\" 3*0a6a1f1dSLionel Sambuc.\" Copyright (c) 2006,2008 Joseph Koshy. All rights reserved. 4*0a6a1f1dSLionel Sambuc.\" 5*0a6a1f1dSLionel Sambuc.\" Redistribution and use in source and binary forms, with or without 6*0a6a1f1dSLionel Sambuc.\" modification, are permitted provided that the following conditions 7*0a6a1f1dSLionel Sambuc.\" are met: 8*0a6a1f1dSLionel Sambuc.\" 1. Redistributions of source code must retain the above copyright 9*0a6a1f1dSLionel Sambuc.\" notice, this list of conditions and the following disclaimer. 10*0a6a1f1dSLionel Sambuc.\" 2. Redistributions in binary form must reproduce the above copyright 11*0a6a1f1dSLionel Sambuc.\" notice, this list of conditions and the following disclaimer in the 12*0a6a1f1dSLionel Sambuc.\" documentation and/or other materials provided with the distribution. 13*0a6a1f1dSLionel Sambuc.\" 14*0a6a1f1dSLionel Sambuc.\" This software is provided by Joseph Koshy ``as is'' and 15*0a6a1f1dSLionel Sambuc.\" any express or implied warranties, including, but not limited to, the 16*0a6a1f1dSLionel Sambuc.\" implied warranties of merchantability and fitness for a particular purpose 17*0a6a1f1dSLionel Sambuc.\" are disclaimed. in no event shall Joseph Koshy be liable 18*0a6a1f1dSLionel Sambuc.\" for any direct, indirect, incidental, special, exemplary, or consequential 19*0a6a1f1dSLionel Sambuc.\" damages (including, but not limited to, procurement of substitute goods 20*0a6a1f1dSLionel Sambuc.\" or services; loss of use, data, or profits; or business interruption) 21*0a6a1f1dSLionel Sambuc.\" however caused and on any theory of liability, whether in contract, strict 22*0a6a1f1dSLionel Sambuc.\" liability, or tort (including negligence or otherwise) arising in any way 23*0a6a1f1dSLionel Sambuc.\" out of the use of this software, even if advised of the possibility of 24*0a6a1f1dSLionel Sambuc.\" such damage. 25*0a6a1f1dSLionel Sambuc.\" 26*0a6a1f1dSLionel Sambuc.\" Id: elf_version.3 2123 2011-11-09 15:40:09Z jkoshy 27*0a6a1f1dSLionel Sambuc.\" 28*0a6a1f1dSLionel Sambuc.Dd November 9, 2011 29*0a6a1f1dSLionel Sambuc.Os 30*0a6a1f1dSLionel Sambuc.Dt ELF_VERSION 3 31*0a6a1f1dSLionel Sambuc.Sh NAME 32*0a6a1f1dSLionel Sambuc.Nm elf_version 33*0a6a1f1dSLionel Sambuc.Nd retrieve or set ELF library operating version 34*0a6a1f1dSLionel Sambuc.Sh LIBRARY 35*0a6a1f1dSLionel Sambuc.Lb libelf 36*0a6a1f1dSLionel Sambuc.Sh SYNOPSIS 37*0a6a1f1dSLionel Sambuc.In libelf.h 38*0a6a1f1dSLionel Sambuc.Ft unsigned int 39*0a6a1f1dSLionel Sambuc.Fn elf_version "unsigned int version" 40*0a6a1f1dSLionel Sambuc.Sh DESCRIPTION 41*0a6a1f1dSLionel SambucThe 42*0a6a1f1dSLionel Sambuc.Fn elf_version 43*0a6a1f1dSLionel Sambucfunction is used to query the current operating version of the ELF 44*0a6a1f1dSLionel Sambuclibrary, and to inform the ELF library about the application's desired 45*0a6a1f1dSLionel Sambucoperating version. 46*0a6a1f1dSLionel Sambuc.Pp 47*0a6a1f1dSLionel SambucIf the argument 48*0a6a1f1dSLionel Sambuc.Ar version 49*0a6a1f1dSLionel Sambucis 50*0a6a1f1dSLionel Sambuc.Dv EV_NONE , 51*0a6a1f1dSLionel Sambucthe 52*0a6a1f1dSLionel Sambuc.Fn elf_version 53*0a6a1f1dSLionel Sambucfunction returns the currently configured operating version for the 54*0a6a1f1dSLionel SambucELF library. 55*0a6a1f1dSLionel Sambuc.Pp 56*0a6a1f1dSLionel SambucIf the argument 57*0a6a1f1dSLionel Sambuc.Ar version 58*0a6a1f1dSLionel Sambucis not 59*0a6a1f1dSLionel Sambuc.Dv EV_NONE , 60*0a6a1f1dSLionel Sambucand if argument 61*0a6a1f1dSLionel Sambuc.Ar version 62*0a6a1f1dSLionel Sambucis supported by the ELF library, function 63*0a6a1f1dSLionel Sambuc.Fn elf_version 64*0a6a1f1dSLionel Sambucsets the library's operating version to 65*0a6a1f1dSLionel Sambuc.Ar version , 66*0a6a1f1dSLionel Sambucand returns the previous value of the operating version. 67*0a6a1f1dSLionel SambucIf argument 68*0a6a1f1dSLionel Sambuc.Ar version 69*0a6a1f1dSLionel Sambuccannot be supported, then the 70*0a6a1f1dSLionel Sambuc.Fn elf_version 71*0a6a1f1dSLionel Sambucfunction returns 72*0a6a1f1dSLionel Sambuc.Dv EV_NONE . 73*0a6a1f1dSLionel Sambuc.Sh RETURN VALUES 74*0a6a1f1dSLionel SambucThe 75*0a6a1f1dSLionel Sambuc.Fn elf_version 76*0a6a1f1dSLionel Sambucfunction returns the currently configured ELF library version, or 77*0a6a1f1dSLionel Sambuc.Dv EV_NONE 78*0a6a1f1dSLionel Sambucif an unsupported version is requested. 79*0a6a1f1dSLionel Sambuc.Sh EXAMPLES 80*0a6a1f1dSLionel SambucAn application program would inform the ELF library about its desired 81*0a6a1f1dSLionel Sambucoperating version and check for an error using the following code 82*0a6a1f1dSLionel Sambucsnippet: 83*0a6a1f1dSLionel Sambuc.Bd -literal -offset indent 84*0a6a1f1dSLionel Sambucif (elf_version(EV_CURRENT) == EV_NONE) 85*0a6a1f1dSLionel Sambuc err(EXIT_FAILURE, "ELF library too old"); 86*0a6a1f1dSLionel Sambuc.Ed 87*0a6a1f1dSLionel Sambuc.Sh ERRORS 88*0a6a1f1dSLionel SambucFunction 89*0a6a1f1dSLionel Sambuc.Fn elf_version 90*0a6a1f1dSLionel Sambucmay fail with the following error: 91*0a6a1f1dSLionel Sambuc.Bl -tag -width "[ELF_E_RESOURCE]" 92*0a6a1f1dSLionel Sambuc.It Bq Er "ELF_E_VERSION" 93*0a6a1f1dSLionel SambucAn unsupported library version number was requested. 94*0a6a1f1dSLionel Sambuc.El 95*0a6a1f1dSLionel Sambuc.Sh SEE ALSO 96*0a6a1f1dSLionel Sambuc.Xr elf 3 , 97*0a6a1f1dSLionel Sambuc.Xr gelf 3 98