Platform.h revision 269024
1//===-- Platform.h ----------------------------------------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10#ifndef lldb_Platform_h_ 11#define lldb_Platform_h_ 12 13#if defined( _MSC_VER ) 14 15 // this will stop signal.h being included 16 #define _INC_SIGNAL 17 18 #include <io.h> 19 #include <eh.h> 20 #include <inttypes.h> 21 #include "lldb/Host/windows/Windows.h" 22 #include "lldb/Host/HostGetOpt.h" 23 24 struct timeval 25 { 26 long tv_sec; 27 long tv_usec; 28 }; 29 30 struct winsize 31 { 32 long ws_col; 33 }; 34 35 typedef unsigned char cc_t; 36 typedef unsigned int speed_t; 37 typedef unsigned int tcflag_t; 38 39 // fcntl.h 40 #define O_NOCTTY 0400 41 42 // ioctls.h 43 #define TIOCGWINSZ 0x5413 44 45 // signal.h 46 #define SIGPIPE 13 47 #define SIGCONT 18 48 #define SIGTSTP 20 49 #define SIGWINCH 28 50 51 // tcsetattr arguments 52 #define TCSANOW 0 53 54 #define NCCS 32 55 struct termios 56 { 57 tcflag_t c_iflag; // input mode flags 58 tcflag_t c_oflag; // output mode flags 59 tcflag_t c_cflag; // control mode flags 60 tcflag_t c_lflag; // local mode flags 61 cc_t c_line; // line discipline 62 cc_t c_cc[NCCS]; // control characters 63 speed_t c_ispeed; // input speed 64 speed_t c_ospeed; // output speed 65 }; 66 67 typedef long pid_t; 68 69 #define STDIN_FILENO 0 70 71 #define PATH_MAX MAX_PATH 72 #define snprintf _snprintf 73 74 extern int ioctl( int d, int request, ... ); 75 extern int kill ( pid_t pid, int sig ); 76 extern int tcsetattr( int fd, int optional_actions, const struct termios *termios_p ); 77 extern int tcgetattr( int fildes, struct termios *termios_p ); 78 79 // signal handler function pointer type 80 typedef void (*sighandler_t)(int); 81 82 // signal.h 83 #define SIGINT 2 84 // default handler 85 #define SIG_DFL ( (sighandler_t) -1 ) 86 // ignored 87 #define SIG_IGN ( (sighandler_t) -2 ) 88 extern sighandler_t signal( int sig, sighandler_t ); 89 90#else 91 92 #include <inttypes.h> 93 94 #include <getopt.h> 95 #include <libgen.h> 96 #include <sys/ioctl.h> 97 #include <termios.h> 98 #include <unistd.h> 99 100 #include <histedit.h> 101 #include <pthread.h> 102 #include <sys/time.h> 103 104 #if defined(__FreeBSD__) 105 #include <readline/readline.h> 106 #else 107 #include <editline/readline.h> 108 #endif 109 110#endif 111 112#endif // lldb_Platform_h_ 113