The Windows SDK provides a version of signal() that is much more limited compared to other platforms. It only supports about 5-6 signal values. LLDB uses signals for a number of things, most notably to handle Ctrl+C so we can gracefully shut down. The portability solution to this on Windows has been to provide a hand-rolled implementation of `signal` using the name `signal` so that you could write code that simply calls signal directly and it would work. But this introduces a multiply defined symbol with the builtin version and depending on how you included header files, you could get yourself into a situation where you had linker errors. To make matters worse, it led to a ton of compiler warnings. Worst of all though is that this custom implementation of signal was, in fact, identical for the purposes of handling Ctrl+C as the builtin implementation of signal. So it seems to have literally not been serving any useful purpose. This patch deletes all the custom signal() functions for Windows, and includes the signal.h system header, so that any calls to signal now go to the actual version provided by the Windows SDK. Differential Revision: http://reviews.llvm.org/D18287 llvm-svn: 263858
73 lines
1.6 KiB
C++
73 lines
1.6 KiB
C++
//===-- Platform.cpp --------------------------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// this file is only relevant for Visual C++
|
|
#if defined( _WIN32 )
|
|
|
|
#include <process.h>
|
|
#include <assert.h>
|
|
#include <stdlib.h>
|
|
|
|
#include "Platform.h"
|
|
|
|
int
|
|
ioctl (int d, int request, ...)
|
|
{
|
|
switch ( request )
|
|
{
|
|
// request the console windows size
|
|
case ( TIOCGWINSZ ):
|
|
{
|
|
va_list vl;
|
|
va_start(vl,request);
|
|
// locate the window size structure on stack
|
|
winsize *ws = va_arg(vl, winsize*);
|
|
// get screen buffer information
|
|
CONSOLE_SCREEN_BUFFER_INFO info;
|
|
if ( GetConsoleScreenBufferInfo( GetStdHandle( STD_OUTPUT_HANDLE ), &info ) == TRUE )
|
|
// fill in the columns
|
|
ws->ws_col = info.dwMaximumWindowSize.X;
|
|
va_end(vl);
|
|
return 0;
|
|
}
|
|
break;
|
|
default:
|
|
assert( !"Not implemented!" );
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
int
|
|
kill (pid_t pid, int sig)
|
|
{
|
|
// is the app trying to kill itself
|
|
if ( pid == getpid( ) )
|
|
exit( sig );
|
|
//
|
|
assert( !"Not implemented!" );
|
|
return -1;
|
|
}
|
|
|
|
int
|
|
tcsetattr (int fd, int optional_actions, const struct termios *termios_p)
|
|
{
|
|
assert( !"Not implemented!" );
|
|
return -1;
|
|
}
|
|
|
|
int
|
|
tcgetattr (int fildes, struct termios *termios_p)
|
|
{
|
|
// assert( !"Not implemented!" );
|
|
// error return value (0=success)
|
|
return -1;
|
|
}
|
|
|
|
#endif
|