1.\" $NetBSD: elf_getbase.3,v 1.2 2014/03/09 16:58:04 christos Exp $ 2.\" 3.\" Copyright (c) 2006,2008,2010 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_getbase.3 978 2010-06-06 12:40:19Z jkoshy 27.\" 28.Dd June 6, 2010 29.Os 30.Dt ELF_GETBASE 3 31.Sh NAME 32.Nm elf_getbase 33.Nd get the base offset for an object file 34.Sh LIBRARY 35.Lb libelf 36.Sh SYNOPSIS 37.In libelf.h 38.Ft off_t 39.Fn elf_getbase "Elf *elf" 40.Sh DESCRIPTION 41Function 42.Fn elf_getbase 43returns the file offset to the first byte of the object referenced by ELF 44descriptor 45.Ar elf . 46.Pp 47For descriptors referencing members of archives, the returned offset is 48the file offset of the member in its containing archive. 49For descriptors to regular objects, the returned offset is (vacuously) 50zero. 51.Sh RETURN VALUES 52Function 53.Fn elf_getbase 54returns a valid file offset if successful, or 55.Pq Vt off_t 56.Li -1 57in case of an error. 58.Sh ERRORS 59Function 60.Fn elf_getbase 61may fail with the following errors: 62.Bl -tag -width "[ELF_E_RESOURCE]" 63.It Bq Er ELF_E_ARGUMENT 64Argument 65.Ar elf 66was NULL. 67.El 68.Sh SEE ALSO 69.Xr elf 3 , 70.Xr elf_getarhdr 3 , 71.Xr elf_getident 3 , 72.Xr elf_rawfile 3 , 73.Xr gelf 3 74