-static
-int bin_info_set_endianness(struct bin_info *bin)
-{
- int ret, fd;
- uint8_t e_ident[EI_NIDENT];
-
- fd = bt_fd_cache_handle_get_fd(bin->elf_handle);
-
- /*
- * Read the identification fields of the elf file.
- */
- if (lseek(fd, 0, SEEK_SET) < 0) {
- BT_LOGE("Error seeking the beginning of ELF file: %s",
- strerror(errno));
- ret = -1;
- goto error;
- }
-
- ret = bt_common_read(fd, e_ident, EI_NIDENT);
- if (ret < EI_NIDENT) {
- BT_LOGE_STR("Error reading the ELF identification fields");
- ret = -1;
- goto error;
- }
-
- /*
- * Set the endianness.
- */
- bin->endianness = e_ident[EI_DATA];
- ret = 0;
-
-error:
- return ret;
-}
-