Ignore:
File:
1 edited

Legend:

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

    rce04ea44 r6afc9d7  
    4141#include <errno.h>
    4242#include <sys/types.h>
    43 #include <vfs/vfs.h>
     43#include <sys/stat.h>
     44#include <fcntl.h>
    4445
    4546#include "include/symtab.h"
     
    6768        char *shstrt, *sec_name;
    6869        void *data;
    69         aoff64_t pos = 0;
    7070
    7171        int fd;
     
    8181                return ENOMEM;
    8282
    83         fd = vfs_lookup_open(file_name, WALK_REGULAR, MODE_READ);
     83        fd = open(file_name, O_RDONLY);
    8484        if (fd < 0) {
    8585                printf("failed opening file\n");
     
    8888        }
    8989
    90         rc = vfs_read(fd, &pos, &elf_hdr, sizeof(elf_header_t));
     90        rc = read(fd, &elf_hdr, sizeof(elf_header_t));
    9191        if (rc != sizeof(elf_header_t)) {
    9292                printf("failed reading elf header\n");
     
    165165
    166166        free(shstrt);
    167         vfs_put(fd);
     167        close(fd);
    168168
    169169        if (stab->sym == NULL || stab->strtab == NULL) {
     
    304304{
    305305        int rc;
    306         aoff64_t pos = elf_hdr->e_shoff + idx * sizeof(elf_section_header_t);
    307 
    308         rc = vfs_read(fd, &pos, sec_hdr, sizeof(elf_section_header_t));
     306
     307        rc = lseek(fd, elf_hdr->e_shoff + idx * sizeof(elf_section_header_t),
     308            SEEK_SET);
     309        if (rc == (off64_t) -1)
     310                return EIO;
     311
     312        rc = read(fd, sec_hdr, sizeof(elf_section_header_t));
    309313        if (rc != sizeof(elf_section_header_t))
    310314                return EIO;
     
    327331{
    328332        ssize_t rc;
    329         aoff64_t pos = start;
     333        off64_t offs;
     334
     335        offs = lseek(fd, start, SEEK_SET);
     336        if (offs == (off64_t) -1) {
     337                printf("failed seeking chunk\n");
     338                *ptr = NULL;
     339                return EIO;
     340        }
    330341
    331342        *ptr = malloc(size);
     
    335346        }
    336347
    337         rc = vfs_read(fd, &pos, *ptr, size);
     348        rc = read(fd, *ptr, size);
    338349        if (rc != (ssize_t) size) {
    339350                printf("failed reading chunk\n");
Note: See TracChangeset for help on using the changeset viewer.