xref: /netbsd-src/external/bsd/elftoolchain/dist/libelf/elf_end.3 (revision 5ac3bc719ce6e70593039505b491894133237d12)
1.\"	$NetBSD: elf_end.3,v 1.6 2024/03/03 17:37:33 christos Exp $
2.\"
3.\" Copyright (c) 2006,2008 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 Joseph Koshy ``as is'' and
15.\" any express or implied warranties, including, but not limited to, the
16.\" implied warranties of merchantability and fitness for a particular purpose
17.\" are disclaimed.  in no event shall Joseph Koshy be liable
18.\" for any direct, indirect, incidental, special, exemplary, or consequential
19.\" damages (including, but not limited to, procurement of substitute goods
20.\" or services; loss of use, data, or profits; or business interruption)
21.\" however caused and on any theory of liability, whether in contract, strict
22.\" liability, or tort (including negligence or otherwise) arising in any way
23.\" out of the use of this software, even if advised of the possibility of
24.\" such damage.
25.\"
26.\" Id: elf_end.3 3954 2022-03-12 12:07:16Z jkoshy
27.\"
28.Dd June 29, 2006
29.Dt ELF_END 3
30.Os
31.Sh NAME
32.Nm elf_end
33.Nd release an ELF descriptor
34.Sh LIBRARY
35.Lb libelf
36.Sh SYNOPSIS
37.In libelf.h
38.Ft int
39.Fn elf_end "Elf *elf"
40.Sh DESCRIPTION
41Function
42.Fn elf_end
43is used to release the resources associated with an ELF descriptor
44pointed to by argument
45.Fa elf .
46This descriptor must have been allocated by a previous call to
47.Xr elf_begin 3
48or
49.Xr elf_memory 3 .
50For programming convenience, a
51.Dv NULL
52value is permitted for argument
53.Fa elf .
54.Pp
55A call to
56.Fn elf_end
57decrements the activation count for descriptor
58.Fa elf
59by one.
60The resources associated with the descriptor are only released
61with its activation count goes to zero.
62.Pp
63Once function
64.Fn elf_end
65returns zero, the ELF descriptor
66.Fa elf
67will no longer be valid and should not be used further.
68.Sh RETURN VALUES
69Function
70.Fn elf_end
71returns the current value of the ELF descriptor
72.Fa elf Ap s
73activation count, or zero if argument
74.Fa elf
75was
76.Dv NULL .
77.Sh SEE ALSO
78.Xr elf 3 ,
79.Xr elf_begin 3 ,
80.Xr elf_memory 3 ,
81.Xr gelf 3
82