File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -396,6 +396,15 @@ else()
396396 message (AUTHOR_WARNING "backtrace(3) not present in execinfo.h. Automatic backtraces for failures in rr are disabled." )
397397endif ()
398398
399+ include (CheckTypeSize )
400+ set (SAVE_CMAKE_EXTRA_INCLUDE_FILES "${CMAKE_EXTRA_INCLUDE_FILES} " )
401+ list (APPEND CMAKE_EXTRA_INCLUDE_FILES "termios.h" )
402+ check_type_size ("struct termios2" SIZEOF_TERMIOS2 )
403+ if (HAVE_SIZEOF_TERMIOS2)
404+ add_definitions (-DHAVE_TERMIOS2 )
405+ endif ()
406+ set (CMAKE_EXTRA_INCLUDE_FILES "${SAVE_CMAKE_EXTRA_INCLUDE_FILES} " )
407+
399408# Test only symbols
400409check_symbol_exists (pthread_mutexattr_setrobust "pthread.h" HAVE_ROBUST_MUTEX )
401410
Original file line number Diff line number Diff line change 103103
104104using namespace std ;
105105
106+ #ifndef HAVE_TERMIOS2
106107// The kernel header that defines this conflicts badly with glibc headers
107- // so we define it ourselves.
108+ // (but not bionic, which does define this) so we define it ourselves.
108109// NB: We need this struct defined so that the preprocessor macro for
109110// TCGETS2 will evaluate. But we use IOCTL_MASK_SIZE on it and we use
110111// the size from the tracee to determine how many bytes to record, so
@@ -119,6 +120,7 @@ struct termios2 {
119120 speed_t c_ispeed;
120121 speed_t c_ospeed;
121122};
123+ #endif
122124
123125namespace rr {
124126
Original file line number Diff line number Diff line change 22
33#include "util.h"
44
5- /* We have to define termios2 ourselves. See
5+ #ifndef HAVE_TERMIOS2
6+ /* We have to define termios2 ourselves with glibc. See
67 * https://github.com/npat-efault/picocom/blob/1acf1ddabaf3576b4023c4f6f09c5a3e4b086fb8/termios2.txt
78 * for the long explanation.
89 */
@@ -16,6 +17,7 @@ struct termios2 {
1617 speed_t c_ispeed ;
1718 speed_t c_ospeed ;
1819};
20+ #endif
1921
2022int main (void ) {
2123 int fd ;
You can’t perform that action at this time.
0 commit comments