Lines Matching refs:run
55 void input_setSize(run_t* run, size_t sz) { in input_setSize() argument
56 if (sz > run->global->mutate.maxFileSz) { in input_setSize()
57 PLOG_F("Too large size requested: %zu > maxSize: %zu", sz, run->global->mutate.maxFileSz); in input_setSize()
62 if (TEMP_FAILURE_RETRY(ftruncate(run->dynamicFileFd, sz)) == -1) { in input_setSize()
63 PLOG_W("ftruncate(run->dynamicFileFd=%d, sz=%zu)", run->dynamicFileFd, sz); in input_setSize()
66 run->dynamicFileSz = sz; in input_setSize()
134 bool input_getNext(run_t* run, char* fname, bool rewind) { in input_getNext() argument
138 if (run->global->io.fileCnt == 0U) { in input_getNext()
145 struct dirent* entry = readdir(run->global->io.inputDirPtr); in input_getNext()
150 PLOG_W("readdir_r('%s')", run->global->io.inputDir); in input_getNext()
157 if (input_getDirStatsAndRewind(run->global) == false) { in input_getNext()
158 LOG_E("input_getDirStatsAndRewind('%s')", run->global->io.inputDir); in input_getNext()
164 snprintf(fname, PATH_MAX, "%s/%s", run->global->io.inputDir, entry->d_name); in input_getNext()
315 bool input_prepareDynamicInput(run_t* run) { in input_prepareDynamicInput() argument
317 MX_SCOPED_RWLOCK_READ(&run->global->io.dynfileq_mutex); in input_prepareDynamicInput()
319 if (run->global->io.dynfileqCnt == 0) { in input_prepareDynamicInput()
323 if (run->dynfileqCurrent == NULL) { in input_prepareDynamicInput()
324 run->dynfileqCurrent = TAILQ_FIRST(&run->global->io.dynfileq); in input_prepareDynamicInput()
326 if (run->dynfileqCurrent == TAILQ_LAST(&run->global->io.dynfileq, dyns_t)) { in input_prepareDynamicInput()
327 run->dynfileqCurrent = TAILQ_FIRST(&run->global->io.dynfileq); in input_prepareDynamicInput()
329 run->dynfileqCurrent = TAILQ_NEXT(run->dynfileqCurrent, pointers); in input_prepareDynamicInput()
334 input_setSize(run, run->dynfileqCurrent->size); in input_prepareDynamicInput()
335 memcpy(run->dynamicFile, run->dynfileqCurrent->data, run->dynfileqCurrent->size); in input_prepareDynamicInput()
336 mangle_mangleContent(run); in input_prepareDynamicInput()
341 bool input_prepareStaticFile(run_t* run, bool rewind) { in input_prepareStaticFile() argument
343 if (!input_getNext(run, fname, /* rewind= */ rewind)) { in input_prepareStaticFile()
346 snprintf(run->origFileName, sizeof(run->origFileName), "%s", fname); in input_prepareStaticFile()
348 input_setSize(run, run->global->mutate.maxFileSz); in input_prepareStaticFile()
349 ssize_t fileSz = files_readFileToBufMax(fname, run->dynamicFile, run->global->mutate.maxFileSz); in input_prepareStaticFile()
355 input_setSize(run, fileSz); in input_prepareStaticFile()
356 mangle_mangleContent(run); in input_prepareStaticFile()
361 bool input_prepareExternalFile(run_t* run) { in input_prepareExternalFile() argument
362 snprintf(run->origFileName, sizeof(run->origFileName), "[EXTERNAL]"); in input_prepareExternalFile()
364 int fd = files_writeBufToTmpFile(run->global->io.workDir, (const uint8_t*)"", 0, 0); in input_prepareExternalFile()
376 const char* const argv[] = {run->global->exe.externalCommand, fname, NULL}; in input_prepareExternalFile()
377 if (subproc_System(run, argv) != 0) { in input_prepareExternalFile()
378 LOG_E("Subprocess '%s' returned abnormally", run->global->exe.externalCommand); in input_prepareExternalFile()
381 LOG_D("Subporcess '%s' finished with success", run->global->exe.externalCommand); in input_prepareExternalFile()
383 input_setSize(run, run->global->mutate.maxFileSz); in input_prepareExternalFile()
384 ssize_t sz = files_readFromFdSeek(fd, run->dynamicFile, run->global->mutate.maxFileSz, 0); in input_prepareExternalFile()
390 input_setSize(run, (size_t)sz); in input_prepareExternalFile()
394 bool input_postProcessFile(run_t* run) { in input_postProcessFile() argument
396 files_writeBufToTmpFile(run->global->io.workDir, run->dynamicFile, run->dynamicFileSz, 0); in input_postProcessFile()
408 const char* const argv[] = {run->global->exe.postExternalCommand, fname, NULL}; in input_postProcessFile()
409 if (subproc_System(run, argv) != 0) { in input_postProcessFile()
410 LOG_E("Subprocess '%s' returned abnormally", run->global->exe.postExternalCommand); in input_postProcessFile()
413 LOG_D("Subporcess '%s' finished with success", run->global->exe.externalCommand); in input_postProcessFile()
415 input_setSize(run, run->global->mutate.maxFileSz); in input_postProcessFile()
416 ssize_t sz = files_readFromFdSeek(fd, run->dynamicFile, run->global->mutate.maxFileSz, 0); in input_postProcessFile()
422 input_setSize(run, (size_t)sz); in input_postProcessFile()