Lines Matching full:elf
44 write_file (Elf *elf, off_t size, int change_bo, size_t shnum) in write_file() argument
46 int class = elf->class; in write_file()
50 if (unlikely (fstat (elf->fildes, &st) != 0)) in write_file()
61 if (elf->parent == NULL in write_file()
62 && (elf->maximum_size == ~((size_t) 0) in write_file()
63 || (size_t) size > elf->maximum_size) in write_file()
64 && unlikely (ftruncate (elf->fildes, size) != 0)) in write_file()
71 if (elf->map_address == NULL && elf->cmd == ELF_C_WRITE_MMAP) in write_file()
73 elf->map_address = mmap (NULL, size, PROT_READ | PROT_WRITE, in write_file()
74 MAP_SHARED, elf->fildes, 0); in write_file()
75 if (unlikely (elf->map_address == MAP_FAILED)) in write_file()
76 elf->map_address = NULL; in write_file()
79 if (elf->map_address != NULL) in write_file()
92 if (elf->parent == NULL in write_file()
93 && (elf->maximum_size == ~((size_t) 0) in write_file()
94 || (size_t) size > elf->maximum_size) in write_file()
95 && unlikely (posix_fallocate (elf->fildes, 0, size) != 0)) in write_file()
104 ? __elf32_updatemmap (elf, change_bo, shnum) in write_file()
105 : __elf64_updatemmap (elf, change_bo, shnum)) != 0) in write_file()
113 ? __elf32_updatefile (elf, change_bo, shnum) in write_file()
114 : __elf64_updatefile (elf, change_bo, shnum)) != 0) in write_file()
121 && elf->parent == NULL in write_file()
122 && elf->maximum_size != ~((size_t) 0) in write_file()
123 && (size_t) size < elf->maximum_size in write_file()
124 && unlikely (ftruncate (elf->fildes, size) != 0)) in write_file()
136 && unlikely (fchmod (elf->fildes, st.st_mode) != 0)) in write_file()
142 if (size != -1 && elf->parent == NULL) in write_file()
143 elf->maximum_size = size; in write_file()
150 elf_update (Elf *elf, Elf_Cmd cmd) in elf_update() argument
164 if (elf == NULL) in elf_update()
167 if (elf->kind != ELF_K_ELF) in elf_update()
173 rwlock_wrlock (elf->lock); in elf_update()
175 /* Make sure we have an ELF header. */ in elf_update()
176 if (elf->state.elf.ehdr == NULL) in elf_update()
184 shnum = (elf->state.elf.scns_last->cnt == 0 in elf_update()
186 : 1 + elf->state.elf.scns_last->data[elf->state.elf.scns_last->cnt - 1].index); in elf_update()
188 /* Update the ELF descriptor. First, place the program header. It in elf_update()
189 will come right after the ELF header. The count the size of all in elf_update()
191 size = (elf->class == ELFCLASS32 in elf_update()
192 ? __elf32_updatenull_wrlock (elf, &change_bo, shnum) in elf_update()
193 : __elf64_updatenull_wrlock (elf, &change_bo, shnum)); in elf_update()
198 if (elf->cmd != ELF_C_RDWR in elf_update()
199 && elf->cmd != ELF_C_RDWR_MMAP in elf_update()
200 && elf->cmd != ELF_C_WRITE in elf_update()
201 && unlikely (elf->cmd != ELF_C_WRITE_MMAP)) in elf_update()
206 else if (unlikely (elf->fildes == -1)) in elf_update()
213 size = write_file (elf, size, change_bo, shnum); in elf_update()
217 rwlock_unlock (elf->lock); in elf_update()