]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/tools/driver/Platform.cpp
Merge lld trunk r321017 to contrib/llvm/tools/lld.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / tools / driver / Platform.cpp
1 //===-- Platform.cpp --------------------------------------------*- 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
10 // this file is only relevant for Visual C++
11 #if defined(_WIN32)
12
13 #include <assert.h>
14 #include <process.h>
15 #include <stdlib.h>
16
17 #include "Platform.h"
18 #include "llvm/Support/ErrorHandling.h"
19
20 int ioctl(int d, int request, ...) {
21   switch (request) {
22   // request the console windows size
23   case (TIOCGWINSZ): {
24     va_list vl;
25     va_start(vl, request);
26     // locate the window size structure on stack
27     winsize *ws = va_arg(vl, winsize *);
28     // get screen buffer information
29     CONSOLE_SCREEN_BUFFER_INFO info;
30     if (GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info) ==
31         TRUE)
32       // fill in the columns
33       ws->ws_col = info.dwMaximumWindowSize.X;
34     va_end(vl);
35     return 0;
36   } break;
37   default:
38     llvm_unreachable("Not implemented!");
39   }
40 }
41
42 int kill(pid_t pid, int sig) {
43   // is the app trying to kill itself
44   if (pid == getpid())
45     exit(sig);
46   //
47   llvm_unreachable("Not implemented!");
48 }
49
50 int tcsetattr(int fd, int optional_actions, const struct termios *termios_p) {
51   llvm_unreachable("Not implemented!");
52 }
53
54 int tcgetattr(int fildes, struct termios *termios_p) {
55   //  assert( !"Not implemented!" );
56   // error return value (0=success)
57   return -1;
58 }
59
60 #endif