Changeset e796dc8 in mainline
- Timestamp:
- 2017-03-07T18:01:55Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bb9ec2d
- Parents:
- 48178b56
- git-author:
- Jiri Zarevucky <zarevucky.jiri@…> (2017-03-07 18:01:55)
- git-committer:
- Jakub Jermar <jakub@…> (2017-03-07 18:01:55)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/elf/elf_mod.c
r48178b56 re796dc8 44 44 */ 45 45 46 #include <errno.h> 46 47 #include <stdio.h> 48 #include <vfs/vfs.h> 47 49 #include <sys/types.h> 48 50 #include <align.h> … … 50 52 #include <as.h> 51 53 #include <elf/elf.h> 52 #include <unistd.h>53 #include <fcntl.h>54 54 #include <smc.h> 55 55 #include <loader/pcb.h> 56 56 #include <entry_point.h> 57 #include <str_error.h> 58 #include <stdlib.h> 57 59 58 60 #include <elf/elf_load.h> … … 82 84 * pointed to by @a info. 83 85 * 84 * @param file _name Path to theELF file.86 * @param file ELF file. 85 87 * @param so_bias Bias to use if the file is a shared object. 86 88 * @param info Pointer to a structure for storing information … … 90 92 * 91 93 */ 92 int elf_load_file(const char *file_name, size_t so_bias, eld_flags_t flags, 93 elf_finfo_t *info) 94 static int elf_load_file2(int file, size_t so_bias, eld_flags_t flags, elf_finfo_t *info) 94 95 { 95 96 elf_ld_t elf; 96 97 97 int fd; 98 int rc; 99 100 fd = open(file_name, O_RDONLY); 101 if (fd < 0) { 102 DPRINTF("failed opening file\n"); 103 return -1; 104 } 105 106 elf.fd = fd; 98 int ofile = vfs_clone(file, true); 99 int rc = _vfs_open(ofile, MODE_READ); 100 if (rc != EOK) { 101 return rc; 102 } 103 104 elf.fd = ofile; 107 105 elf.info = info; 108 106 elf.flags = flags; … … 110 108 rc = elf_load_module(&elf, so_bias); 111 109 112 close(fd); 113 110 close(ofile); 111 return rc; 112 } 113 114 int elf_load_file(const char *path, size_t so_bias, eld_flags_t flags, elf_finfo_t *info) 115 { 116 int file = vfs_lookup(path); 117 int rc = elf_load_file2(file, so_bias, flags, info); 118 close(file); 114 119 return rc; 115 120 }
Note:
See TracChangeset
for help on using the changeset viewer.