xref: /netbsd-src/external/bsd/elftoolchain/dist/libelf/elf_getarhdr.3 (revision 5ac3bc719ce6e70593039505b491894133237d12)
1*5ac3bc71Schristos.\"	$NetBSD: elf_getarhdr.3,v 1.6 2024/03/03 17:37:33 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: elf_getarhdr.3 3955 2022-03-12 12:24:36Z jkoshy
279dd9d0cfSchristos.\"
289dd9d0cfSchristos.Dd August 15, 2006
299dd9d0cfSchristos.Dt ELF_GETARHDR 3
30c5261b83Sjkoshy.Os
319dd9d0cfSchristos.Sh NAME
329dd9d0cfSchristos.Nm elf_getarhdr
339dd9d0cfSchristos.Nd retrieve ar(1) header for an archive member
349dd9d0cfSchristos.Sh LIBRARY
359dd9d0cfSchristos.Lb libelf
369dd9d0cfSchristos.Sh SYNOPSIS
379dd9d0cfSchristos.In libelf.h
389dd9d0cfSchristos.Ft "Elf_Arhdr *"
399dd9d0cfSchristos.Fn elf_getarhdr "Elf *elf"
409dd9d0cfSchristos.Sh DESCRIPTION
419dd9d0cfSchristosThe
429dd9d0cfSchristos.Fn elf_getarhdr
439dd9d0cfSchristosfunction returns a pointer to an archive member header for
449dd9d0cfSchristosa descriptor
453f622274Sjkoshy.Fa elf .
469dd9d0cfSchristosThis descriptor must have been returned by a prior call to
479dd9d0cfSchristos.Xr elf_begin 3 ,
489dd9d0cfSchristosand must be a descriptor for a member inside an
499dd9d0cfSchristos.Xr ar 1
509dd9d0cfSchristosarchive.
519dd9d0cfSchristos.Pp
529dd9d0cfSchristosStructure
539dd9d0cfSchristos.Vt Elf_Arhdr
549dd9d0cfSchristosincludes the following members:
559dd9d0cfSchristos.Bl -tag -width indent
569dd9d0cfSchristos.It Vt "char *" Va ar_name
579dd9d0cfSchristosA pointer to a null terminated string containing the translated
589dd9d0cfSchristosname of the archive member.
599dd9d0cfSchristos.It Vt "char *" Va ar_rawname
609dd9d0cfSchristosA pointer to a null terminated string containing the untranslated
619dd9d0cfSchristosname for the archive member, including all
629dd9d0cfSchristos.Xr ar 1
639dd9d0cfSchristosformatting characters and trailing white space.
649dd9d0cfSchristos.It Vt time_t Va ar_date
659dd9d0cfSchristosThe timestamp associated with the member.
669dd9d0cfSchristos.It Vt uid_t Va ar_uid
679dd9d0cfSchristosThe uid of the creator of the member.
689dd9d0cfSchristos.It Vt gid_t Va ar_gid
699dd9d0cfSchristosThe gid of the creator of the member.
709dd9d0cfSchristos.It Vt mode_t Va ar_mode
719dd9d0cfSchristosThe file mode of the member.
729dd9d0cfSchristos.It Vt size_t Va ar_size
739dd9d0cfSchristosThe size of the member in bytes.
749dd9d0cfSchristos.El
759dd9d0cfSchristos.Sh RETURN VALUES
769dd9d0cfSchristosThis function returns a valid pointer to an
779dd9d0cfSchristos.Vt Elf_Arhdr
78c5261b83Sjkoshystructure if successful, or
79c5261b83Sjkoshy.Dv NULL
80c5261b83Sjkoshyif an error is encountered.
819dd9d0cfSchristos.Sh ERRORS
829dd9d0cfSchristosFunction
839dd9d0cfSchristos.Fn elf_getarhdr
849dd9d0cfSchristosmay fail with the following errors:
859dd9d0cfSchristos.Bl -tag -width "[ELF_E_RESOURCE]"
869dd9d0cfSchristos.It Bq Er ELF_E_ARGUMENT
879dd9d0cfSchristosArgument
883f622274Sjkoshy.Fa elf
89c5261b83Sjkoshywas
90c5261b83Sjkoshy.Dv NULL .
919dd9d0cfSchristos.It Bq Er ELF_E_ARGUMENT
929dd9d0cfSchristosArgument
933f622274Sjkoshy.Fa elf
949dd9d0cfSchristoswas not a descriptor for a member of an
959dd9d0cfSchristos.Xr ar 1
969dd9d0cfSchristosarchive.
979dd9d0cfSchristos.El
989dd9d0cfSchristos.Sh SEE ALSO
999dd9d0cfSchristos.Xr elf 3 ,
1009dd9d0cfSchristos.Xr elf_begin 3 ,
1019dd9d0cfSchristos.Xr elf_getarsym 3 ,
1029dd9d0cfSchristos.Xr elf_memory 3
103