MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / elf_file_length

Function elf_file_length

components/lwp/lwp_elf.c:212–226  ·  view source on GitHub ↗

* @brief Get the length of an ELF file. * * @param filename Path to the ELF file. * @param file_len Pointer to store the file length. * @return RT_EOK on success, -RT_ERROR on failure. */

Source from the content-addressed store, hash-verified

210 * @return RT_EOK on success, -RT_ERROR on failure.
211 */
212static int elf_file_length(char *filename, rt_size_t *file_len)
213{
214 int ret;
215 struct stat s = { 0 };
216
217 ret = stat(filename, &s);
218 if (ret != 0)
219 {
220 LOG_E("%s : error", __func__);
221 return -RT_ERROR;
222 }
223 *file_len = (rt_size_t)s.st_size;
224
225 return RT_EOK;
226}
227
228/**
229 * @brief Read data from an ELF file at a specific offset.

Callers 1

elf_load_ehdrFunction · 0.85

Calls 1

statClass · 0.70

Tested by

no test coverage detected