xref: /freebsd-src/contrib/llvm-project/lldb/tools/driver/Platform.cpp (revision fe6060f10f634930ff71b7c50291ddc610da2475)
10b57cec5SDimitry Andric //===-- Platform.cpp --------------------------------------------*- C++ -*-===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric 
90b57cec5SDimitry Andric // this file is only relevant for Visual C++
100b57cec5SDimitry Andric #if defined(_WIN32)
110b57cec5SDimitry Andric 
12*fe6060f1SDimitry Andric #include <cassert>
13*fe6060f1SDimitry Andric #include <cstdlib>
140b57cec5SDimitry Andric #include <process.h>
150b57cec5SDimitry Andric 
160b57cec5SDimitry Andric #include "Platform.h"
170b57cec5SDimitry Andric #include "llvm/Support/ErrorHandling.h"
180b57cec5SDimitry Andric 
ioctl(int d,int request,...)190b57cec5SDimitry Andric int ioctl(int d, int request, ...) {
200b57cec5SDimitry Andric   switch (request) {
210b57cec5SDimitry Andric   // request the console windows size
220b57cec5SDimitry Andric   case (TIOCGWINSZ): {
230b57cec5SDimitry Andric     va_list vl;
240b57cec5SDimitry Andric     va_start(vl, request);
250b57cec5SDimitry Andric     // locate the window size structure on stack
260b57cec5SDimitry Andric     winsize *ws = va_arg(vl, winsize *);
270b57cec5SDimitry Andric     // get screen buffer information
280b57cec5SDimitry Andric     CONSOLE_SCREEN_BUFFER_INFO info;
290b57cec5SDimitry Andric     if (GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info) ==
300b57cec5SDimitry Andric         TRUE)
310b57cec5SDimitry Andric       // fill in the columns
320b57cec5SDimitry Andric       ws->ws_col = info.dwMaximumWindowSize.X;
330b57cec5SDimitry Andric     va_end(vl);
340b57cec5SDimitry Andric     return 0;
350b57cec5SDimitry Andric   } break;
360b57cec5SDimitry Andric   default:
370b57cec5SDimitry Andric     llvm_unreachable("Not implemented!");
380b57cec5SDimitry Andric   }
390b57cec5SDimitry Andric }
400b57cec5SDimitry Andric 
kill(pid_t pid,int sig)410b57cec5SDimitry Andric int kill(pid_t pid, int sig) {
420b57cec5SDimitry Andric   // is the app trying to kill itself
430b57cec5SDimitry Andric   if (pid == getpid())
440b57cec5SDimitry Andric     exit(sig);
450b57cec5SDimitry Andric   //
460b57cec5SDimitry Andric   llvm_unreachable("Not implemented!");
470b57cec5SDimitry Andric }
480b57cec5SDimitry Andric 
tcsetattr(int fd,int optional_actions,const struct termios * termios_p)490b57cec5SDimitry Andric int tcsetattr(int fd, int optional_actions, const struct termios *termios_p) {
500b57cec5SDimitry Andric   llvm_unreachable("Not implemented!");
510b57cec5SDimitry Andric }
520b57cec5SDimitry Andric 
tcgetattr(int fildes,struct termios * termios_p)530b57cec5SDimitry Andric int tcgetattr(int fildes, struct termios *termios_p) {
540b57cec5SDimitry Andric   //  assert( !"Not implemented!" );
550b57cec5SDimitry Andric   // error return value (0=success)
560b57cec5SDimitry Andric   return -1;
570b57cec5SDimitry Andric }
580b57cec5SDimitry Andric 
590b57cec5SDimitry Andric #endif
60