Skip to content
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

[WIP] conditional compilation around at_fdcwd , at_symlink_follow #76

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion unliftio/cbits/file-posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ int unliftio_o_tmpfile( void )
#endif
}

#if OLD_GLIBC
#else
int unliftio_at_fdcwd( void )
{
return AT_FDCWD;
Expand All @@ -20,7 +22,7 @@ int unliftio_at_symlink_follow( void )
{
return AT_SYMLINK_FOLLOW;
}

#endif

int unliftio_s_irusr( void )
{
Expand Down
2 changes: 1 addition & 1 deletion unliftio/src/UnliftIO/IO/File.hs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ import Data.ByteString as B (ByteString, writeFile)
import Control.Monad.IO.Unlift
import UnliftIO.IO (Handle, IOMode(..), withBinaryFile)

#if WINDOWS
#if (WINDOWS || OLD-GLIBC)
Copy link
Member

Choose a reason for hiding this comment

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

It would be nice to have some kind of a changelog entry explaining this change and what the impact of enabling the flag would be.



ensureFileDurable = (`seq` pure ())
Expand Down
8 changes: 8 additions & 0 deletions unliftio/unliftio.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ extra-source-files:
README.md
ChangeLog.md

flag old-glibc
description: compile with post-2016 glibc, allowing atomic file writes
Copy link
Member

Choose a reason for hiding this comment

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

Looks like the logic is reversed here. This flag seems to enable the old glibc.

default: False
manual: False
Copy link
Member

Choose a reason for hiding this comment

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

This should be manual: True, right? We don't want the dep solver trying to change this flag.


library
exposed-modules:
UnliftIO
Expand Down Expand Up @@ -85,6 +90,8 @@ library
c-sources:
cbits/file-posix.c
cbits/time-posix.c
if flag(old-glibc)
cpp-options: -DOLD_GLIBC
default-language: Haskell2010

test-suite unliftio-spec
Expand Down Expand Up @@ -151,3 +158,4 @@ benchmark conc-bench
build-depends:
unix
default-language: Haskell2010