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

Commit

Permalink
Merge pull request #1357 from mrkline/move-hole-seek
Browse files Browse the repository at this point in the history
Place SEEK_DATA, SEEK_HOLE in core.sys.linux.unistd
  • Loading branch information
DmitryOlshansky committed Sep 2, 2015
2 parents de5a0bc + 8912751 commit 4e799b7
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 9 deletions.
1 change: 1 addition & 0 deletions mak/COPY
Expand Up @@ -66,6 +66,7 @@ COPY=\
$(IMPDIR)\core\sys\linux\termios.d \
$(IMPDIR)\core\sys\linux\time.d \
$(IMPDIR)\core\sys\linux\tipc.d \
$(IMPDIR)\core\sys\linux\unistd.d \
\
$(IMPDIR)\core\sys\linux\sys\inotify.d \
$(IMPDIR)\core\sys\linux\sys\mman.d \
Expand Down
6 changes: 3 additions & 3 deletions src/core/stdc/stdio.d
Expand Up @@ -222,11 +222,11 @@ else

enum
{
///
/// Offset is relative to the beginning
SEEK_SET,
///
/// Offset is relative to the current position
SEEK_CUR,
///
/// Offset is relative to the end
SEEK_END
}

Expand Down
6 changes: 0 additions & 6 deletions src/core/sys/linux/fcntl.d
Expand Up @@ -6,12 +6,6 @@ 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,
Expand Down
17 changes: 17 additions & 0 deletions src/core/sys/linux/unistd.d
@@ -0,0 +1,17 @@
module core.sys.linux.unistd;

public import core.sys.posix.unistd;

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

// Additional seek constants for sparse file handling
// from Linux's unistd.h, stdio.h, and linux/fs.h
// (see http://man7.org/linux/man-pages/man2/lseek.2.html)
enum {
/// Offset is relative to the next location containing data
SEEK_DATA = 3,
/// Offset is relative to the next hole (or EOF if file is not sparse)
SEEK_HOLE = 4
}
3 changes: 3 additions & 0 deletions win32.mak
Expand Up @@ -397,6 +397,9 @@ $(IMPDIR)\core\sys\linux\time.d : src\core\sys\linux\time.d
$(IMPDIR)\core\sys\linux\tipc.d : src\core\sys\linux\tipc.d
copy $** $@

$(IMPDIR)\core\sys\linux\unistd.d : src\core\sys\linux\unistd.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
Expand Up @@ -407,6 +407,9 @@ $(IMPDIR)\core\sys\linux\time.d : src\core\sys\linux\time.d
$(IMPDIR)\core\sys\linux\tipc.d : src\core\sys\linux\tipc.d
copy $** $@

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

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

Expand Down

0 comments on commit 4e799b7

Please sign in to comment.