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_TOOLS_DRIVER_PLATFORM_H 10#define LLDB_TOOLS_DRIVER_PLATFORM_H 11 12#if defined(_WIN32) 13 14#include <io.h> 15#if defined(_MSC_VER) 16#include <csignal> 17#endif 18 19#include "lldb/Host/windows/windows.h" 20#include <cinttypes> 21#include <sys/types.h> 22 23struct winsize { 24 long ws_col; 25}; 26 27typedef unsigned char cc_t; 28typedef unsigned int speed_t; 29typedef unsigned int tcflag_t; 30 31// fcntl.h 32#define O_NOCTTY 0400 33 34// ioctls.h 35#define TIOCGWINSZ 0x5413 36 37// signal.h 38#define SIGPIPE 13 39#define SIGCONT 18 40#define SIGTSTP 20 41#define SIGWINCH 28 42 43// tcsetattr arguments 44#define TCSANOW 0 45 46#define NCCS 32 47struct termios { 48 tcflag_t c_iflag; // input mode flags 49 tcflag_t c_oflag; // output mode flags 50 tcflag_t c_cflag; // control mode flags 51 tcflag_t c_lflag; // local mode flags 52 cc_t c_line; // line discipline 53 cc_t c_cc[NCCS]; // control characters 54 speed_t c_ispeed; // input speed 55 speed_t c_ospeed; // output speed 56}; 57 58#ifdef _MSC_VER 59struct timeval { 60 long tv_sec; 61 long tv_usec; 62}; 63typedef long pid_t; 64#define PATH_MAX MAX_PATH 65#endif 66 67#define STDIN_FILENO 0 68 69extern int ioctl(int d, int request, ...); 70extern int kill(pid_t pid, int sig); 71extern int tcsetattr(int fd, int optional_actions, 72 const struct termios *termios_p); 73extern int tcgetattr(int fildes, struct termios *termios_p); 74 75#else 76#include <cinttypes> 77 78#include <libgen.h> 79#include <sys/ioctl.h> 80#include <termios.h> 81#include <unistd.h> 82 83#include <pthread.h> 84#include <sys/time.h> 85#endif 86 87#endif // LLDB_TOOLS_DRIVER_PLATFORM_H 88