Windows: Cleaned up included CRT headers. The set `errno` value in `os::kill()` is never checked (especially on Windows), so `_set_errno()` and thus `errno.h` were removed.
The `fcntl.h` is used only to provide `O_CREAT` etc., and so belonged in `open.hpp`, not `windows.hpp`. The remaining headers, `direct.h`, `io.h`, `process.h`, and `stdlib.h` were no longer used or needed as the respective CRT APIs were replaced. Review: https://reviews.apache.org/r/66445 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/8ded8cc0 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/8ded8cc0 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/8ded8cc0 Branch: refs/heads/master Commit: 8ded8cc0e0b7b44d4d6eebd936f1e1f4f7551842 Parents: e765f8f Author: Andrew Schwartzmeyer <[email protected]> Authored: Tue Apr 3 11:43:57 2018 -0700 Committer: Andrew Schwartzmeyer <[email protected]> Committed: Tue May 1 18:36:04 2018 -0700 ---------------------------------------------------------------------- 3rdparty/stout/include/stout/os/windows/kill.hpp | 1 - 3rdparty/stout/include/stout/os/windows/mkdtemp.hpp | 2 -- 3rdparty/stout/include/stout/os/windows/open.hpp | 2 ++ 3rdparty/stout/include/stout/os/windows/rmdir.hpp | 3 --- 3rdparty/stout/include/stout/os/windows/sendfile.hpp | 2 -- 3rdparty/stout/include/stout/windows.hpp | 8 +------- 3rdparty/stout/include/stout/windows/dynamiclibrary.hpp | 3 +-- 3rdparty/stout/include/stout/windows/os.hpp | 8 +++----- 8 files changed, 7 insertions(+), 22 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/8ded8cc0/3rdparty/stout/include/stout/os/windows/kill.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/stout/include/stout/os/windows/kill.hpp b/3rdparty/stout/include/stout/os/windows/kill.hpp index 9cec111..bdb8351 100644 --- a/3rdparty/stout/include/stout/os/windows/kill.hpp +++ b/3rdparty/stout/include/stout/os/windows/kill.hpp @@ -64,7 +64,6 @@ inline int kill(pid_t pid, int sig) << "Valid Signal values for Windows os::kill() are " << "'SIGTERM' and 'SIGKILL'"; - _set_errno(EINVAL); return KILL_FAIL; } http://git-wip-us.apache.org/repos/asf/mesos/blob/8ded8cc0/3rdparty/stout/include/stout/os/windows/mkdtemp.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/stout/include/stout/os/windows/mkdtemp.hpp b/3rdparty/stout/include/stout/os/windows/mkdtemp.hpp index 9181429..f742f08 100644 --- a/3rdparty/stout/include/stout/os/windows/mkdtemp.hpp +++ b/3rdparty/stout/include/stout/os/windows/mkdtemp.hpp @@ -17,8 +17,6 @@ #ifndef __STOUT_OS_WINDOWS_MKDTEMP_HPP__ #define __STOUT_OS_WINDOWS_MKDTEMP_HPP__ -#include <stdlib.h> - #include <random> #include <string> http://git-wip-us.apache.org/repos/asf/mesos/blob/8ded8cc0/3rdparty/stout/include/stout/os/windows/open.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/stout/include/stout/os/windows/open.hpp b/3rdparty/stout/include/stout/os/windows/open.hpp index 7bfaa28..701dcec 100644 --- a/3rdparty/stout/include/stout/os/windows/open.hpp +++ b/3rdparty/stout/include/stout/os/windows/open.hpp @@ -13,6 +13,8 @@ #ifndef __STOUT_OS_WINDOWS_OPEN_HPP__ #define __STOUT_OS_WINDOWS_OPEN_HPP__ +#include <fcntl.h> // For file access flags like `_O_CREAT`. + #include <string> #include <stout/error.hpp> http://git-wip-us.apache.org/repos/asf/mesos/blob/8ded8cc0/3rdparty/stout/include/stout/os/windows/rmdir.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/stout/include/stout/os/windows/rmdir.hpp b/3rdparty/stout/include/stout/os/windows/rmdir.hpp index a2926da..00821cd 100644 --- a/3rdparty/stout/include/stout/os/windows/rmdir.hpp +++ b/3rdparty/stout/include/stout/os/windows/rmdir.hpp @@ -26,11 +26,8 @@ #include <stout/os/rm.hpp> #include <stout/os/stat.hpp> -#include <stout/windows/error.hpp> - #include <stout/internal/windows/longpath.hpp> - namespace os { namespace internal { http://git-wip-us.apache.org/repos/asf/mesos/blob/8ded8cc0/3rdparty/stout/include/stout/os/windows/sendfile.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/stout/include/stout/os/windows/sendfile.hpp b/3rdparty/stout/include/stout/os/windows/sendfile.hpp index 08afb7f..594d9c7 100644 --- a/3rdparty/stout/include/stout/os/windows/sendfile.hpp +++ b/3rdparty/stout/include/stout/os/windows/sendfile.hpp @@ -13,8 +13,6 @@ #ifndef __STOUT_OS_WINDOWS_SENDFILE_HPP__ #define __STOUT_OS_WINDOWS_SENDFILE_HPP__ -#include <errno.h> - #include <stout/error.hpp> #include <stout/try.hpp> #include <stout/windows.hpp> // For `winioctl.h`. http://git-wip-us.apache.org/repos/asf/mesos/blob/8ded8cc0/3rdparty/stout/include/stout/windows.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/stout/include/stout/windows.hpp b/3rdparty/stout/include/stout/windows.hpp index 8056ad8..075ad54 100644 --- a/3rdparty/stout/include/stout/windows.hpp +++ b/3rdparty/stout/include/stout/windows.hpp @@ -30,18 +30,12 @@ #include <winioctl.h> // For `DeviceIoControl` #include <Windows.h> // For everything else. -#include <direct.h> // For `_mkdir`. -#include <errno.h> // For `_set_errno`. -#include <fcntl.h> // For file access flags like `_O_CREAT`. -#include <io.h> // For `_read`, `_write`. -#include <process.h> // For `_getpid`. -#include <stdlib.h> // For `_PATH_MAX`. - #include <sys/stat.h> // For permissions flags. #include <basetsd.h> // For `SSIZE_T`. #include <memory> +#include <type_traits> #include <glog/logging.h> http://git-wip-us.apache.org/repos/asf/mesos/blob/8ded8cc0/3rdparty/stout/include/stout/windows/dynamiclibrary.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/stout/include/stout/windows/dynamiclibrary.hpp b/3rdparty/stout/include/stout/windows/dynamiclibrary.hpp index 5b3cbf4..acfbb60 100644 --- a/3rdparty/stout/include/stout/windows/dynamiclibrary.hpp +++ b/3rdparty/stout/include/stout/windows/dynamiclibrary.hpp @@ -15,13 +15,12 @@ #include <string> +#include <stout/error.hpp> #include <stout/nothing.hpp> #include <stout/option.hpp> #include <stout/stringify.hpp> #include <stout/try.hpp> -#include <stout/windows/error.hpp> - /** * DynamicLibrary is a very simple wrapper around the programming interface * to the dynamic linking loader. http://git-wip-us.apache.org/repos/asf/mesos/blob/8ded8cc0/3rdparty/stout/include/stout/windows/os.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/stout/include/stout/windows/os.hpp b/3rdparty/stout/include/stout/windows/os.hpp index af5cb81..764e6b7 100644 --- a/3rdparty/stout/include/stout/windows/os.hpp +++ b/3rdparty/stout/include/stout/windows/os.hpp @@ -46,11 +46,9 @@ // NOTE: These system headers must be included after `stout/windows.hpp` // as they may include `Windows.h`. See comments in `stout/windows.hpp` // for why this ordering is important. -#include <direct.h> -#include <io.h> -#include <Psapi.h> -#include <TlHelp32.h> -#include <Userenv.h> +#include <Psapi.h> // For `EnumProcesses` and `GetProcessMemoryInfo`. +#include <TlHelp32.h> // For `PROCESSENTRY32W` and `CreateToolhelp32Snapshot`. +#include <Userenv.h> // For `GetAllUsersProfileDirectoryW`. namespace os { namespace internal {
