[klee-commits] [1517] adjusted the bout names for the symbolic connections

sbkim at stanford.edu sbkim at stanford.edu
Thu Mar 19 15:20:47 PDT 2009


Revision: 1517
          http://keeda.stanford.edu/viewvc/viewvc.cgi?view=rev&revision=1517
Author:   sbkim
Date:     2009-03-19 15:20:46 -0700 (Thu, 19 Mar 2009)
Log Message:
-----------
adjusted the bout names for the symbolic connections

Modified Paths:
--------------
    models/simple/fd_init.c

Modified: models/simple/fd_init.c
===================================================================
--- models/simple/fd_init.c	2009-03-19 16:08:43 UTC (rev 1516)
+++ models/simple/fd_init.c	2009-03-19 22:20:46 UTC (rev 1517)
@@ -25,37 +25,41 @@
    mostly care about sym case anyway. */
 
 
-exe_sym_env_t __exe_env = { 
-  {{ 0, eOpen | eReadable, 0, 0}, 
-   { 1, eOpen | eWriteable, 0, 0}, 
+exe_sym_env_t __exe_env = {
+  {{ 0, eOpen | eReadable,  0, 0},
+   { 1, eOpen | eWriteable, 0, 0},
    { 2, eOpen | eWriteable, 0, 0}},
   022,
   0,
   0
 };
 
-static void __create_new_dfile(exe_disk_file_t *dfile, unsigned size, 
+static void __create_new_dfile(exe_disk_file_t *dfile, unsigned size,
                                const char *name, struct stat64 *defaults,
 			       int is_conn) {
   struct stat64 *s = malloc(sizeof(*s));
   const char *sp;
-  char stat_name[64], conn_name[64];
-  
+  char data_name[64], stat_name[64], conn_name[64];
+
   for (sp=name; *sp; ++sp)
+    data_name[sp-name] = *sp;
+  strcpy(&data_name[sp-name], "-data");
+
+  for (sp=name; *sp; ++sp)
     stat_name[sp-name] = *sp;
-  memcpy(&stat_name[sp-name], "-stat", 6);
+  strcpy(&stat_name[sp-name], "-stat");
 
   dfile->size = size;
   dfile->contents = malloc(dfile->size);
-  klee_make_symbolic_name(dfile->contents, dfile->size, name);
-  
+  klee_make_symbolic_name(dfile->contents, dfile->size, data_name);
+
   klee_make_symbolic_name(s, sizeof(*s), stat_name);
 
   /* For broken tests */
-  if (!klee_is_symbolic(s->st_ino) && 
+  if (!klee_is_symbolic(s->st_ino) &&
       (s->st_ino & 0x7FFFFFFF) == 0)
     s->st_ino = defaults->st_ino;
-  
+
   /* Important since we copy this out through getdents, and readdir
      will otherwise skip this entry. For same reason need to make sure
      it fits in low bits. */
@@ -90,7 +94,7 @@
 
     for (sp=name; *sp; ++sp)
       conn_name[sp-name] = *sp;
-    memcpy(&conn_name[sp-name], "-conn", 6);
+    strcpy(&conn_name[sp-name], "-conn");
 
     dfile->conn = calloc(1, sizeof(*(dfile->conn)));
     dfile->conn->localaddr = calloc(1, sizeof(*(dfile->conn->localaddr)));
@@ -109,16 +113,16 @@
 /* n_files: number of symbolic input files, excluding stdin
    file_length: size in bytes of each symbolic file, including stdin
    sym_stdout_flag: 1 if stdout should be symbolic, 0 otherwise
-   save_all_writes_flag: 1 if all writes are executed as expected, 0 if 
-                         writes past the initial file size are discarded 
+   save_all_writes_flag: 1 if all writes are executed as expected, 0 if
+                         writes past the initial file size are discarded
 			 (file offset is always incremented)
    max_failures: maximum number of system call failures */
-void klee_init_fds(unsigned n_files, unsigned file_length, 
+void klee_init_fds(unsigned n_files, unsigned file_length,
 		   int sym_stdout_flag, int save_all_writes_flag,
 		   unsigned n_conns, unsigned conn_len,
 		   unsigned max_failures) {
   unsigned k;
-  char name[7] = "?-data";
+  char name[] = "?";
   struct stat64 s;
 
   stat64(".", &s);
@@ -129,7 +133,7 @@
     name[0] = 'A' + k;
     __create_new_dfile(&__exe_fs.sym_files[k], file_length, name, &s, 0);
   }
-  
+
   /* setting symbolic stdin */
   if (file_length) {
     __exe_fs.sym_stdin = malloc(sizeof(*__exe_fs.sym_stdin));
@@ -161,7 +165,7 @@
     __exe_fs.stdout_writes = 0;
   }
   else __exe_fs.sym_stdout = NULL;
-  
+
   __exe_env.save_all_writes = save_all_writes_flag;
   __exe_env.version = __sym_uint32("model_version");
   klee_assume(__exe_env.version == 1);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://keeda.Stanford.EDU/pipermail/klee-commits/attachments/20090319/c73ab242/attachment.html 


More information about the klee-commits mailing list