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

Commit

Permalink
Import fallocate in sys/linux/fcntl.d
Browse files Browse the repository at this point in the history
This adds prototypes for posix_fallocate (which was present but
commented out) and the linux-specific fallocate
(http://man7.org/linux/man-pages/man2/fallocate.2.html).
  • Loading branch information
mrkline committed Aug 23, 2015
1 parent f32849f commit 95f054a
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 1 deletion.
1 change: 1 addition & 0 deletions mak/COPY
Expand Up @@ -61,6 +61,7 @@ COPY=\
$(IMPDIR)\core\sys\linux\epoll.d \
$(IMPDIR)\core\sys\linux\errno.d \
$(IMPDIR)\core\sys\linux\execinfo.d \
$(IMPDIR)\core\sys\linux\fcntl.d \
$(IMPDIR)\core\sys\linux\link.d \
$(IMPDIR)\core\sys\linux\termios.d \
$(IMPDIR)\core\sys\linux\time.d \
Expand Down
24 changes: 24 additions & 0 deletions src/core/sys/linux/fcntl.d
@@ -0,0 +1,24 @@
module core.sys.linux.fcntl;

public import core.sys.posix.fcntl;

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

// From Linux's unistd.h, stdio.h, and linux/fs.h
enum {
SEEK_DATA = 3,
SEEK_HOLE = 4
}

// From linux/falloc.h
enum {
FALLOC_FL_KEEP_SIZE = 0x01,
FALLOC_FL_PUNCH_HOLE = 0x02,
FALLOC_FL_NO_HIDE_STALE = 0x04
}

// Linux-specific fallocate
// (http://man7.org/linux/man-pages/man2/fallocate.2.html)
int fallocate(int fd, int mode, off_t offset, off_t len);
4 changes: 3 additions & 1 deletion src/core/sys/posix/fcntl.d
Expand Up @@ -541,6 +541,9 @@ else
int fcntl(int, int, ...);
//int open(in char*, int, ...);

// Generic Posix fallocate
int posix_fallocate(int, off_t, off_t);

//
// Advisory Information (ADV)
//
Expand All @@ -553,5 +556,4 @@ POSIX_FADV_DONTNEED
POSIX_FADV_NOREUSE
int posix_fadvise(int, off_t, off_t, int);
int posix_fallocate(int, off_t, off_t);
*/
3 changes: 3 additions & 0 deletions win32.mak
Expand Up @@ -382,6 +382,9 @@ $(IMPDIR)\core\sys\linux\errno.d : src\core\sys\linux\errno.d
$(IMPDIR)\core\sys\linux\execinfo.d : src\core\sys\linux\execinfo.d
copy $** $@

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

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

Expand Down
3 changes: 3 additions & 0 deletions win64.mak
Expand Up @@ -392,6 +392,9 @@ $(IMPDIR)\core\sys\linux\errno.d : src\core\sys\linux\errno.d
$(IMPDIR)\core\sys\linux\execinfo.d : src\core\sys\linux\execinfo.d
copy $** $@

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

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

Expand Down

0 comments on commit 95f054a

Please sign in to comment.