Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/taskdump/symtab.c

    r1d6dd2a r8e3498b  
    4141#include <stddef.h>
    4242#include <errno.h>
    43 #include <str.h>
    44 #include <str_error.h>
    4543#include <vfs/vfs.h>
    4644
    4745#include "include/symtab.h"
    4846
    49 static errno_t elf_hdr_check(elf_header_t *hdr);
    50 static errno_t section_hdr_load(int fd, const elf_header_t *ehdr, int idx,
     47static int elf_hdr_check(elf_header_t *hdr);
     48static int section_hdr_load(int fd, const elf_header_t *ehdr, int idx,
    5149    elf_section_header_t *shdr);
    52 static errno_t chunk_load(int fd, off64_t start, size_t size, void **ptr);
     50static int chunk_load(int fd, off64_t start, size_t size, void **ptr);
    5351
    5452/** Load symbol table from an ELF file.
     
    6058 *                      ENOTSUP if file parsing failed.
    6159 */
    62 errno_t symtab_load(const char *file_name, symtab_t **symtab)
     60int symtab_load(const char *file_name, symtab_t **symtab)
    6361{
    6462        symtab_t *stab;
     
    7270
    7371        int fd;
    74         errno_t rc;
     72        int rc;
    7573        size_t nread;
    7674        int i;
     
    8482                return ENOMEM;
    8583
    86         rc = vfs_lookup_open(file_name, WALK_REGULAR, MODE_READ, &fd);
    87         if (rc != EOK) {
    88                 printf("failed opening file '%s': %s\n", file_name, str_error(rc));
     84        fd = vfs_lookup_open(file_name, WALK_REGULAR, MODE_READ);
     85        if (fd < 0) {
     86                printf("failed opening file\n");
    8987                free(stab);
    9088                return ENOENT;
     
    205203 * @return      EOK on success, ENOENT if no such symbol was found.
    206204 */
    207 errno_t symtab_name_to_addr(symtab_t *st, const char *name, uintptr_t *addr)
     205int symtab_name_to_addr(symtab_t *st, const char *name, uintptr_t *addr)
    208206{
    209207        size_t i;
     
    242240 * @return      EOK on success or ENOENT if no matching symbol was found.
    243241 */
    244 errno_t symtab_addr_to_name(symtab_t *st, uintptr_t addr, char **name,
     242int symtab_addr_to_name(symtab_t *st, uintptr_t addr, char **name,
    245243    size_t *offs)
    246244{
     
    286284/** Check if ELF header is valid.
    287285 *
    288  * @return      EOK on success or an error code.
    289  */
    290 static errno_t elf_hdr_check(elf_header_t *ehdr)
     286 * @return      EOK on success or negative error code.
     287 */
     288static int elf_hdr_check(elf_header_t *ehdr)
    291289{
    292290        /* TODO */
     
    303301 * @return              EOK on success or EIO if I/O failed.
    304302 */
    305 static errno_t section_hdr_load(int fd, const elf_header_t *elf_hdr, int idx,
     303static int section_hdr_load(int fd, const elf_header_t *elf_hdr, int idx,
    306304    elf_section_header_t *sec_hdr)
    307305{
    308         errno_t rc;
     306        int rc;
    309307        size_t nread;
    310308        aoff64_t pos = elf_hdr->e_shoff + idx * sizeof(elf_section_header_t);
     
    328326 * @return              EOK on success or EIO on failure.
    329327 */
    330 static errno_t chunk_load(int fd, off64_t start, size_t size, void **ptr)
    331 {
    332         errno_t rc;
     328static int chunk_load(int fd, off64_t start, size_t size, void **ptr)
     329{
     330        int rc;
    333331        size_t nread;
    334332        aoff64_t pos = start;
Note: See TracChangeset for help on using the changeset viewer.