diff options
author | Tamar Christina <tamar@zhox.com> | 2018-03-29 14:22:09 +0100 |
---|---|---|
committer | Tamar Christina <tamar@zhox.com> | 2018-03-31 10:11:53 +0100 |
commit | 4de585a5c1ac3edc2914cebcac1753b514051a89 (patch) | |
tree | 09bfb4251808007bb4ad79c6f10f3e4fbe3e9312 /utils/fs/fs.h | |
parent | afb686a88901d7d0c93627806d7e4d0444aa17e8 (diff) | |
download | haskell-4de585a5c1ac3edc2914cebcac1753b514051a89.tar.gz |
Remove MAX_PATH restrictions from RTS, I/O manager and various utilities
Summary:
This shims out fopen and sopen so that they use modern APIs under the hood
along with namespaced paths.
This lifts the MAX_PATH restrictions from Haskell programs and makes the new
limit ~32k.
There are only some slight caveats that have been documented.
Some utilities have not been upgraded such as lndir, since all these things are
different cabal packages I have been forced to copy the source in different places
which is less than ideal. But it's the only way to keep sdist working.
Test Plan: ./validate
Reviewers: hvr, bgamari, erikd, simonmar
Reviewed By: bgamari
Subscribers: rwbarton, thomie, carter
GHC Trac Issues: #10822
Differential Revision: https://phabricator.haskell.org/D4416
Diffstat (limited to 'utils/fs/fs.h')
-rw-r--r-- | utils/fs/fs.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/utils/fs/fs.h b/utils/fs/fs.h new file mode 100644 index 0000000000..ab2eded2a1 --- /dev/null +++ b/utils/fs/fs.h @@ -0,0 +1,36 @@ +/* ----------------------------------------------------------------------------- + * + * (c) Tamar Christina 2018 + * + * Windows I/O routines for file opening. + * + * NOTE: Only modify this file in utils/fs/ and rerun configure. Do not edit + * this file in any other directory as it will be overwritten. + * + * ---------------------------------------------------------------------------*/ + +#pragma once + +#include <stdio.h> + +#if !defined(FS_NAMESPACE) +#define FS_NAMESPACE hs +#endif + +/* Play some dirty tricks to get CPP to expand correctly. */ +#define FS_FULL(ns, name) __##ns##_##name +#define prefix FS_NAMESPACE +#define FS_L(p, n) FS_FULL(p, n) +#define FS(name) FS_L(prefix, name) + +#if defined(_WIN32) +#include <wchar.h> + +int FS(swopen) (const wchar_t* filename, int oflag, + int shflag, int pmode); +FILE *FS(fwopen) (const wchar_t* filename, const wchar_t* mode); +FILE *FS(fopen) (const char* filename, const char* mode); +#else + +FILE *FS(fopen) (const char* filename, const char* mode); +#endif |