Changeset 368ee04 in mainline for uspace/app/taskdump/symtab.c
- Timestamp:
- 2017-04-05T18:10:39Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- 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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/taskdump/symtab.c
r39f892a9 r368ee04 41 41 #include <errno.h> 42 42 #include <sys/types.h> 43 #include <sys/stat.h> 44 #include <fcntl.h> 43 #include <vfs/vfs.h> 45 44 46 45 #include "include/symtab.h" … … 68 67 char *shstrt, *sec_name; 69 68 void *data; 69 aoff64_t pos = 0; 70 70 71 71 int fd; … … 81 81 return ENOMEM; 82 82 83 fd = open(file_name, O_RDONLY);83 fd = vfs_lookup_open(file_name, WALK_REGULAR, MODE_READ); 84 84 if (fd < 0) { 85 85 printf("failed opening file\n"); … … 88 88 } 89 89 90 rc = read(fd, &elf_hdr, sizeof(elf_header_t));90 rc = vfs_read(fd, &pos, &elf_hdr, sizeof(elf_header_t)); 91 91 if (rc != sizeof(elf_header_t)) { 92 92 printf("failed reading elf header\n"); … … 165 165 166 166 free(shstrt); 167 close(fd);167 vfs_put(fd); 168 168 169 169 if (stab->sym == NULL || stab->strtab == NULL) { … … 304 304 { 305 305 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)); 313 309 if (rc != sizeof(elf_section_header_t)) 314 310 return EIO; … … 331 327 { 332 328 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; 341 330 342 331 *ptr = malloc(size); … … 346 335 } 347 336 348 rc = read(fd, *ptr, size);337 rc = vfs_read(fd, &pos, *ptr, size); 349 338 if (rc != (ssize_t) size) { 350 339 printf("failed reading chunk\n");
Note:
See TracChangeset
for help on using the changeset viewer.