xref: /netbsd-src/external/bsd/elftoolchain/dist/libelf/gelf_getcap.3 (revision 5ac3bc719ce6e70593039505b491894133237d12)
1*5ac3bc71Schristos.\"	$NetBSD: gelf_getcap.3,v 1.6 2024/03/03 17:37:34 christos Exp $
2e81373b4Schristos.\"
39dd9d0cfSchristos.\" Copyright (c) 2006,2008 Joseph Koshy.  All rights reserved.
49dd9d0cfSchristos.\"
59dd9d0cfSchristos.\" Redistribution and use in source and binary forms, with or without
69dd9d0cfSchristos.\" modification, are permitted provided that the following conditions
79dd9d0cfSchristos.\" are met:
89dd9d0cfSchristos.\" 1. Redistributions of source code must retain the above copyright
99dd9d0cfSchristos.\"    notice, this list of conditions and the following disclaimer.
109dd9d0cfSchristos.\" 2. Redistributions in binary form must reproduce the above copyright
119dd9d0cfSchristos.\"    notice, this list of conditions and the following disclaimer in the
129dd9d0cfSchristos.\"    documentation and/or other materials provided with the distribution.
139dd9d0cfSchristos.\"
149dd9d0cfSchristos.\" This software is provided by Joseph Koshy ``as is'' and
159dd9d0cfSchristos.\" any express or implied warranties, including, but not limited to, the
169dd9d0cfSchristos.\" implied warranties of merchantability and fitness for a particular purpose
179dd9d0cfSchristos.\" are disclaimed.  in no event shall Joseph Koshy be liable
189dd9d0cfSchristos.\" for any direct, indirect, incidental, special, exemplary, or consequential
199dd9d0cfSchristos.\" damages (including, but not limited to, procurement of substitute goods
209dd9d0cfSchristos.\" or services; loss of use, data, or profits; or business interruption)
219dd9d0cfSchristos.\" however caused and on any theory of liability, whether in contract, strict
229dd9d0cfSchristos.\" liability, or tort (including negligence or otherwise) arising in any way
239dd9d0cfSchristos.\" out of the use of this software, even if advised of the possibility of
249dd9d0cfSchristos.\" such damage.
259dd9d0cfSchristos.\"
263f622274Sjkoshy.\" Id: gelf_getcap.3 3958 2022-03-12 14:31:32Z jkoshy
279dd9d0cfSchristos.\"
28c5261b83Sjkoshy.Dd April 22, 2019
299dd9d0cfSchristos.Dt GELF_GETCAP 3
30c5261b83Sjkoshy.Os
319dd9d0cfSchristos.Sh NAME
329dd9d0cfSchristos.Nm gelf_getcap ,
339dd9d0cfSchristos.Nm gelf_update_cap
349dd9d0cfSchristos.Nd read and update ELF capability information
359dd9d0cfSchristos.Sh LIBRARY
369dd9d0cfSchristos.Lb libelf
379dd9d0cfSchristos.Sh SYNOPSIS
389dd9d0cfSchristos.In gelf.h
399dd9d0cfSchristos.Ft "GElf_Cap *"
409dd9d0cfSchristos.Fn gelf_getcap "Elf_Data *data" "int ndx" "GElf_Cap *cap"
419dd9d0cfSchristos.Ft int
429dd9d0cfSchristos.Fn gelf_update_cap "Elf_Data *data" "int ndx" "GElf_Cap *cap"
439dd9d0cfSchristos.Sh DESCRIPTION
449dd9d0cfSchristosThese convenience functions are used to retrieve and update class-dependent
459dd9d0cfSchristos.Vt Elf32_Cap
469dd9d0cfSchristosor
479dd9d0cfSchristos.Vt Elf64_Cap
489dd9d0cfSchristosinformation.
499dd9d0cfSchristos.Pp
509dd9d0cfSchristosArgument
513f622274Sjkoshy.Fa data
529dd9d0cfSchristosis an
539dd9d0cfSchristos.Vt Elf_Data
549dd9d0cfSchristosdescriptor associated with a section of type
559dd9d0cfSchristos.Dv SHT_SUNW_cap .
569dd9d0cfSchristosArgument
573f622274Sjkoshy.Fa ndx
589dd9d0cfSchristosis the index of the entry being retrieved or updated.
599dd9d0cfSchristosThe class-independent
609dd9d0cfSchristos.Vt GElf_Cap
619dd9d0cfSchristosstructure is described in
629dd9d0cfSchristos.Xr gelf 3 .
639dd9d0cfSchristos.Pp
649dd9d0cfSchristosFunction
659dd9d0cfSchristos.Fn gelf_getcap
669dd9d0cfSchristosretrieves the class-dependent entry at index
673f622274Sjkoshy.Fa ndx
689dd9d0cfSchristosin data buffer
693f622274Sjkoshy.Fa data
709dd9d0cfSchristosand copies it to the destination pointed to by argument
713f622274Sjkoshy.Fa cap
729dd9d0cfSchristosafter translation to class-independent form.
739dd9d0cfSchristos.Pp
749dd9d0cfSchristosFunction
759dd9d0cfSchristos.Fn gelf_update_cap
769dd9d0cfSchristosconverts the class-independent entry pointed to
779dd9d0cfSchristosby argument
783f622274Sjkoshy.Fa cap
799dd9d0cfSchristosto class-dependent form, and writes it to the entry at index
803f622274Sjkoshy.Fa ndx
819dd9d0cfSchristosin the data buffer described by argument
823f622274Sjkoshy.Fa data .
839dd9d0cfSchristosFunction
849dd9d0cfSchristos.Fn gelf_update_cap
859dd9d0cfSchristossignals an error if any of the values in the class-independent
869dd9d0cfSchristosrepresentation exceeds the representable limits of the target
879dd9d0cfSchristostype.
889dd9d0cfSchristos.Sh RETURN VALUES
899dd9d0cfSchristosFunction
909dd9d0cfSchristos.Fn gelf_getcap
919dd9d0cfSchristosreturns the value of argument
923f622274Sjkoshy.Fa cap
93c5261b83Sjkoshyif successful, or
94c5261b83Sjkoshy.Dv NULL
95c5261b83Sjkoshyin case of an error.
969dd9d0cfSchristosFunction
979dd9d0cfSchristos.Fn gelf_update_cap
989dd9d0cfSchristosreturns a non-zero value if successful, or zero in case of an error.
999dd9d0cfSchristos.Sh ERRORS
1009dd9d0cfSchristosThese functions may fail with the following errors:
1019dd9d0cfSchristos.Bl -tag -width "[ELF_E_RESOURCE]"
1029dd9d0cfSchristos.It Bq Er ELF_E_ARGUMENT
1039dd9d0cfSchristosArguments
1043f622274Sjkoshy.Fa data
1059dd9d0cfSchristosor
1063f622274Sjkoshy.Fa cap
107c5261b83Sjkoshywere
108c5261b83Sjkoshy.Dv NULL .
1099dd9d0cfSchristos.It Bq Er ELF_E_ARGUMENT
1109dd9d0cfSchristosArgument
1113f622274Sjkoshy.Fa ndx
1129dd9d0cfSchristoswas less than zero or larger than the number of entries in the data
1139dd9d0cfSchristosdescriptor.
1149dd9d0cfSchristos.It Bq Er ELF_E_ARGUMENT
1159dd9d0cfSchristosData descriptor
1163f622274Sjkoshy.Fa data
1179dd9d0cfSchristoswas not associated with a section of type
1189dd9d0cfSchristos.Dv SHT_SUNW_cap .
1199dd9d0cfSchristos.It Bq Er ELF_E_RANGE
1209dd9d0cfSchristosA value was not representable in the target type.
121c5261b83Sjkoshy.It Bq Er ELF_E_VERSION
122c5261b83SjkoshyThe
123c5261b83Sjkoshy.Vt Elf_Data
124c5261b83Sjkoshydescriptor denoted by argument
1253f622274Sjkoshy.Fa data
126c5261b83Sjkoshyis associated with an ELF object with an unsupported version.
1279dd9d0cfSchristos.El
1289dd9d0cfSchristos.Sh SEE ALSO
1299dd9d0cfSchristos.Xr elf 3 ,
1309dd9d0cfSchristos.Xr elf_getdata 3 ,
1319dd9d0cfSchristos.Xr elf_getscn 3 ,
1329dd9d0cfSchristos.Xr gelf 3
133