From 0a8b4b8ab97592261afa8090a8cd02c2c94d9c77 Mon Sep 17 00:00:00 2001 From: Joakim Date: Thu, 28 May 2015 15:48:42 -0500 Subject: [PATCH 1/2] Replace use of lockf with flock for Bionic --- src/core/sys/posix/fcntl.d | 2 ++ src/core/sys/posix/unistd.d | 1 + src/rt/cover.d | 4 +++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core/sys/posix/fcntl.d b/src/core/sys/posix/fcntl.d index f4a9012d7b..73e91af3ba 100644 --- a/src/core/sys/posix/fcntl.d +++ b/src/core/sys/posix/fcntl.d @@ -486,6 +486,8 @@ else version( CRuntime_Bionic ) enum F_WRLCK = 1; enum F_UNLCK = 2; + enum LOCK_EX = 2; + version (X86) { enum O_CREAT = 0x40; // octal 0100 diff --git a/src/core/sys/posix/unistd.d b/src/core/sys/posix/unistd.d index 3c75aaff2a..0b7f58566f 100644 --- a/src/core/sys/posix/unistd.d +++ b/src/core/sys/posix/unistd.d @@ -1258,6 +1258,7 @@ else version( FreeBSD ) else version( CRuntime_Bionic ) { int fchdir(int) @trusted; + int flock(int, int) @trusted; pid_t getpgid(pid_t) @trusted; int lchown(in char*, uid_t, gid_t); int nice(int) @trusted; diff --git a/src/rt/cover.d b/src/rt/cover.d index 1df2606437..9199d80a39 100644 --- a/src/rt/cover.d +++ b/src/rt/cover.d @@ -394,7 +394,9 @@ version (Windows) HANDLE handle(int fd) void lockFile(int fd) { - version (Posix) + version (CRuntime_Bionic) + core.sys.posix.unistd.flock(fd, LOCK_EX); // exclusive lock + else version (Posix) lockf(fd, F_LOCK, 0); // exclusive lock else version (Windows) { From b681a57d231accbde92f178675ff40ac602c95ab Mon Sep 17 00:00:00 2001 From: Joakim Date: Thu, 28 May 2015 15:54:35 -0500 Subject: [PATCH 2/2] Add proper ilogb constants for Bionic --- src/core/stdc/math.d | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/core/stdc/math.d b/src/core/stdc/math.d index 5d532dc17f..eca2cd63ce 100644 --- a/src/core/stdc/math.d +++ b/src/core/stdc/math.d @@ -44,6 +44,13 @@ version (FreeBSD) /// enum int FP_ILOGBNAN = int.max; } +else version (CRuntime_Bionic) +{ + /// + enum int FP_ILOGB0 = -int.max; + /// + enum int FP_ILOGBNAN = int.max; +} else { ///