blob: b1b7de8e8a2287f155947ebb44efbf04377fd71a [file] [log] [blame]
Deepak Panickal429222c2013-10-15 15:46:40 +00001//===-- 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++
Kate Stoneb9c1b512016-09-06 20:57:50 +000011#if defined(_WIN32)
Deepak Panickal429222c2013-10-15 15:46:40 +000012
Deepak Panickal429222c2013-10-15 15:46:40 +000013#include <assert.h>
Kate Stoneb9c1b512016-09-06 20:57:50 +000014#include <process.h>
Hafiz Abid Qadeerbdb51592014-03-12 10:39:46 +000015#include <stdlib.h>
Deepak Panickal429222c2013-10-15 15:46:40 +000016
17#include "Platform.h"
Pavel Labathc523c382017-01-06 13:07:09 +000018#include "llvm/Support/ErrorHandling.h"
Deepak Panickal429222c2013-10-15 15:46:40 +000019
Kate Stoneb9c1b512016-09-06 20:57:50 +000020int 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:
David Blaikiea322f362017-01-06 00:38:06 +000038 llvm_unreachable("Not implemented!");
Kate Stoneb9c1b512016-09-06 20:57:50 +000039 }
Deepak Panickal429222c2013-10-15 15:46:40 +000040}
41
Kate Stoneb9c1b512016-09-06 20:57:50 +000042int kill(pid_t pid, int sig) {
43 // is the app trying to kill itself
44 if (pid == getpid())
45 exit(sig);
46 //
David Blaikiea322f362017-01-06 00:38:06 +000047 llvm_unreachable("Not implemented!");
Deepak Panickal429222c2013-10-15 15:46:40 +000048}
49
Kate Stoneb9c1b512016-09-06 20:57:50 +000050int tcsetattr(int fd, int optional_actions, const struct termios *termios_p) {
David Blaikiea322f362017-01-06 00:38:06 +000051 llvm_unreachable("Not implemented!");
Deepak Panickal429222c2013-10-15 15:46:40 +000052}
53
Kate Stoneb9c1b512016-09-06 20:57:50 +000054int tcgetattr(int fildes, struct termios *termios_p) {
55 // assert( !"Not implemented!" );
56 // error return value (0=success)
57 return -1;
Deepak Panickal429222c2013-10-15 15:46:40 +000058}
59
Deepak Panickal99fbc072014-03-03 15:39:47 +000060#endif