Home | History | Annotate | Download | only in libelf

Lines Matching refs:Elf

64 write_file (Elf *elf, off_t size, int change_bo, size_t shnum)
66 int class = elf->class;
70 if (unlikely (fstat (elf->fildes, &st) != 0))
81 if (elf->parent == NULL
82 && (elf->maximum_size == ~((size_t) 0)
83 || (size_t) size > elf->maximum_size)
84 && unlikely (ftruncate (elf->fildes, size) != 0))
91 if (elf->map_address == NULL && elf->cmd == ELF_C_WRITE_MMAP)
96 elf->map_address = mmap (NULL, size, PROT_READ | PROT_WRITE,
97 MAP_SHARED, elf->fildes, 0);
98 if (unlikely (elf->map_address == MAP_FAILED))
99 elf->map_address = NULL;
103 if (elf->map_address != NULL)
107 ? __elf32_updatemmap (elf, change_bo, shnum)
108 : __elf64_updatemmap (elf, change_bo, shnum)) != 0)
116 ? __elf32_updatefile (elf, change_bo, shnum)
117 : __elf64_updatefile (elf, change_bo, shnum)) != 0)
123 && elf->parent == NULL
124 && elf->maximum_size != ~((size_t) 0)
125 && (size_t) size < elf->maximum_size
126 && unlikely (ftruncate (elf->fildes, size) != 0))
138 && unlikely (fchmod (elf->fildes, st.st_mode) != 0))
144 if (size != -1 && elf->parent == NULL)
145 elf->maximum_size = size;
152 elf_update (elf, cmd)
153 Elf *elf;
168 if (elf == NULL)
171 if (elf->kind != ELF_K_ELF)
177 rwlock_wrlock (elf->lock);
179 /* Make sure we have an ELF header. */
180 if (elf->state.elf.ehdr == NULL)
188 shnum = (elf->state.elf.scns_last->cnt == 0
190 : 1 + elf->state.elf.scns_last->data[elf->state.elf.scns_last->cnt - 1].index);
192 /* Update the ELF descriptor. First, place the program header. It
193 will come right after the ELF header. The count the size of all
195 size = (elf->class == ELFCLASS32
196 ? __elf32_updatenull_wrlock (elf, &change_bo, shnum)
197 : __elf64_updatenull_wrlock (elf, &change_bo, shnum));
202 if (elf->cmd != ELF_C_RDWR
203 && elf->cmd != ELF_C_RDWR_MMAP
204 && elf->cmd != ELF_C_WRITE
205 && unlikely (elf->cmd != ELF_C_WRITE_MMAP))
210 else if (unlikely (elf->fildes == -1))
217 size = write_file (elf, size, change_bo, shnum);
221 rwlock_unlock (elf->lock);