This repository has been archived by the owner on Oct 12, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 420
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add linux-specific
core.sys.linux.sys.file
module
This adds core.sys.linux.file module which contains flock function definition and values of the parameters to pass.
- Loading branch information
Showing
4 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters