ELF\_GETARHDR(3) Libelf Programmer's Manual ELF\_GETARHDR(3)

# [NAME](#NAME)

elf\_getarhdr - retrieve archive member header information

# [SYNOPSIS](#SYNOPSIS)

```
#include <libelf.h>
Elf_Arhdr *elf_getarhdr(Elf *elf);
```

# [DESCRIPTION](#DESCRIPTION)

Return a **Elf\_Arhdr \*** describing the archive header of the archive member currently referred to by an ELF descriptor.

The **Elf\_Arhdr** structure is defined as:

```
typedef struct {


  char *ar_name;                /* Name of archive member.  */


  time_t ar_date;               /* File date.  */


  uid_t ar_uid;                 /* User ID.  */


  gid_t ar_gid;                 /* Group ID.  */


  mode_t ar_mode;               /* File mode.  */


  int64_t ar_size;              /* File size.  */


  char *ar_rawname;             /* Original name of archive member.  */
} Elf_Arhdr;
```

# [PARAMETERS](#PARAMETERS)

[*elf*](#elf)

An ELF descriptor referring to a member of an archive file.

# [RETURN VALUE](#RETURN_VALUE)

If *elf* refers to an archive member, **elf\_getarhdr()** returns a pointer to its archive header. This pointer is valid until *elf* or the parent archive Elf descriptor are closed using **elf\_end()**. If *elf* does not refer to an archive member or the header cannot be acquired then NULL is returned.

# [SEE ALSO](#SEE_ALSO)

[**elf\_begin**(3)](/man/os/elfutils/elf_begin.3), [**elf\_getaroff**(3)](/man/os/elfutils/elf_getaroff.3), [**elf\_next**(3)](/man/os/elfutils/elf_next.3), [**elf\_rand**(3)](/man/os/elfutils/elf_rand.3), [**libelf**(3)](/man/os/elfutils/libelf.3), [**elf**(5)](/man/os/elfutils/elf.5)

# [ATTRIBUTES](#ATTRIBUTES)

**Interface** **Attribute** **Value** elf\_getarhdr () Thread safety MT-safe

# [REPORTING BUGS](#REPORTING_BUGS)

Report bugs to &lt;elfutils-devel@sourceware.org&gt; or https://sourceware.org/bugzilla/.

2025-06-06 Libelf

---

Document: elf_getarhdr(3) from elfutils 0.196-r1 (Chainguard OS)
Source: https://sourceware.org/git/elfutils.git
