diff --git a/mak/COPY b/mak/COPY index 58ed65e7b1..9e4f544109 100644 --- a/mak/COPY +++ b/mak/COPY @@ -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 \ diff --git a/src/core/sys/linux/sys/file.d b/src/core/sys/linux/sys/file.d new file mode 100644 index 0000000000..ccdfd24503 --- /dev/null +++ b/src/core/sys/linux/sys/file.d @@ -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; diff --git a/win32.mak b/win32.mak index 109a44adc8..e19718c2d5 100644 --- a/win32.mak +++ b/win32.mak @@ -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 $** $@ diff --git a/win64.mak b/win64.mak index ddded63a08..16b7ffe0c4 100644 --- a/win64.mak +++ b/win64.mak @@ -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 $** $@