Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 368ee04 in mainline for uspace/app/taskdump/symtab.c


Ignore:
Timestamp:
2017-04-05T18:10:39Z (5 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
93ad8166
Parents:
39f892a9 (diff), 2166728 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge from lp:~jakub/helenos/vfs-2.5-cherrypick

This merge cherry-picks some of the changesets from Jiri Zarevucky's:

lp:~zarevucky-jiri/helenos/vfs-2.5

and then continues independently, yet sometime in a similar vein.

Roughly speaking, Jiri's branch is merged entirely up to its revision
1926 and then cherry-picked on and off until its revision 1965. Among
these changes are:

  • relativization of the API,
  • client-side roots,
  • server-side mounts,
  • inbox for passing arbitrary files from parent to child,
  • some streamlining and cleanup.

Additional changes include:

  • addressing issues introduced by the above changes,
  • client-side I/O cursors (file positions),
  • all HelenOS file system APIs begin with the vfs_ prefix and can be used after including vfs/vfs.h,
  • removal of some POSIX-ish headers and definitions,
  • additional cleanup.
File:
1 edited

Legend:

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

    r39f892a9 r368ee04  
    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.