Lines Matching full:elf
43 write_file (Elf *elf, off_t size, int change_bo, size_t shnum) in write_file() argument
45 int class = elf->class; in write_file()
49 if (unlikely (fstat (elf->fildes, &st) != 0)) in write_file()
60 if (elf->parent == NULL in write_file()
61 && (elf->maximum_size == ~((size_t) 0) in write_file()
62 || (size_t) size > elf->maximum_size) in write_file()
63 && unlikely (ftruncate (elf->fildes, size) != 0)) in write_file()
70 if (elf->map_address == NULL && elf->cmd == ELF_C_WRITE_MMAP) in write_file()
72 elf->map_address = mmap (NULL, size, PROT_READ | PROT_WRITE, in write_file()
73 MAP_SHARED, elf->fildes, 0); in write_file()
74 if (unlikely (elf->map_address == MAP_FAILED)) in write_file()
75 elf->map_address = NULL; in write_file()
78 if (elf->map_address != NULL) in write_file()
82 ? __elf32_updatemmap (elf, change_bo, shnum) in write_file()
83 : __elf64_updatemmap (elf, change_bo, shnum)) != 0) in write_file()
91 ? __elf32_updatefile (elf, change_bo, shnum) in write_file()
92 : __elf64_updatefile (elf, change_bo, shnum)) != 0) in write_file()
98 && elf->parent == NULL in write_file()
99 && elf->maximum_size != ~((size_t) 0) in write_file()
100 && (size_t) size < elf->maximum_size in write_file()
101 && unlikely (ftruncate (elf->fildes, size) != 0)) in write_file()
113 && unlikely (fchmod (elf->fildes, st.st_mode) != 0)) in write_file()
119 if (size != -1 && elf->parent == NULL) in write_file()
120 elf->maximum_size = size; in write_file()
127 elf_update (elf, cmd) in elf_update() argument
128 Elf *elf; in elf_update()
143 if (elf == NULL)
146 if (elf->kind != ELF_K_ELF)
152 rwlock_wrlock (elf->lock);
154 /* Make sure we have an ELF header. */
155 if (elf->state.elf.ehdr == NULL)
163 shnum = (elf->state.elf.scns_last->cnt == 0
165 : 1 + elf->state.elf.scns_last->data[elf->state.elf.scns_last->cnt - 1].index);
167 /* Update the ELF descriptor. First, place the program header. It
168 will come right after the ELF header. The count the size of all
170 size = (elf->class == ELFCLASS32
171 ? __elf32_updatenull_wrlock (elf, &change_bo, shnum)
172 : __elf64_updatenull_wrlock (elf, &change_bo, shnum));
177 if (elf->cmd != ELF_C_RDWR
178 && elf->cmd != ELF_C_RDWR_MMAP
179 && elf->cmd != ELF_C_WRITE
180 && unlikely (elf->cmd != ELF_C_WRITE_MMAP))
185 else if (unlikely (elf->fildes == -1))
192 size = write_file (elf, size, change_bo, shnum);
196 rwlock_unlock (elf->lock);