diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2019-08-21 18:13:02 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2019-08-21 18:13:02 +0000 | 
| commit | 54db30ce18663e6c2991958f3b5d18362e8e93c4 (patch) | |
| tree | 4aa6442802570767398cc83ba484e97b1309bdc2 /contrib/llvm/lib/Support/Unix/Process.inc | |
| parent | 35284c22e9c8348159b7ce032ea45f2cdeb65298 (diff) | |
| parent | e6d1592492a3a379186bfb02bd0f4eda0669c0d5 (diff) | |
Notes
Diffstat (limited to 'contrib/llvm/lib/Support/Unix/Process.inc')
| -rw-r--r-- | contrib/llvm/lib/Support/Unix/Process.inc | 20 | 
1 files changed, 10 insertions, 10 deletions
diff --git a/contrib/llvm/lib/Support/Unix/Process.inc b/contrib/llvm/lib/Support/Unix/Process.inc index 3185f45a3a61..4115ee396582 100644 --- a/contrib/llvm/lib/Support/Unix/Process.inc +++ b/contrib/llvm/lib/Support/Unix/Process.inc @@ -1,9 +1,8 @@  //===- Unix/Process.cpp - Unix Process Implementation --------- -*- C++ -*-===//  // -//                     The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception  //  //===----------------------------------------------------------------------===//  // @@ -33,10 +32,7 @@  #if HAVE_SIGNAL_H  #include <signal.h>  #endif -// DragonFlyBSD, and OpenBSD have deprecated <malloc.h> for -// <stdlib.h> instead. Unix.h includes this for us already. -#if defined(HAVE_MALLOC_H) && !defined(__DragonFly__) && \ -    !defined(__OpenBSD__)  +#if defined(HAVE_MALLINFO)  #include <malloc.h>  #endif  #if defined(HAVE_MALLCTL) @@ -73,7 +69,7 @@ static std::pair<std::chrono::microseconds, std::chrono::microseconds> getRUsage  // On Cygwin, getpagesize() returns 64k(AllocationGranularity) and  // offset in mmap(3) should be aligned to the AllocationGranularity. -unsigned Process::getPageSize() { +Expected<unsigned> Process::getPageSize() {  #if defined(HAVE_GETPAGESIZE)    static const int page_size = ::getpagesize();  #elif defined(HAVE_SYSCONF) @@ -81,6 +77,9 @@ unsigned Process::getPageSize() {  #else  #error Cannot get the page size on this machine  #endif +  if (page_size == -1) +    return errorCodeToError(std::error_code(errno, std::generic_category())); +    return static_cast<unsigned>(page_size);  } @@ -292,7 +291,8 @@ static unsigned getColumns(int FileID) {    unsigned Columns = 0; -#if defined(HAVE_SYS_IOCTL_H) && defined(HAVE_TERMIOS_H) +#if defined(HAVE_SYS_IOCTL_H) && defined(HAVE_TERMIOS_H) \ +  && !(defined(_XOPEN_SOURCE) || defined(_POSIX_C_SOURCE))    // Try to determine the width of the terminal.    struct winsize ws;    if (ioctl(FileID, TIOCGWINSZ, &ws) == 0)  | 
