klee
file-creator.c File Reference
#include "klee-replay.h"
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <ftw.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <termios.h>
Include dependency graph for file-creator.c:

Go to the source code of this file.

Macros

#define __STDIN   (-1)
 
#define __STDOUT   (-2)
 

Functions

static void create_file (int target_fd, const char *target_name, exe_disk_file_t *dfile, const char *tmpdir)
 
static void check_file (int index, exe_disk_file_t *dfile)
 
static int create_link (const char *fname, exe_disk_file_t *dfile, const char *tmpdir)
 
static int create_dir (const char *fname, exe_disk_file_t *dfile, const char *tmpdir)
 
double getTime ()
 
int wait_for_timeout_or_exit (pid_t pid, const char *name, int *statusp)
 Return true if program exited, false if timed out. More...
 
static int create_char_dev (const char *fname, exe_disk_file_t *dfile, const char *tmpdir)
 
static int create_pipe (const char *fname, exe_disk_file_t *dfile, const char *tmpdir)
 
static int create_reg_file (const char *fname, exe_disk_file_t *dfile, const char *tmpdir)
 
void replay_create_files (exe_file_system_t *exe_fs)
 
int remove_callback (const char *fpath, __attribute__((unused)) const struct stat *sb, __attribute__((unused)) int typeflag, __attribute__((unused)) struct FTW *ftwbuf)
 
void replay_delete_files ()
 

Variables

char replay_dir [] = "/tmp/klee-replay-XXXXXX"
 

Macro Definition Documentation

◆ __STDIN

#define __STDIN   (-1)

Definition at line 46 of file file-creator.c.

◆ __STDOUT

#define __STDOUT   (-2)

Definition at line 47 of file file-creator.c.

Function Documentation

◆ check_file()

static void check_file ( int  index,
exe_disk_file_t *  dfile 
)
static

Definition at line 457 of file file-creator.c.

References __STDIN, __STDOUT, and replay_dir.

Referenced by replay_create_files().

Here is the caller graph for this function:

◆ create_char_dev()

static int create_char_dev ( const char *  fname,
exe_disk_file_t *  dfile,
const char *  tmpdir 
)
static

Definition at line 108 of file file-creator.c.

References process_status(), and wait_for_timeout_or_exit().

Referenced by create_file().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_dir()

static int create_dir ( const char *  fname,
exe_disk_file_t *  dfile,
const char *  tmpdir 
)
static

Definition at line 73 of file file-creator.c.

Referenced by create_file().

Here is the caller graph for this function:

◆ create_file()

static void create_file ( int  target_fd,
const char *  target_name,
exe_disk_file_t *  dfile,
const char *  tmpdir 
)
static

Definition at line 334 of file file-creator.c.

References create_char_dev(), create_dir(), create_link(), create_pipe(), and create_reg_file().

Referenced by create_link(), and replay_create_files().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_link()

static int create_link ( const char *  fname,
exe_disk_file_t *  dfile,
const char *  tmpdir 
)
static

Definition at line 49 of file file-creator.c.

References create_file().

Referenced by create_file().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_pipe()

static int create_pipe ( const char *  fname,
exe_disk_file_t *  dfile,
const char *  tmpdir 
)
static

Definition at line 233 of file file-creator.c.

References process_status(), and wait_for_timeout_or_exit().

Referenced by create_file().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_reg_file()

static int create_reg_file ( const char *  fname,
exe_disk_file_t *  dfile,
const char *  tmpdir 
)
static

Definition at line 294 of file file-creator.c.

Referenced by create_file().

Here is the caller graph for this function:

◆ getTime()

double getTime ( )

Definition at line 83 of file file-creator.c.

Referenced by wait_for_timeout_or_exit().

Here is the caller graph for this function:

◆ remove_callback()

int remove_callback ( const char *  fpath,
__attribute__((unused)) const struct stat *  sb,
__attribute__((unused)) int  typeflag,
__attribute__((unused)) struct FTW *  ftwbuf 
)

Definition at line 437 of file file-creator.c.

Referenced by replay_delete_files().

Here is the caller graph for this function:

◆ replay_create_files()

void replay_create_files ( exe_file_system_t *  exe_fs)

Definition at line 398 of file file-creator.c.

References __STDIN, __STDOUT, check_file(), create_file(), and replay_dir.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ replay_delete_files()

void replay_delete_files ( )

Definition at line 444 of file file-creator.c.

References keep_temps, remove_callback(), and replay_dir.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wait_for_timeout_or_exit()

int wait_for_timeout_or_exit ( pid_t  pid,
const char *  name,
int *  statusp 
)

Return true if program exited, false if timed out.

Definition at line 91 of file file-creator.c.

References getTime().

Referenced by create_char_dev(), and create_pipe().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ replay_dir

char replay_dir[] = "/tmp/klee-replay-XXXXXX"