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

Commit

Permalink
Add linux-specific core.sys.linux.sys.file module
Browse files Browse the repository at this point in the history
This adds core.sys.linux.file module which contains
flock function definition and values of the parameters
to pass.
  • Loading branch information
Burgos committed Nov 3, 2016
1 parent ee1b9b2 commit 5d31c42
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions mak/COPY
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ COPY=\
$(IMPDIR)\core\sys\linux\unistd.d \
\
$(IMPDIR)\core\sys\linux\sys\auxv.d \
$(IMPDIR)\core\sys\linux\sys\file.d \
$(IMPDIR)\core\sys\linux\sys\inotify.d \
$(IMPDIR)\core\sys\linux\sys\mman.d \
$(IMPDIR)\core\sys\linux\sys\signalfd.d \
Expand Down
34 changes: 34 additions & 0 deletions src/core/sys/linux/sys/file.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* D header file for Linux file ops.
*
* Copyright: Copyright Nemanja Boric 2016.
* License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
* Authors: Nemanja Boric
*/
module core.sys.linux.sys.file;

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

/* Operations for the `flock' call. */
/// Shared lock
enum LOCK_SH = 0x01;
/// Exclusive lock
enum LOCK_EX = 0x02;
/// Unlock
enum LOCK_UN = 0x08;

/// Don't block when locking.
/// Can be OR'd into one of the above.
enum LOCK_NB = 0x04;

/// Apply or remove an advisory lock on an open file
/// Params:
/// fd = file to apply or remove lock from
/// operation = lock operation to perform
/// Returns:
/// 0 on success, -1 on failure, with .errno
/// set appropriately.
int flock(int fd, int operation) @trusted;
3 changes: 3 additions & 0 deletions win32.mak
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,9 @@ $(IMPDIR)\core\sys\linux\unistd.d : src\core\sys\linux\unistd.d
$(IMPDIR)\core\sys\linux\sys\auxv.d : src\core\sys\linux\sys\auxv.d
copy $** $@

$(IMPDIR)\core\sys\linux\sys\file.d : src\core\sys\linux\sys\file.d
copy $** $@

$(IMPDIR)\core\sys\linux\sys\inotify.d : src\core\sys\linux\sys\inotify.d
copy $** $@

Expand Down
3 changes: 3 additions & 0 deletions win64.mak
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,9 @@ $(IMPDIR)\core\sys\linux\unistd.d : src\core\sys\linux\unistd.d
$(IMPDIR)\core\sys\linux\sys\auxv.d : src\core\sys\linux\sys\auxv.d
copy $** $@

$(IMPDIR)\core\sys\linux\sys\file.d : src\core\sys\linux\sys\file.d
copy $** $@

$(IMPDIR)\core\sys\linux\sys\inotify.d : src\core\sys\linux\sys\inotify.d
copy $** $@

Expand Down

0 comments on commit 5d31c42

Please sign in to comment.