[PATCH] D47688: [Support] Add functions that return native file handles on Windows instead of fds.

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 3 10:08:10 PDT 2018


zturner created this revision.
zturner added reviewers: rnk, amccarth.
Herald added a subscriber: hiraditya.

Windows' CRT has a limit of 512 open file descriptors, and fds which are generated by converting a `HANDLE` via `_get_osfhandle` count towards this limit as well.

Regardless, often you find yourself marshalling back and forth between native `HANDLE` objects and fds anyway.  If we know from the getgo that we're going to need to work directly with the handle, we can cut out the marshalling layer while also not contributing to filling up the CRT's very limited handle table.

On Unix these functions just delegate directly to the existing set of functions since an fd *is* the native file type.  It would be nice, very long term, if we could convert most uses of fds to `native_file_t`.


https://reviews.llvm.org/D47688

Files:
  llvm/include/llvm/Support/FileSystem.h
  llvm/lib/Support/Unix/Path.inc
  llvm/lib/Support/Windows/Path.inc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47688.149649.patch
Type: text/x-patch
Size: 7806 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180603/43dd538f/attachment.bin>


More information about the llvm-commits mailing list