1061da546Spatrick //===-- Platform.h ----------------------------------------------*- C++ -*-===// 2061da546Spatrick // 3061da546Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4061da546Spatrick // See https://llvm.org/LICENSE.txt for license information. 5061da546Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6061da546Spatrick // 7061da546Spatrick //===----------------------------------------------------------------------===// 8061da546Spatrick 9dda28197Spatrick #ifndef LLDB_TOOLS_DRIVER_PLATFORM_H 10dda28197Spatrick #define LLDB_TOOLS_DRIVER_PLATFORM_H 11061da546Spatrick 12061da546Spatrick #if defined(_WIN32) 13061da546Spatrick 14061da546Spatrick #include <io.h> 15061da546Spatrick #if defined(_MSC_VER) 16be691f3bSpatrick #include <csignal> 17061da546Spatrick #endif 18*f6aab3d8Srobert 19061da546Spatrick #include "lldb/Host/windows/windows.h" 20be691f3bSpatrick #include <cinttypes> 21*f6aab3d8Srobert #include <sys/types.h> 22061da546Spatrick 23061da546Spatrick struct winsize { 24061da546Spatrick long ws_col; 25061da546Spatrick }; 26061da546Spatrick 27061da546Spatrick typedef unsigned char cc_t; 28061da546Spatrick typedef unsigned int speed_t; 29061da546Spatrick typedef unsigned int tcflag_t; 30061da546Spatrick 31061da546Spatrick // fcntl.h 32061da546Spatrick #define O_NOCTTY 0400 33061da546Spatrick 34061da546Spatrick // ioctls.h 35061da546Spatrick #define TIOCGWINSZ 0x5413 36061da546Spatrick 37061da546Spatrick // signal.h 38061da546Spatrick #define SIGPIPE 13 39061da546Spatrick #define SIGCONT 18 40061da546Spatrick #define SIGTSTP 20 41061da546Spatrick #define SIGWINCH 28 42061da546Spatrick 43061da546Spatrick // tcsetattr arguments 44061da546Spatrick #define TCSANOW 0 45061da546Spatrick 46061da546Spatrick #define NCCS 32 47061da546Spatrick struct termios { 48061da546Spatrick tcflag_t c_iflag; // input mode flags 49061da546Spatrick tcflag_t c_oflag; // output mode flags 50061da546Spatrick tcflag_t c_cflag; // control mode flags 51061da546Spatrick tcflag_t c_lflag; // local mode flags 52061da546Spatrick cc_t c_line; // line discipline 53061da546Spatrick cc_t c_cc[NCCS]; // control characters 54061da546Spatrick speed_t c_ispeed; // input speed 55061da546Spatrick speed_t c_ospeed; // output speed 56061da546Spatrick }; 57061da546Spatrick 58061da546Spatrick #ifdef _MSC_VER 59061da546Spatrick struct timeval { 60061da546Spatrick long tv_sec; 61061da546Spatrick long tv_usec; 62061da546Spatrick }; 63061da546Spatrick typedef long pid_t; 64061da546Spatrick #define PATH_MAX MAX_PATH 65061da546Spatrick #endif 66061da546Spatrick 67061da546Spatrick #define STDIN_FILENO 0 68061da546Spatrick 69061da546Spatrick extern int ioctl(int d, int request, ...); 70061da546Spatrick extern int kill(pid_t pid, int sig); 71061da546Spatrick extern int tcsetattr(int fd, int optional_actions, 72061da546Spatrick const struct termios *termios_p); 73061da546Spatrick extern int tcgetattr(int fildes, struct termios *termios_p); 74061da546Spatrick 75061da546Spatrick #else 76be691f3bSpatrick #include <cinttypes> 77061da546Spatrick 78061da546Spatrick #include <libgen.h> 79061da546Spatrick #include <sys/ioctl.h> 80061da546Spatrick #include <termios.h> 81061da546Spatrick #include <unistd.h> 82061da546Spatrick 83061da546Spatrick #include <pthread.h> 84061da546Spatrick #include <sys/time.h> 85061da546Spatrick #endif 86061da546Spatrick 87dda28197Spatrick #endif // LLDB_TOOLS_DRIVER_PLATFORM_H 88