Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Move non-Posix bionic declarations into their own modules
Browse files Browse the repository at this point in the history
  • Loading branch information
joakim-noah committed Jan 31, 2016
1 parent e66c24d commit c74850f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/core/sys/bionic/fcntl.d
@@ -0,0 +1,5 @@
module core.sys.bionic.fcntl;

version(CRuntime_Bionic) extern(C) nothrow @nogc:

enum LOCK_EX = 2;
5 changes: 5 additions & 0 deletions src/core/sys/bionic/unistd.d
@@ -0,0 +1,5 @@
module core.sys.bionic.unistd;

version(CRuntime_Bionic) extern(C) nothrow @nogc:

int flock(int, int) @trusted;
2 changes: 0 additions & 2 deletions src/core/sys/posix/fcntl.d
Expand Up @@ -499,8 +499,6 @@ else version( CRuntime_Bionic )
enum F_WRLCK = 1;
enum F_UNLCK = 2;

enum LOCK_EX = 2;

version (X86)
{
enum O_CREAT = 0x40; // octal 0100
Expand Down
1 change: 0 additions & 1 deletion src/core/sys/posix/unistd.d
Expand Up @@ -1263,7 +1263,6 @@ 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;
Expand Down
6 changes: 5 additions & 1 deletion src/rt/cover.d
Expand Up @@ -399,7 +399,11 @@ version (Windows) HANDLE handle(int fd)
void lockFile(int fd)
{
version (CRuntime_Bionic)
core.sys.posix.unistd.flock(fd, LOCK_EX); // exclusive lock
{
import core.sys.bionic.fcntl : LOCK_EX;
import core.sys.bionic.unistd : flock;
flock(fd, LOCK_EX); // exclusive lock
}
else version (Posix)
lockf(fd, F_LOCK, 0); // exclusive lock
else version (Windows)
Expand Down

0 comments on commit c74850f

Please sign in to comment.