]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/tools/lldb-mi/Platform.h
Merge ^/head r275623 through 275634.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / tools / lldb-mi / Platform.h
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 #pragma once
10
11 #if defined( _MSC_VER )
12
13     // this will stop signal.h being included
14     #define _INC_SIGNAL
15
16     #include <io.h>
17     #include <eh.h>
18     #include <inttypes.h>
19     #include <lldb/Host/windows/Windows.h>
20     #include <lldb/Host/HostGetOpt.h>
21
22         // This is not used by MI
23     struct timeval
24     {
25         long tv_sec;
26         long tv_usec;
27     };
28
29     struct winsize
30     {
31         long ws_col;
32     };
33
34     typedef unsigned char   cc_t;
35     typedef unsigned int    speed_t;
36     typedef unsigned int    tcflag_t;
37
38     // fcntl.h // This is not used by MI
39     #define O_NOCTTY 0400
40
41     // ioctls.h
42     #define TIOCGWINSZ 0x5413
43
44     // tcsetattr arguments
45     #define TCSANOW 0
46
47     #define NCCS 32
48     struct termios
49     {
50         tcflag_t c_iflag;  // input mode flags
51         tcflag_t c_oflag;  // output mode flags
52         tcflag_t c_cflag;  // control mode flags
53         tcflag_t c_lflag;  // local mode flags
54         cc_t c_line;       // line discipline
55         cc_t c_cc[NCCS];   // control characters
56         speed_t c_ispeed;  // input speed
57         speed_t c_ospeed;  // output speed
58     };
59
60         typedef long pid_t;
61
62     #define STDIN_FILENO 0
63         #define PATH_MAX MAX_PATH
64     #define snprintf _snprintf
65
66     extern int  ioctl( int d, int request, ... );
67     extern int  kill ( pid_t pid, int sig      );
68     extern int  tcsetattr( int fd, int optional_actions, const struct termios *termios_p );
69     extern int  tcgetattr( int fildes, struct termios *termios_p );
70
71     // signal handler function pointer type
72     typedef void (*sighandler_t)(int);
73
74         // CODETAG_IOR_SIGNALS
75     // signal.h
76     #define SIGINT              2                                               // Terminal interrupt signal
77         #define SIGQUIT         3                                               // Terminal quit signal 
78         #define SIGKILL         9                                               // Kill (cannot be caught or ignored)
79         #define SIGPIPE         13                                              // Write on a pipe with no one to read it
80     #define SIGCONT             18                                              // Continue executing, if stopped.
81     #define SIGTSTP             20                                              // Terminal stop signal
82     #define SIGSTOP             23                                              // Stop executing (cannot be caught or ignored)
83     #define SIGWINCH    28                                              // (== SIGVTALRM)
84     #define SIG_DFL             ( (sighandler_t) -1 )   // Default handler
85     #define SIG_IGN             ( (sighandler_t) -2 )   // Ignored
86
87         extern sighandler_t signal( int sig, sighandler_t );
88
89 #else
90
91     #include <inttypes.h>
92
93     #include <getopt.h>
94     #include <libgen.h>
95     #include <sys/ioctl.h>
96     #include <termios.h>
97     #include <unistd.h>
98
99     #include <histedit.h>
100     #include <pthread.h>
101     #include <sys/time.h>
102
103     #if defined(__FreeBSD__)
104         #include <readline/readline.h>
105     #else
106         #include <editline/readline.h>
107     #endif
108
109 #endif