1 //===-- Platform.h ----------------------------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef lldb_Platform_h_ 10 #define lldb_Platform_h_ 11 12 #if defined(_WIN32) 13 14 #include <io.h> 15 #if defined(_MSC_VER) 16 #include <signal.h> 17 #endif 18 #include "lldb/Host/windows/windows.h" 19 #include <inttypes.h> 20 21 struct winsize { 22 long ws_col; 23 }; 24 25 typedef unsigned char cc_t; 26 typedef unsigned int speed_t; 27 typedef unsigned int tcflag_t; 28 29 // fcntl.h 30 #define O_NOCTTY 0400 31 32 // ioctls.h 33 #define TIOCGWINSZ 0x5413 34 35 // signal.h 36 #define SIGPIPE 13 37 #define SIGCONT 18 38 #define SIGTSTP 20 39 #define SIGWINCH 28 40 41 // tcsetattr arguments 42 #define TCSANOW 0 43 44 #define NCCS 32 45 struct termios { 46 tcflag_t c_iflag; // input mode flags 47 tcflag_t c_oflag; // output mode flags 48 tcflag_t c_cflag; // control mode flags 49 tcflag_t c_lflag; // local mode flags 50 cc_t c_line; // line discipline 51 cc_t c_cc[NCCS]; // control characters 52 speed_t c_ispeed; // input speed 53 speed_t c_ospeed; // output speed 54 }; 55 56 #ifdef _MSC_VER 57 struct timeval { 58 long tv_sec; 59 long tv_usec; 60 }; 61 typedef long pid_t; 62 #define PATH_MAX MAX_PATH 63 #endif 64 65 #define STDIN_FILENO 0 66 67 extern int ioctl(int d, int request, ...); 68 extern int kill(pid_t pid, int sig); 69 extern int tcsetattr(int fd, int optional_actions, 70 const struct termios *termios_p); 71 extern int tcgetattr(int fildes, struct termios *termios_p); 72 73 #else 74 #include <inttypes.h> 75 76 #include <libgen.h> 77 #include <sys/ioctl.h> 78 #include <termios.h> 79 #include <unistd.h> 80 81 #include <pthread.h> 82 #include <sys/time.h> 83 #endif 84 85 #endif // lldb_Platform_h_ 86