Commit f84ad364 authored by Scott Ramsby's avatar Scott Ramsby Committed by Facebook GitHub Bot

Fix mode_t to match Linux and be overridable (#1335)

Summary:
`unsigned int` is a more typical definition of the mode_t type on Linux systems, which is what this is trying to emulate.

Also guard by checking that HAVE_MODE_T isn't already define to allow clients to suppress its definition in cases where other client-used libraries (e.g. wxWindows) have their own definition which may conflict.
Pull Request resolved: https://github.com/facebook/folly/pull/1335

Reviewed By: yfeldblum

Differential Revision: D20408879

Pulled By: scramsby

fbshipit-source-id: 511484f6513501bf595ccb9cdfb893c9d5761320
parent dacd7bf0
......@@ -21,8 +21,6 @@
#ifdef _WIN32
#include <basetsd.h> // @manual
#define HAVE_MODE_T 1
// This is a massive pain to have be an `int` due to the pthread implementation
// we support, but it's far more compatible with the rest of the windows world
// as an `int` than it would be as a `void*`
......@@ -31,7 +29,12 @@ using pid_t = int;
// appropriate place without defining a portability header for stdint.h
// with just this single typedef.
using ssize_t = SSIZE_T;
#ifndef HAVE_MODE_T
#define HAVE_MODE_T 1
// 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;
using mode_t = unsigned int;
#endif
#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