10b57cec5SDimitry Andric //===-- Platform.h ----------------------------------------------*- C++ -*-===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric 95ffd83dbSDimitry Andric #ifndef LLDB_TOOLS_DRIVER_PLATFORM_H 105ffd83dbSDimitry Andric #define LLDB_TOOLS_DRIVER_PLATFORM_H 110b57cec5SDimitry Andric 120b57cec5SDimitry Andric #if defined(_WIN32) 130b57cec5SDimitry Andric 140b57cec5SDimitry Andric #include <io.h> 150b57cec5SDimitry Andric #if defined(_MSC_VER) 16fe6060f1SDimitry Andric #include <csignal> 170b57cec5SDimitry Andric #endif 18*349cc55cSDimitry Andric 190b57cec5SDimitry Andric #include "lldb/Host/windows/windows.h" 20fe6060f1SDimitry Andric #include <cinttypes> 21*349cc55cSDimitry Andric #include <sys/types.h> 220b57cec5SDimitry Andric 230b57cec5SDimitry Andric struct winsize { 240b57cec5SDimitry Andric long ws_col; 250b57cec5SDimitry Andric }; 260b57cec5SDimitry Andric 270b57cec5SDimitry Andric typedef unsigned char cc_t; 280b57cec5SDimitry Andric typedef unsigned int speed_t; 290b57cec5SDimitry Andric typedef unsigned int tcflag_t; 300b57cec5SDimitry Andric 310b57cec5SDimitry Andric // fcntl.h 320b57cec5SDimitry Andric #define O_NOCTTY 0400 330b57cec5SDimitry Andric 340b57cec5SDimitry Andric // ioctls.h 350b57cec5SDimitry Andric #define TIOCGWINSZ 0x5413 360b57cec5SDimitry Andric 370b57cec5SDimitry Andric // signal.h 380b57cec5SDimitry Andric #define SIGPIPE 13 390b57cec5SDimitry Andric #define SIGCONT 18 400b57cec5SDimitry Andric #define SIGTSTP 20 410b57cec5SDimitry Andric #define SIGWINCH 28 420b57cec5SDimitry Andric 430b57cec5SDimitry Andric // tcsetattr arguments 440b57cec5SDimitry Andric #define TCSANOW 0 450b57cec5SDimitry Andric 460b57cec5SDimitry Andric #define NCCS 32 470b57cec5SDimitry Andric struct termios { 480b57cec5SDimitry Andric tcflag_t c_iflag; // input mode flags 490b57cec5SDimitry Andric tcflag_t c_oflag; // output mode flags 500b57cec5SDimitry Andric tcflag_t c_cflag; // control mode flags 510b57cec5SDimitry Andric tcflag_t c_lflag; // local mode flags 520b57cec5SDimitry Andric cc_t c_line; // line discipline 530b57cec5SDimitry Andric cc_t c_cc[NCCS]; // control characters 540b57cec5SDimitry Andric speed_t c_ispeed; // input speed 550b57cec5SDimitry Andric speed_t c_ospeed; // output speed 560b57cec5SDimitry Andric }; 570b57cec5SDimitry Andric 580b57cec5SDimitry Andric #ifdef _MSC_VER 590b57cec5SDimitry Andric struct timeval { 600b57cec5SDimitry Andric long tv_sec; 610b57cec5SDimitry Andric long tv_usec; 620b57cec5SDimitry Andric }; 630b57cec5SDimitry Andric typedef long pid_t; 640b57cec5SDimitry Andric #define PATH_MAX MAX_PATH 650b57cec5SDimitry Andric #endif 660b57cec5SDimitry Andric 670b57cec5SDimitry Andric #define STDIN_FILENO 0 680b57cec5SDimitry Andric 690b57cec5SDimitry Andric extern int ioctl(int d, int request, ...); 700b57cec5SDimitry Andric extern int kill(pid_t pid, int sig); 710b57cec5SDimitry Andric extern int tcsetattr(int fd, int optional_actions, 720b57cec5SDimitry Andric const struct termios *termios_p); 730b57cec5SDimitry Andric extern int tcgetattr(int fildes, struct termios *termios_p); 740b57cec5SDimitry Andric 750b57cec5SDimitry Andric #else 76fe6060f1SDimitry Andric #include <cinttypes> 770b57cec5SDimitry Andric 780b57cec5SDimitry Andric #include <libgen.h> 790b57cec5SDimitry Andric #include <sys/ioctl.h> 800b57cec5SDimitry Andric #include <termios.h> 810b57cec5SDimitry Andric #include <unistd.h> 820b57cec5SDimitry Andric 830b57cec5SDimitry Andric #include <pthread.h> 840b57cec5SDimitry Andric #include <sys/time.h> 850b57cec5SDimitry Andric #endif 860b57cec5SDimitry Andric 875ffd83dbSDimitry Andric #endif // LLDB_TOOLS_DRIVER_PLATFORM_H 88