Changeset 1afa94d in mainline
- Timestamp:
- 2017-12-10T21:08:11Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- dd8ab1c
- Parents:
- c81132d
- Location:
- uspace/lib/c
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/elf/elf_load.c
rc81132d r1afa94d 53 53 * @param file File handle 54 54 * @param info Place to store ELF program information 55 * @return E OK on success or anerror code55 * @return EE_OK on success or an EE_x error code 56 56 */ 57 57 int elf_load(int file, elf_info_t *info) -
uspace/lib/c/generic/elf/elf_mod.c
rc81132d r1afa94d 69 69 "incompatible image", 70 70 "unsupported image type", 71 "irrecoverable error" 71 "irrecoverable error", 72 "file io error" 72 73 }; 73 74 … … 90 91 * extracted from the binary. 91 92 * 92 * @return E OK on success or negativeerror code.93 * @return EE_OK on success or EE_xx error code. 93 94 * 94 95 */ … … 103 104 } 104 105 if (rc != EOK) { 105 return rc;106 return EE_IO; 106 107 } 107 108 … … 110 111 elf.flags = flags; 111 112 112 rc= elf_load_module(&elf, so_bias);113 int ret = elf_load_module(&elf, so_bias); 113 114 114 115 vfs_put(ofile); 115 return r c;116 return ret; 116 117 } 117 118 … … 122 123 int rc = vfs_lookup(path, 0, &file); 123 124 if (rc == EOK) { 124 rc= elf_load_file(file, so_bias, flags, info);125 int ret = elf_load_file(file, so_bias, flags, info); 125 126 vfs_put(file); 126 } 127 return rc; 127 return ret; 128 } else { 129 return EE_IO; 130 } 128 131 } 129 132 … … 144 147 aoff64_t pos = 0; 145 148 size_t nr; 146 int i, rc; 149 int i, ret; 150 int rc; 147 151 148 152 rc = vfs_read(elf->fd, &pos, header, sizeof(elf_header_t), &nr); 149 153 if (rc != EOK || nr != sizeof(elf_header_t)) { 150 154 DPRINTF("Read error.\n"); 151 return EE_I NVALID;155 return EE_IO; 152 156 } 153 157 … … 209 213 if (rc != EOK || nr != sizeof(elf_segment_header_t)) { 210 214 DPRINTF("Read error.\n"); 211 return EE_I NVALID;215 return EE_IO; 212 216 } 213 217 214 r c= segment_header(elf, &segment_hdr);215 if (r c!= EE_OK)216 return r c;218 ret = segment_header(elf, &segment_hdr); 219 if (ret != EE_OK) 220 return ret; 217 221 } 218 222 … … 228 232 if (rc != EOK || nr != sizeof(elf_section_header_t)) { 229 233 DPRINTF("Read error.\n"); 230 return EE_I NVALID;234 return EE_IO; 231 235 } 232 236 233 r c= section_header(elf, §ion_hdr);234 if (r c!= EE_OK)235 return r c;237 ret = section_header(elf, §ion_hdr); 238 if (ret != EE_OK) 239 return ret; 236 240 } 237 241 … … 399 403 if (rc != EOK || nr != entry->p_filesz) { 400 404 DPRINTF("read error\n"); 401 return EE_I NVALID;405 return EE_IO; 402 406 } 403 407 -
uspace/lib/c/include/elf/elf_mod.h
rc81132d r1afa94d 53 53 #define EE_LOADER 5 /* The image is actually a program loader. */ 54 54 #define EE_IRRECOVERABLE 6 55 #define EE_IO 7 /* Could not read file. */ 55 56 56 57 typedef enum {
Note:
See TracChangeset
for help on using the changeset viewer.