1257752Semaste//===-- Platform.cpp --------------------------------------------*- C++ -*-===// 2257752Semaste// 3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4353358Sdim// See https://llvm.org/LICENSE.txt for license information. 5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6257752Semaste// 7257752Semaste//===----------------------------------------------------------------------===// 8257752Semaste 9257752Semaste// this file is only relevant for Visual C++ 10314564Sdim#if defined(_WIN32) 11257752Semaste 12314564Sdim#include <assert.h> 13257752Semaste#include <process.h> 14276479Sdim#include <stdlib.h> 15257752Semaste 16257752Semaste#include "Platform.h" 17314564Sdim#include "llvm/Support/ErrorHandling.h" 18257752Semaste 19314564Sdimint ioctl(int d, int request, ...) { 20314564Sdim switch (request) { 21314564Sdim // request the console windows size 22314564Sdim case (TIOCGWINSZ): { 23314564Sdim va_list vl; 24314564Sdim va_start(vl, request); 25314564Sdim // locate the window size structure on stack 26314564Sdim winsize *ws = va_arg(vl, winsize *); 27314564Sdim // get screen buffer information 28314564Sdim CONSOLE_SCREEN_BUFFER_INFO info; 29314564Sdim if (GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info) == 30314564Sdim TRUE) 31314564Sdim // fill in the columns 32314564Sdim ws->ws_col = info.dwMaximumWindowSize.X; 33314564Sdim va_end(vl); 34314564Sdim return 0; 35314564Sdim } break; 36314564Sdim default: 37314564Sdim llvm_unreachable("Not implemented!"); 38314564Sdim } 39257752Semaste} 40257752Semaste 41314564Sdimint kill(pid_t pid, int sig) { 42314564Sdim // is the app trying to kill itself 43314564Sdim if (pid == getpid()) 44314564Sdim exit(sig); 45314564Sdim // 46314564Sdim llvm_unreachable("Not implemented!"); 47257752Semaste} 48257752Semaste 49314564Sdimint tcsetattr(int fd, int optional_actions, const struct termios *termios_p) { 50314564Sdim llvm_unreachable("Not implemented!"); 51257752Semaste} 52257752Semaste 53314564Sdimint tcgetattr(int fildes, struct termios *termios_p) { 54314564Sdim // assert( !"Not implemented!" ); 55314564Sdim // error return value (0=success) 56314564Sdim return -1; 57257752Semaste} 58257752Semaste 59276479Sdim#endif 60