voldemort.store.readonly.io.jna
Class fcntl

java.lang.Object
  extended by voldemort.store.readonly.io.jna.fcntl

public class fcntl
extends java.lang.Object


Field Summary
static int POSIX_FADV_DONTNEED
           
static int POSIX_FADV_NOREUSE
           
static int POSIX_FADV_NORMAL
           
static int POSIX_FADV_RANDOM
           
static int POSIX_FADV_SEQUENTIAL
           
static int POSIX_FADV_WILLNEED
           
 
Constructor Summary
fcntl()
           
 
Method Summary
static int posix_fadvise(int fd, long offset, long len, int advice)
          posix documentation Actual Linux implementation resides here: http://lxr.linux.no/linux+v3.0.3/mm/fadvise.c#L77
static int posix_fallocate(int fd, long offset, long len)
          posix documentation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POSIX_FADV_NORMAL

public static final int POSIX_FADV_NORMAL
See Also:
Constant Field Values

POSIX_FADV_RANDOM

public static final int POSIX_FADV_RANDOM
See Also:
Constant Field Values

POSIX_FADV_SEQUENTIAL

public static final int POSIX_FADV_SEQUENTIAL
See Also:
Constant Field Values

POSIX_FADV_WILLNEED

public static final int POSIX_FADV_WILLNEED
See Also:
Constant Field Values

POSIX_FADV_DONTNEED

public static final int POSIX_FADV_DONTNEED
See Also:
Constant Field Values

POSIX_FADV_NOREUSE

public static final int POSIX_FADV_NOREUSE
See Also:
Constant Field Values
Constructor Detail

fcntl

public fcntl()
Method Detail

posix_fadvise

public static int posix_fadvise(int fd,
                                long offset,
                                long len,
                                int advice)
                         throws java.io.IOException
posix documentation Actual Linux implementation resides here: http://lxr.linux.no/linux+v3.0.3/mm/fadvise.c#L77

posix_fadvise - predeclare an access pattern for file data

Synopsis

#include

int posix_fadvise(int fd, off_t offset, off_t len, int advice);

Feature Test Macro Requirements for glibc (see feature_test_macros(7)): posix_fadvise(): _XOPEN_SOURCE >= 600 || _POSIX_C_SOURCE >= 200112L

Description

Programs can use posix_fadvise() to announce an intention to access file data in a specific pattern in the future, thus allowing the kernel to perform appropriate optimizations. The advice applies to a (not necessarily existent) region starting at offset and extending for len bytes (or until the end of the file if len is 0) within the file referred to by fd. The advice is not binding; it merely constitutes an expectation on behalf of the application.

Permissible values for advice include:

POSIX_FADV_NORMAL

Indicates that the application has no advice to give about its access pattern for the specified data. If no advice is given for an open file, this is the default assumption.

POSIX_FADV_SEQUENTIAL

The application expects to access the specified data sequentially (with lower offsets read before higher ones).

POSIX_FADV_RANDOM

The specified data will be accessed in random order.

POSIX_FADV_NOREUSE

The specified data will be accessed only once.

POSIX_FADV_WILLNEED

The specified data will be accessed in the near future.

POSIX_FADV_DONTNEED

The specified data will not be accessed in the near future.

Return Value On success, zero is returned. On error, an error number is returned. java documentation We do not return -1 if we fail but instead throw an IOException

Throws:
java.io.IOException - if this call fails.

posix_fallocate

public static int posix_fallocate(int fd,
                                  long offset,
                                  long len)
                           throws java.io.IOException
posix documentation

The function posix_fallocate() ensures that disk space is allocated for the file referred to by the descriptor fd for the bytes in the range starting at offset and continuing for len bytes. After a successful call to posix_fallocate(), subsequent writes to bytes in the specified range are guaranteed not to fail because of lack of disk space.

If the size of the file is less than offset+len, then the file is increased to this size; otherwise the file size is left unchanged.

Return Value

posix_fallocate() returns zero on success, or an error number on failure. Note that errno is not set. java documentation We do not return -1 if we fail but instead throw an IOException

Throws:
java.io.IOException - if this call fails.


Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao, Chinmay Soman, Vinoth Chandar, Zhongjie Wu