Changeset 132ab5d1 in mainline for uspace/app/taskdump/elf_core.c
- Timestamp:
- 2018-01-30T03:20:45Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5a6cc679
- Parents:
- 8bfb163 (diff), 6a5d05b (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
-
uspace/app/taskdump/elf_core.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/taskdump/elf_core.c
r8bfb163 r132ab5d1 55 55 #include <stddef.h> 56 56 #include <errno.h> 57 #include <str_error.h> 57 58 #include <mem.h> 58 59 #include <as.h> … … 97 98 98 99 int fd; 99 ssize_t rc; 100 int rc; 101 size_t nwr; 100 102 unsigned int i; 101 103 … … 122 124 } 123 125 124 fd= vfs_lookup_open(file_name, WALK_REGULAR | WALK_MAY_CREATE,125 MODE_WRITE );126 if ( fd < 0) {127 printf("Failed opening file .\n");126 rc = vfs_lookup_open(file_name, WALK_REGULAR | WALK_MAY_CREATE, 127 MODE_WRITE, &fd); 128 if (rc != EOK) { 129 printf("Failed opening file '%s': %s.\n", file_name, str_error(rc)); 128 130 free(p_hdr); 129 131 return ENOENT; … … 206 208 } 207 209 208 rc = vfs_write(fd, &pos, &elf_hdr, sizeof(elf_hdr) );209 if (rc != sizeof(elf_hdr)) {210 rc = vfs_write(fd, &pos, &elf_hdr, sizeof(elf_hdr), &nwr); 211 if (rc != EOK) { 210 212 printf("Failed writing ELF header.\n"); 211 213 free(p_hdr); … … 214 216 215 217 for (i = 0; i < n_ph; ++i) { 216 rc = vfs_write(fd, &pos, &p_hdr[i], sizeof(p_hdr[i]) );217 if (rc != sizeof(p_hdr[i])) {218 rc = vfs_write(fd, &pos, &p_hdr[i], sizeof(p_hdr[i]), &nwr); 219 if (rc != EOK) { 218 220 printf("Failed writing program header.\n"); 219 221 free(p_hdr); … … 231 233 note.type = NT_PRSTATUS; 232 234 233 rc = vfs_write(fd, &pos, ¬e, sizeof(elf_note_t) );234 if (rc != sizeof(elf_note_t)) {235 rc = vfs_write(fd, &pos, ¬e, sizeof(elf_note_t), &nwr); 236 if (rc != EOK) { 235 237 printf("Failed writing note header.\n"); 236 238 free(p_hdr); … … 238 240 } 239 241 240 rc = vfs_write(fd, &pos, "CORE", note.namesz );241 if (rc != (ssize_t) note.namesz) {242 rc = vfs_write(fd, &pos, "CORE", note.namesz, &nwr); 243 if (rc != EOK) { 242 244 printf("Failed writing note header.\n"); 243 245 free(p_hdr); … … 247 249 pos = ALIGN_UP(pos, word_size); 248 250 249 rc = vfs_write(fd, &pos, &pr_status, sizeof(elf_prstatus_t) );250 if (rc != sizeof(elf_prstatus_t)) {251 rc = vfs_write(fd, &pos, &pr_status, sizeof(elf_prstatus_t), &nwr); 252 if (rc != EOK) { 251 253 printf("Failed writing register data.\n"); 252 254 free(p_hdr); … … 296 298 size_t total; 297 299 uintptr_t addr; 298 ssize_t rc; 300 int rc; 301 size_t nwr; 299 302 300 303 addr = area->start_addr; … … 304 307 to_copy = min(area->size - total, BUFFER_SIZE); 305 308 rc = udebug_mem_read(sess, buffer, addr, to_copy); 306 if (rc < 0) {309 if (rc != EOK) { 307 310 printf("Failed reading task memory.\n"); 308 311 return EIO; 309 312 } 310 313 311 rc = vfs_write(fd, pos, buffer, to_copy );312 if (rc != (ssize_t) to_copy) {314 rc = vfs_write(fd, pos, buffer, to_copy, &nwr); 315 if (rc != EOK) { 313 316 printf("Failed writing memory contents.\n"); 314 317 return EIO;
Note:
See TracChangeset
for help on using the changeset viewer.
