Commit 30ec44d3 authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot 8

Create the sys/types.h portability header

Summary: Windows has it, but it doesn't define pid_t. It also doesn't define ssize_t, and it's not worth a separate header for a single typedef, so define it here as well.

Reviewed By: yfeldblum

Differential Revision: D3001168

fb-gh-sync-id: 3722270181c200bbcf39043960f81609c854b132
shipit-source-id: 3722270181c200bbcf39043960f81609c854b132
parent 2f595596
...@@ -273,6 +273,7 @@ nobase_follyinclude_HEADERS = \ ...@@ -273,6 +273,7 @@ nobase_follyinclude_HEADERS = \
portability/Strings.h \ portability/Strings.h \
portability/Syscall.h \ portability/Syscall.h \
portability/SysTime.h \ portability/SysTime.h \
portability/SysTypes.h \
portability/SysUio.h \ portability/SysUio.h \
portability/Time.h \ portability/Time.h \
Preprocessor.h \ Preprocessor.h \
......
...@@ -307,11 +307,7 @@ namespace std { typedef ::max_align_t max_align_t; } ...@@ -307,11 +307,7 @@ namespace std { typedef ::max_align_t max_align_t; }
// MSVC specific defines // MSVC specific defines
// mainly for posix compat // mainly for posix compat
#ifdef _MSC_VER #ifdef _MSC_VER
#include <folly/portability/SysTypes.h>
// this definition is in a really silly place with a silly name
// and ifdefing it every time we want it is painful
#include <basetsd.h>
typedef SSIZE_T ssize_t;
// sprintf semantics are not exactly identical // sprintf semantics are not exactly identical
// but current usage is not a problem // but current usage is not a problem
......
/*
* Copyright 2016 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <sys/types.h>
#ifdef _WIN32
#include <basetsd.h>
#define HAVE_MODE_T 1
// This is actually defined in our pthread implementation on
// Windows, but we don't want to include all of that just for this.
using pid_t = void*;
// This isn't actually supposed to be defined here, but it's the most
// appropriate place without defining a portability header for stdint.h
// with just this single typedef.
using ssize_t = SSIZE_T;
// The Windows headers don't define this anywhere, nor do any of the libs
// that Folly depends on, so define it here.
using mode_t = unsigned short;
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment