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