about summary refs log tree commit diff homepage
path: root/tools/klee-replay
diff options
context:
space:
mode:
Diffstat (limited to 'tools/klee-replay')
-rw-r--r--tools/klee-replay/CMakeLists.txt10
-rw-r--r--tools/klee-replay/file-creator.c6
-rw-r--r--tools/klee-replay/klee-replay.c6
3 files changed, 17 insertions, 5 deletions
diff --git a/tools/klee-replay/CMakeLists.txt b/tools/klee-replay/CMakeLists.txt
index 6388df50..aeb90845 100644
--- a/tools/klee-replay/CMakeLists.txt
+++ b/tools/klee-replay/CMakeLists.txt
@@ -6,7 +6,7 @@
 # License. See LICENSE.TXT for details.
 #
 #===------------------------------------------------------------------------===#
-if (HAVE_PTY_H OR HAVE_UTIL_H)
+if (HAVE_PTY_H OR HAVE_UTIL_H OR HAVE_LIBUTIL_H)
   add_executable(klee-replay
     fd_init.c
     file-creator.c
@@ -14,10 +14,16 @@ if (HAVE_PTY_H OR HAVE_UTIL_H)
     klee_init_env.c
   )
 
-  target_link_libraries(klee-replay PRIVATE kleeBasic ${LIBCAP_LIBRARIES})
+  target_link_libraries(klee-replay PRIVATE kleeBasic)
+
+  if(LIBCAP_LIBRARIES)
+    target_link_libraries(klee-replay PRIVATE ${LIBCAP_LIBRARIES})
+  endif()
+
   if (openpty_in_libutil)
     target_link_libraries(klee-replay PRIVATE ${LIBUTIL_LIBRARIES})
   endif (openpty_in_libutil)
+
   install(TARGETS klee-replay RUNTIME DESTINATION bin)
 else()
   message(WARNING "Not building klee-replay due to missing library for pty functions.")
diff --git a/tools/klee-replay/file-creator.c b/tools/klee-replay/file-creator.c
index b8f9addd..a218e6b0 100644
--- a/tools/klee-replay/file-creator.c
+++ b/tools/klee-replay/file-creator.c
@@ -25,6 +25,8 @@
 #include <pty.h>
 #elif defined(HAVE_UTIL_H)
 #include <util.h>
+#elif defined(HAVE_LIBUTIL_H)
+#include <libutil.h>
 #endif
 
 #if defined(__APPLE__)
@@ -114,7 +116,7 @@ static int create_char_dev(const char *fname, exe_disk_file_t *dfile,
   ts->c_oflag = 5;
   ts->c_cflag = 1215;
   ts->c_lflag = 35287;
-#ifndef __APPLE__
+#ifdef __GLIBC__
   ts->c_line = 0;
 #endif
   ts->c_cc[0] = '\x03';
@@ -168,7 +170,7 @@ static int create_char_dev(const char *fname, exe_disk_file_t *dfile,
         int res = tcgetattr(aslave, &mode);
         assert(!res);
         mode.c_iflag = IGNBRK;
-#if defined(__APPLE__)
+#if defined(__APPLE__) || defined(__FreeBSD__)
         mode.c_oflag &= ~(ONLCR | OCRNL | ONLRET);
 #else
         mode.c_oflag &= ~(OLCUC | ONLCR | OCRNL | ONLRET);
diff --git a/tools/klee-replay/klee-replay.c b/tools/klee-replay/klee-replay.c
index d26b67cd..9261535a 100644
--- a/tools/klee-replay/klee-replay.c
+++ b/tools/klee-replay/klee-replay.c
@@ -23,7 +23,7 @@
 
 #include <sys/wait.h>
 
-#if defined(__APPLE__)
+#if defined(__APPLE__) || defined(__FreeBSD__)
 #include <signal.h>
 #define fgetc_unlocked(x) fgetc (x)
 #define fputc_unlocked(x,y) fputc (x,y)
@@ -185,7 +185,11 @@ static void run_monitored(char *executable, int argc, char **argv) {
      * do this, because later on we might want to kill pid _and_ all processes
      * spawned by it and its descendants.
      */
+#ifndef __FreeBSD__
     setpgrp();
+#else
+    setpgrp(0, 0);
+#endif
 
     if (!rootdir) {
       execv(executable, argv);