1.\"	$NetBSD: gelf_fsize.3,v 1.2 2014/03/09 16:58:04 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: gelf_fsize.3 317 2009-03-06 17:29:22Z jkoshy
27.\"
28.Dd February 5, 2008
29.Os
30.Dt GELF_FSIZE 3
31.Sh NAME
32.Nm gelf_fsize ,
33.Nm elf32_fsize ,
34.Nm elf64_fsize
35.Nd return the size of a file type
36.Sh LIBRARY
37.Lb libelf
38.Sh SYNOPSIS
39.In libelf.h
40.Ft size_t
41.Fn elf32_fsize "Elf_Type type" "size_t count" "unsigned int version"
42.Ft size_t
43.Fn elf64_fsize "Elf_Type type" "size_t count" "unsigned int version"
44.In gelf.h
45.Ft size_t
46.Fn gelf_fsize "Elf *elf" "Elf_Type type" "size_t count" "unsigned int version"
47.Sh DESCRIPTION
48These functions return the size in bytes of the file representation of
49.Ar count
50numbers of objects of ELF type
51.Ar type .
52For ELF types that are of variable length, these functions return a
53size of one byte.
54.Pp
55Functions
56.Fn elf32_fsize
57and
58.Fn elf64_fsize
59return sizes for files of class
60.Dv ELFCLASS32
61and
62.Dv ELFCLASS64
63respectively.
64Function
65.Fn gelf_fsize
66returns the size for the class of ELF descriptor
67.Ar elf .
68.Sh RETURN VALUES
69These functions return a non-zero value in case of success, or zero in
70case of an error.
71.Sh ERRORS
72These functions may fail with:
73.Bl -tag -width "[ELF_E_RESOURCE]"
74.It Bq Er ELF_E_ARGUMENT
75Argument
76.Ar elf
77was NULL in a call to
78.Fn gelf_fsize .
79.It Bq Er ELF_E_ARGUMENT
80ELF descriptor
81.Ar elf
82had an unknown ELF class.
83.It Bq Er ELF_E_ARGUMENT
84Argument
85.Ar type
86contained an illegal value.
87.It Bq Er ELF_E_UNIMPL
88Support for ELF type
89.Ar type
90has not been implemented.
91.It Bq Er ELF_E_VERSION
92Argument
93.Ar version
94is not a supported version.
95.El
96.Sh SEE ALSO
97.Xr elf 3 ,
98.Xr gelf 3
99