Ignore:
File:
1 edited

Legend:

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

    r6afc9d7 rce04ea44  
    4141#include <errno.h>
    4242#include <sys/types.h>
    43 #include <sys/stat.h>
    44 #include <fcntl.h>
     43#include <vfs/vfs.h>
    4544
    4645#include "include/symtab.h"
     
    6867        char *shstrt, *sec_name;
    6968        void *data;
     69        aoff64_t pos = 0;
    7070
    7171        int fd;
     
    8181                return ENOMEM;
    8282
    83         fd = open(file_name, O_RDONLY);
     83        fd = vfs_lookup_open(file_name, WALK_REGULAR, MODE_READ);
    8484        if (fd < 0) {
    8585                printf("failed opening file\n");
     
    8888        }
    8989
    90         rc = read(fd, &elf_hdr, sizeof(elf_header_t));
     90        rc = vfs_read(fd, &pos, &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         close(fd);
     167        vfs_put(fd);
    168168
    169169        if (stab->sym == NULL || stab->strtab == NULL) {
     
    304304{
    305305        int rc;
    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));
     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));
    313309        if (rc != sizeof(elf_section_header_t))
    314310                return EIO;
     
    331327{
    332328        ssize_t rc;
    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         }
     329        aoff64_t pos = start;
    341330
    342331        *ptr = malloc(size);
     
    346335        }
    347336
    348         rc = read(fd, *ptr, size);
     337        rc = vfs_read(fd, &pos, *ptr, size);
    349338        if (rc != (ssize_t) size) {
    350339                printf("failed reading chunk\n");
Note: See TracChangeset for help on using the changeset viewer.