Skip to content

GHCJS patches. #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion System/Posix/Files/Common.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ foreign import ccall unsafe "fchown"
-- Note: calls @ftruncate@.
setFdSize :: Fd -> FileOffset -> IO ()
setFdSize (Fd fd) off =
throwErrnoIfMinus1_ "setFdSize" (c_ftruncate fd off)
throwErrnoIfMinus1_ "setFdSize" (c_ftruncate fd (fromIntegral off))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does this impedance mismatch occur? I'm reluctant to use a non-statically checked fromIntegral conversion which have been a common source of fileoffset overflow bugs... :-/


-- -----------------------------------------------------------------------------
-- pathconf()/fpathconf() support
Expand Down
2 changes: 1 addition & 1 deletion System/Posix/IO/Common.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ mode2Int SeekFromEnd = (#const SEEK_END)
-- | May throw an exception if this is an invalid descriptor.
fdSeek :: Fd -> SeekMode -> FileOffset -> IO FileOffset
fdSeek (Fd fd) mode off =
throwErrnoIfMinus1 "fdSeek" (Base.c_lseek fd off (mode2Int mode))
throwErrnoIfMinus1 "fdSeek" (fmap fromIntegral $ Base.c_lseek fd (fromIntegral off) (mode2Int mode))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question as above


-- -----------------------------------------------------------------------------
-- Locking
Expand Down
6 changes: 6 additions & 0 deletions System/Posix/Process/Internals.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE CApiFFI #-}
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE CPP #-}

module System.Posix.Process.Internals (
pPrPr_disableITimers, c_execvpe,
Expand All @@ -9,7 +10,12 @@ import Foreign
import Foreign.C
import System.Exit
import System.IO.Error

#ifdef ghcjs_HOST_OS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems the wrong place to kludge this around; why can't ghcjs' GHC.Conc (Signal) be used/fixed?

type Signal = CInt
#else
import GHC.Conc (Signal)
#endif

-- | The exit status of a process
data ProcessStatus
Expand Down
7 changes: 3 additions & 4 deletions System/Posix/Signals.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -432,11 +432,10 @@ installHandler :: Signal
-> Maybe SignalSet -- ^ other signals to block
-> IO Handler -- ^ old handler

#ifdef __PARALLEL_HASKELL__
##if defined(__PARALLEL_HASKELL__)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is it necessarily to delay the macro expansion?

installHandler =
error "installHandler: not available for Parallel Haskell"
#else

##else
installHandler sig handler _maybe_mask = do
ensureIOManagerIsRunning -- for the threaded RTS

Expand Down Expand Up @@ -524,7 +523,7 @@ unmarshalSigInfo fp = do
siginfoError = Errno errno,
siginfoSpecific = extra }

#endif /* !__PARALLEL_HASKELL__ */
##endif /* !__PARALLEL_HASKELL__ */

-- -----------------------------------------------------------------------------
-- Alarms
Expand Down