summaryrefslogtreecommitdiff
path: root/libraries/base/GHC/IO/Handle
Commit message (Collapse)AuthorAgeFilesLines
* base: Introduce printToHandleFinalizerExceptionHandlerBen Gamari2023-05-162-0/+13
|
* base: Fix Note references in GHC.IO.Handle.TypesBen Gamari2023-02-031-12/+12
|
* winio: Add support to console handles to handleToHANDLETamar Christina2022-06-181-3/+5
|
* base: Throw exceptions raised while closing finalized HandlesBen Gamari2022-05-191-2/+32
| | | | Fixes #21336.
* Suggestions due to hlintMatthew Pickering2022-02-241-1/+1
| | | | | It turns out this job hasn't been running for quite a while (perhaps ever) so there are quite a few failures when running the linter locally.
* Fix a few Note inconsistenciesBen Gamari2022-02-012-3/+2
|
* Perf: remove allocation in writeBlocks and fix comment (#14309)Sylvain Henry2021-12-111-32/+39
|
* winio: use synchronous access explicitly for handles that may not be ↵Tamar Christina2021-06-081-1/+1
| | | | asynchronous.
* Add compiler linting to CIHécate2021-03-251-1/+0
| | | | | This commit adds the `lint:compiler` Hadrian target to the CI runner. It does also fixes hints in the compiler/ and libraries/base/ codebases.
* Make openFile exception safeDavid Feuer2021-02-222-53/+212
| | | | | | | | | | | | | | | | | | | * `openFile` could sometimes leak file descriptors if it received an asynchronous exception (#19114, #19115). Fix this on POSIX. * `openFile` and more importantly `openFileBlocking` could not be interrupted effectively during the `open` system call (#17912). Fix this on POSIX. * Implement `readFile'` using `withFile` to ensure the file is closed promptly on exception. * Avoid `bracket` in `withFile`, reducing the duration of masking. Closes #19130. Addresses #17912, #19114, and #19115 on POSIX systems, but not on Windows.
* Import fcntl with capi calling conventionOleg Grenrus2021-01-171-0/+1
| | | | See https://gitlab.haskell.org/ghc/ghc/-/issues/18854
* Fix calls to varargs C function fcntlNick Erdmann2021-01-091-1/+2
| | | | | | The ccall calling convention doesn't support varargs functions, so switch to capi instead. See https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/ffi.html#varargs-not-supported-by-ccall-calling-convention
* base: Reintroduce necessary LANGUAGE pragmasBen Gamari2020-10-161-0/+2
| | | | These were incorrectly removed in a recent cleanup commit.
* winio: fixed bytestring reading interface.Tamar Christina2020-10-091-3/+8
|
* Add linting of `base` to the CIHécate2020-10-092-3/+1
|
* Update Lock.hs with more documentation to make sure that the Boolean return ↵syd@cs-syd.eu2020-09-241-0/+2
| | | | | | value is clear. [skip ci]
* Remove redundant "do", "return" and language extensions from baseHécate2020-09-232-83/+76
|
* Remove all the unnecessary LANGUAGE pragmasHécate2020-08-051-2/+0
|
* winio: flushCharReadBuffer shouldn't need to adjust offsets.Andreas Klebinger2020-07-151-5/+8
|
* winio: Remove historical todosAndreas Klebinger2020-07-151-3/+0
|
* winio: Remove redundant buffer write in Handle/Text.hs:bufReadEmptyAndreas Klebinger2020-07-151-2/+1
|
* winio: Remove commented out pragmaAndreas Klebinger2020-07-151-1/+0
|
* winio: Fix importsBen Gamari2020-07-151-3/+0
|
* winio: Set handle offset when opening files in Append mode.Andreas Klebinger2020-07-154-6/+40
| | | | Otherwise we would truncate the file.
* winio: Fix offset set by bufReadEmpty.Andreas Klebinger2020-07-152-18/+32
| | | | | | | bufReadEmpty returns the bytes read *including* content that was already buffered, But for calculating the offset we only care about the number of bytes read into the new buffer.
* winio: Rewrite bufWrite.Andreas Klebinger2020-07-152-56/+75
| | | | | | I think it's far easier to follow the code now. It's also correct now as I had still missed a spot where we didn't update the offset.
* winio: Fix output truncation for writes larger than buffer sizeAndreas Klebinger2020-07-151-4/+11
|
* winio: Fix input truncation when reading from handle.Andreas Klebinger2020-07-151-13/+24
| | | | | This was caused by not upholding the read buffer invariant that bufR == bufL == 0 for empty read buffers.
* winio: Implement new tempfile routines for winioTamar Christina2020-07-151-1/+1
|
* winio: Multiple refactorings and support changes.Tamar Christina2020-07-151-16/+68
|
* winio: Implement new Console APITamar Christina2020-07-151-0/+239
|
* winio: Refactor Buffer structures to be able to track async operationsTamar Christina2020-07-153-58/+78
|
* base: Enable large file support for OFD locking impl.Ben Gamari2020-04-141-0/+3
| | | | | Not only is this a good idea in general but this should also avoid issue #17950 by ensuring that off_t is 64-bits.
* Fix the changelog/@since information for hGetContents'/getContents'/readFile'Ryan Scott2020-04-011-1/+1
| | | | | | Fixes #17979. [ci skip]
* base: add strict IO functions: readFile', getContents', hGetContents'Lysxia2020-03-161-1/+86
|
* Disable two warnings for files that trigger themTom Ellis2020-01-271-0/+1
| | | | | | incomplete-uni-patterns and incomplete-record-updates will be in -Wall at a future date, so prepare for that by disabling those warnings on files that trigger them.
* Document the fact, that openFileBlocking can consume an OS thread indefinitely.Gabor Greif2020-01-251-0/+5
| | | | Also state that a deadlock can happen with the non-threaded runtime. [ci skip]
* Fix typos, via a Levenshtein-style correctorBrian Wignall2020-01-043-3/+3
|
* base: Fix <unistd.h> #includeBen Gamari2019-12-021-2/+2
| | | | | | | Previously we were including <sys/unistd.h> which is available on glibc but not musl. (cherry picked from commit e44b695ca7cb5f3f99eecfba05c9672c6a22205e)
* base: Add missing imports in Windows locking implementationBen Gamari2019-11-071-0/+3
|
* base: Split up file locking implementationBen Gamari2019-10-297-284/+347
| | | | This makes the CPP significantly easier to follow.
* base: Fix open-file lockingBen Gamari2019-10-291-19/+37
| | | | | | | | | The OFD locking path introduced in 3b784d440d4b01b4c549df7c9a3ed2058edfc780 due to #13945 appears to have never actually worked but we never noticed due to an oversight in the autoconf check. Fix it. Thanks to Oleg Grenrus for noticing this.
* base: Add @since on GHC.IO.Handle.Lock.hUnlockBen Gamari2019-10-231-0/+2
| | | | | | Unfortunately this was introduced in base-4.11.0 (GHC 8.4.1) whereas the other locking primitives were added in base-4.10.0 (GHC 8.2.1).
* Properly escape character literals in HaddocksAlec Theriault2019-02-151-6/+6
| | | | | | | | Character literals in Haddock should not be written as plain `'\n'` since single quotes are for linking identifiers. Besides, since we want the character literal to be monospaced, we really should use `@\'\\n\'@`. [skip ci]
* Remove OPTIONS_HADDOCK hide in favour for not-homeAdam Sandberg Eriksson2019-01-063-3/+3
| | | | GHC Trac Issues: #15447
* base: Mention openFile throwing does-not-exist-errors on FIFOsBen Gamari2018-11-221-1/+3
| | | | | | | | | | | | | | | | | | As discussed in #15715, the POSIX specification specifies that attempting to open a FIFO in write-only mode when the FIFO has no readers will fail with -ENOENT. [skip ci] Test Plan: Read it Reviewers: hvr Subscribers: rwbarton, carter GHC Trac Issues: #15715 Differential Revision: https://phabricator.haskell.org/D5295
* base: Add bangs to GHC.IO.Handle.Text hGet* functionsBen Gamari2018-09-171-3/+3
| | | | | | | | | | | | | | | | | | Summary: I believe that demand analysis doesn't notice that these are morally strict in the pointer argument due to the `count == 0` special case. Fixes #15638. Test Plan: Validate Reviewers: andrewthad, hvr Reviewed By: andrewthad Subscribers: rwbarton, carter GHC Trac Issues: #15638 Differential Revision: https://phabricator.haskell.org/D5149
* Fix ambiguous/out-of-scope Haddock identifiersAlec Theriault2018-08-212-12/+14
| | | | | | | | | | | | | | | | | This drastically cuts down on the number of Haddock warnings when making docs for `base`. Plus this means more actual links end up in the docs! Also fixed other small mostly markup issues in the documentation along the way. This is a docs-only change. Reviewers: hvr, bgamari, thomie Reviewed By: thomie Subscribers: thomie, rwbarton, carter Differential Revision: https://phabricator.haskell.org/D5055
* Add @since annotations for derived instances in baseChaitanya Koparkar2018-03-022-4/+17
| | | | | | | | | | | | | | Test Plan: ./validate Reviewers: hvr, goldfire, bgamari, RyanGlScott Reviewed By: RyanGlScott Subscribers: rwbarton, thomie, carter GHC Trac Issues: #11767 Differential Revision: https://phabricator.haskell.org/D4452
* Add NOINLINE pragma to hPutStr'Matthew Pickering2017-12-111-0/+1
| | | | | | | | | | | | | | There appears to be no benefit in inlining this function. If you turn up the unfolding threshold a lot then it eventually inlines which produces a bit unoptimisable program. Reviewers: hvr, bgamari Reviewed By: bgamari Subscribers: rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4246