- java.lang.Object
-
- de.ibapl.jnhw.posix.Fcntl
-
@Include("#include <fcntl.h>") public final class Fcntl extends Object
Wrapper around the<fcntl.h>header.Todo: struct flock, flock64
See specs at: fcntl.h - file control options.- Author:
- aploese
-
-
Field Summary
Fields Modifier and Type Field Description static intAT_EACCESSPOSIX: Check access using effective user and group ID.static intAT_FDCWDPOSIX: Use the current working directory to determine the target.static intAT_REMOVEDIRPOSIX: Remove directory instead of file.static intAT_SYMLINK_FOLLOWPOSIX: Follow symbolic link.static intAT_SYMLINK_NOFOLLOWPOSIX: Do not follow symbolic links.static intF_DUPFDPOSIX: Duplicate file descriptor.static intF_DUPFD_CLOEXECPOSIX: Duplicate file descriptor with the close-on-exec flag FD_CLOEXEC set.static intF_GETFDPOSIX: et file descriptor flags.static intF_GETFLPOSIX: Get file status flags and file access modes.static intF_GETLKPOSIX: Get record locking information.static intF_GETOWNPOSIX: Get process or process group ID to receive SIGURG signals.static intF_RDLCKPOSIX: Shared or read lock.static intF_SETFDPOSIX: Set file descriptor flags.static intF_SETFLPOSIX: Set file status flags.static intF_SETLKPOSIX: Set record locking information.static intF_SETLKWPOSIX: Set record locking information; wait if blocked.static intF_SETOWNPOSIX: Set process or process group ID to receive SIGURG signals.static intF_UNLCKPOSIX: Unlock.static intF_WRLCKPOSIX: Exclusive or write lock.static intFD_CLOEXECPOSIX: Close the file descriptor upon execution of an exec family function.static booleanHAVE_FCNTL_Hstatic intO_ACCMODEPOSIX: Mask for file access modes.static intO_APPENDPOSIX: Set append mode.static IntDefineO_ASYNCNon POSIX: Enable signal-driven I/O.static intO_CLOEXECPOSIX: The FD_CLOEXEC flag associated with the new descriptor shall be set to close the file descriptor upon execution of an exec family function.static intO_CREATPOSIX: Create file if it does not exist.static intO_DIRECTORYPOSIX: Fail if file is a non-directory file.static IntDefineO_DSYNCPOSIX.SIO: Write according to synchronized I/O data integrity completion.static intO_EXCLPOSIX: Exclusive use flag.static IntDefineO_EXECPOSIX: Open for execute only (non-directory files).The result is unspecified if this flag is applied to a directory.static IntDefineO_FSYNCNon POSIX: enables synchronous writing for the file. .static IntDefineO_LARGEFILELinux: (LFS) Allow files whose sizes cannot be represented in an off_t (but can be represented in an off64_t) to be opened.static intO_NOCTTYPOSIX: Do not assign controlling terminal.static intO_NOFOLLOWPOSIX: Do not follow symbolic links.static intO_NONBLOCKPOSIX: Non-blocking mode.static intO_RDONLYPOSIX: Open for reading only.static intO_RDWRPOSIX: Open for reading and writing.static IntDefineO_RSYNCPOSIX.SIO: Synchronized read I/O operations.static IntDefineO_SEARCHPOSIX: Open directory for search only.static intO_SYNCPOSIX: Write according to synchronized I/O file integrity completion.static intO_TRUNCPOSIX: Truncate flag.static IntDefineO_TTY_INITPOSIX: Set the termios structure terminal parameters to a state that provides conforming behavior.static intO_WRONLYPOSIX: Open for writing only.static IntDefinePOSIX_FADV_DONTNEEDPOSIX.ADV: The application expects that it will not access the specified data in the near future.static IntDefinePOSIX_FADV_NOREUSEPOSIX.ADV: The application expects to access the specified data once and then not reuse it thereafter.static IntDefinePOSIX_FADV_NORMALPOSIX.ADV: The application has no advice to give on its behavior with respect to the specified data.It is the default characteristic if no advice is given for an open file.static IntDefinePOSIX_FADV_RANDOMPOSIX.ADV: The application expects to access the specified data in a random order.static IntDefinePOSIX_FADV_SEQUENTIALPOSIX.ADV: The application expects to access the specified data sequentially from lower offsets to higher offsets.static IntDefinePOSIX_FADV_WILLNEEDPOSIX.ADV: The application expects to access the specified data in the near future.static intSEEK_CURPOSIX: same as defined in stdio.h.static intSEEK_ENDPOSIX: same as defined in stdio.h.static intSEEK_SETPOSIX: same as defined in stdio.h.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intcreat(String path, int mode)static intcreat64(String path, int mode)Linux: Available if _LARGEFILE64_SOURCE is defined.static intfcntl(int fildes, int cmd)POSIX: fcntl - file control.static intfcntl(int fildes, int cmd, int vararg_0)POSIX: fcntl - file control.static intfcntl64(int fildes, int cmd)Linux: Available if _LARGEFILE64_SOURCE is defined.static intfcntl64(int fildes, int cmd, int vararg_0)Linux: Available if _LARGEFILE64_SOURCE is defined.static intopen(String path, int oflag)POSIX: open, openat - open file.static intopen(String path, int oflag, int mode)POSIX: open, openat - open file.static intopen64(String path, int oflag)Linux: Available if _LARGEFILE64_SOURCE is defined.static intopen64(String path, int oflag, int mode)Linux: Available if _LARGEFILE64_SOURCE is defined.static intopenat(int fd, String path, int oflag)POSIX: open, openat - open file.static intopenat(int fd, String path, int oflag, int mode)POSIX: open, openat - open file.static intopenat64(int fd, String path, int oflag)Linux: Available if _LARGEFILE64_SOURCE is defined.static intopenat64(int fd, String path, int oflag, int mode)Linux: Available if _LARGEFILE64_SOURCE is defined.static voidposix_fadvise(int fildes, long offset, long len, int advice)static voidposix_fadvise64(int fildes, long offset, long len, int advice)Linux: Available if _LARGEFILE64_SOURCE is defined.static voidposix_fallocate(int fildes, long offset, long len)static voidposix_fallocate64(int fildes, long offset, long len)Linux: Available if _LARGEFILE64_SOURCE is defined.
-
-
-
Field Detail
-
AT_EACCESS
@Define public static final int AT_EACCESS
POSIX: Check access using effective user and group ID.
-
AT_FDCWD
@Define public static final int AT_FDCWD
POSIX: Use the current working directory to determine the target. of relative file paths.
-
AT_REMOVEDIR
@Define public static final int AT_REMOVEDIR
POSIX: Remove directory instead of file.
-
AT_SYMLINK_FOLLOW
@Define public static final int AT_SYMLINK_FOLLOW
POSIX: Follow symbolic link.
-
AT_SYMLINK_NOFOLLOW
@Define public static final int AT_SYMLINK_NOFOLLOW
POSIX: Do not follow symbolic links.
-
FD_CLOEXEC
@Define public static final int FD_CLOEXEC
POSIX: Close the file descriptor upon execution of an exec family function.
-
F_DUPFD
@Define public static final int F_DUPFD
POSIX: Duplicate file descriptor.
-
F_DUPFD_CLOEXEC
@Define public static final int F_DUPFD_CLOEXEC
POSIX: Duplicate file descriptor with the close-on-exec flag FD_CLOEXEC set.
-
F_GETFD
@Define public static final int F_GETFD
POSIX: et file descriptor flags.
-
F_GETFL
@Define public static final int F_GETFL
POSIX: Get file status flags and file access modes.
-
F_GETLK
@Define public static final int F_GETLK
POSIX: Get record locking information.
-
F_GETOWN
@Define public static final int F_GETOWN
POSIX: Get process or process group ID to receive SIGURG signals.
-
F_RDLCK
@Define public static final int F_RDLCK
POSIX: Shared or read lock.
-
F_SETFD
@Define public static final int F_SETFD
POSIX: Set file descriptor flags.
-
F_SETFL
@Define public static final int F_SETFL
POSIX: Set file status flags.
-
F_SETLK
@Define public static final int F_SETLK
POSIX: Set record locking information.
-
F_SETLKW
@Define public static final int F_SETLKW
POSIX: Set record locking information; wait if blocked.
-
F_SETOWN
@Define public static final int F_SETOWN
POSIX: Set process or process group ID to receive SIGURG signals.
-
F_UNLCK
@Define public static final int F_UNLCK
POSIX: Unlock.
-
F_WRLCK
@Define public static final int F_WRLCK
POSIX: Exclusive or write lock.
-
HAVE_FCNTL_H
public static final boolean HAVE_FCNTL_H
-
O_ACCMODE
@Define public static final int O_ACCMODE
POSIX: Mask for file access modes.
-
O_APPEND
@Define public static final int O_APPEND
POSIX: Set append mode.
-
O_CLOEXEC
@Define public static final int O_CLOEXEC
POSIX: The FD_CLOEXEC flag associated with the new descriptor shall be set to close the file descriptor upon execution of an exec family function.
-
O_CREAT
@Define public static final int O_CREAT
POSIX: Create file if it does not exist.
-
O_DIRECTORY
@Define public static final int O_DIRECTORY
POSIX: Fail if file is a non-directory file.
-
O_DSYNC
@Define public static final IntDefine O_DSYNC
POSIX.SIO: Write according to synchronized I/O data integrity completion.
-
O_EXCL
@Define public static final int O_EXCL
POSIX: Exclusive use flag.
-
O_EXEC
@Define public static final IntDefine O_EXEC
POSIX: Open for execute only (non-directory files).The result is unspecified if this flag is applied to a directory.
-
O_FSYNC
@Define public static final IntDefine O_FSYNC
Non POSIX: enables synchronous writing for the file. .
-
O_LARGEFILE
@Define public static final IntDefine O_LARGEFILE
Linux: (LFS) Allow files whose sizes cannot be represented in an off_t (but can be represented in an off64_t) to be opened. The _LARGEFILE64_SOURCE macro must be defined (before including any header files) in order to obtain this definition. Setting the _FILE_OFFSET_BITS feature test macro to 64 (rather than using O_LARGEFILE) is the preferred method of accessing large files on 32-bit systems (see feature_test_macros(7)). .
-
O_NOCTTY
@Define public static final int O_NOCTTY
POSIX: Do not assign controlling terminal.
-
O_NOFOLLOW
@Define public static final int O_NOFOLLOW
POSIX: Do not follow symbolic links.
-
O_NONBLOCK
@Define public static final int O_NONBLOCK
POSIX: Non-blocking mode.
-
O_RDONLY
@Define public static final int O_RDONLY
POSIX: Open for reading only.
-
O_RDWR
@Define public static final int O_RDWR
POSIX: Open for reading and writing.
-
O_SEARCH
@Define public static final IntDefine O_SEARCH
POSIX: Open directory for search only. The result is unspecified if this flag is applied to a non-directory file.
-
O_SYNC
@Define public static final int O_SYNC
POSIX: Write according to synchronized I/O file integrity completion.
-
O_TRUNC
@Define public static final int O_TRUNC
POSIX: Truncate flag.
-
O_TTY_INIT
@Define public static final IntDefine O_TTY_INIT
POSIX: Set the termios structure terminal parameters to a state that provides conforming behavior.
-
O_WRONLY
@Define public static final int O_WRONLY
POSIX: Open for writing only.
-
POSIX_FADV_DONTNEED
@Define public static final IntDefine POSIX_FADV_DONTNEED
POSIX.ADV: The application expects that it will not access the specified data in the near future.
-
POSIX_FADV_NOREUSE
@Define public static final IntDefine POSIX_FADV_NOREUSE
POSIX.ADV: The application expects to access the specified data once and then not reuse it thereafter.
-
POSIX_FADV_NORMAL
@Define public static final IntDefine POSIX_FADV_NORMAL
POSIX.ADV: The application has no advice to give on its behavior with respect to the specified data.It is the default characteristic if no advice is given for an open file.
-
POSIX_FADV_RANDOM
@Define public static final IntDefine POSIX_FADV_RANDOM
POSIX.ADV: The application expects to access the specified data in a random order.
-
POSIX_FADV_SEQUENTIAL
@Define public static final IntDefine POSIX_FADV_SEQUENTIAL
POSIX.ADV: The application expects to access the specified data sequentially from lower offsets to higher offsets.
-
POSIX_FADV_WILLNEED
@Define public static final IntDefine POSIX_FADV_WILLNEED
POSIX.ADV: The application expects to access the specified data in the near future.
-
SEEK_CUR
@Define public static final int SEEK_CUR
POSIX: same as defined in stdio.h.
-
SEEK_END
@Define public static final int SEEK_END
POSIX: same as defined in stdio.h.
-
SEEK_SET
@Define public static final int SEEK_SET
POSIX: same as defined in stdio.h.
-
-
Method Detail
-
creat
public static final int creat(String path, int mode) throws NativeErrorException
- Parameters:
path- the pathname naming the file.mode- the file access modes fromStat.- Returns:
- a handle to the opend file.
- Throws:
NullPointerException- iffileisnull.NativeErrorException- if the return value of the native function indicates an error.
-
creat64
public static final int creat64(String path, int mode) throws NativeErrorException, NoSuchNativeMethodException
Linux: Available if _LARGEFILE64_SOURCE is defined.- Parameters:
path- the pathname naming the file.mode- the file access modes fromStat.- Returns:
- a handle to the opend file.
- Throws:
NativeErrorException- if the return value of the native function indicates an error.NoSuchNativeMethodException- if _LARGEFILE64_SOURCE is not defined.
-
fcntl
public static final int fcntl(int fildes, int cmd) throws NativeErrorExceptionPOSIX: fcntl - file control.- Parameters:
fildes- a file descriptorcmd- the available values for cmd are defined in fcntl.h.- Returns:
- the value returned shall depend on cmd.
- Throws:
NativeErrorException- if the return value of the native function indicates an error.
-
fcntl
public static final int fcntl(int fildes, int cmd, int vararg_0) throws NativeErrorExceptionPOSIX: fcntl - file control.- Parameters:
fildes- a file descriptorcmd- the available values for cmd are defined in fcntl.h.vararg_0- the arg for some cmd.- Returns:
- the value returned shall depend on cmd.
- Throws:
NativeErrorException- if the return value of the native function indicates an error.
-
fcntl64
public static final int fcntl64(int fildes, int cmd) throws NativeErrorException, NoSuchNativeMethodExceptionLinux: Available if _LARGEFILE64_SOURCE is defined.- Parameters:
fildes- a file descriptorcmd- the available values for cmd are defined in fcntl.h.- Returns:
- the value returned shall depend on cmd.
- Throws:
NativeErrorException- if the return value of the native function indicates an error.NoSuchNativeMethodException- if _LARGEFILE64_SOURCE is not defined.
-
fcntl64
public static final int fcntl64(int fildes, int cmd, int vararg_0) throws NativeErrorException, NoSuchNativeMethodExceptionLinux: Available if _LARGEFILE64_SOURCE is defined.- Parameters:
fildes- a file descriptorcmd- the available values for cmd are defined in fcntl.h.vararg_0- the arg for some cmd.- Returns:
- the value returned shall depend on cmd.
- Throws:
NativeErrorException- if the return value of the native function indicates an error.NoSuchNativeMethodException- if _LARGEFILE64_SOURCE is not defined.
-
open
public static final int open(String path, int oflag) throws NativeErrorException
POSIX: open, openat - open file.- Parameters:
path- the pathname naming the file.oflag- the open flags.- Returns:
- a handle to the opend file.
- Throws:
NullPointerException- iffileisnull.NativeErrorException- if the return value of the native function indicates an error.
-
open
public static final int open(String path, int oflag, int mode) throws NativeErrorException
POSIX: open, openat - open file.- Parameters:
path- the pathname naming the file.oflag- the open flags.mode- the file access modes fromStat.- Returns:
- a handle to the opend file.
- Throws:
NullPointerException- iffileisnull.NativeErrorException- if the return value of the native function indicates an error.
-
open64
public static final int open64(String path, int oflag) throws NativeErrorException, NoSuchNativeMethodException
Linux: Available if _LARGEFILE64_SOURCE is defined. open, openat - open file.- Parameters:
path- the pathname naming the file.oflag- the open flags.- Returns:
- a handle to the opend file.
- Throws:
NullPointerException- iffileisnull.NativeErrorException- if the return value of the native function indicates an error.NoSuchNativeMethodException- if _LARGEFILE64_SOURCE is not defined.
-
open64
public static final int open64(String path, int oflag, int mode) throws NativeErrorException, NoSuchNativeMethodException
Linux: Available if _LARGEFILE64_SOURCE is defined. open, openat - open file.- Parameters:
path- the pathname naming the file.oflag- the open flags.mode- the file access modes fromStat.- Returns:
- a handle to the opend file.
- Throws:
NullPointerException- iffileisnull.NativeErrorException- if the return value of the native function indicates an error.NoSuchNativeMethodException- if _LARGEFILE64_SOURCE is not defined.
-
openat
public static final int openat(int fd, String path, int oflag) throws NativeErrorExceptionPOSIX: open, openat - open file.- Parameters:
fd- a filedescriptor of a directory.path- the pathname naming the file. If relative fd points to the parent direcory.oflag- the open flags.- Returns:
- a handle to the opend file.
- Throws:
NullPointerException- iffileisnull.NativeErrorException- if the return value of the native function indicates an error.
-
openat
public static final int openat(int fd, String path, int oflag, int mode) throws NativeErrorExceptionPOSIX: open, openat - open file.- Parameters:
fd- a filedescriptor of a directory.path- the pathname naming the file. If relative fd points to the parent direcory.oflag- the open flags.mode- the file access modes fromStat.- Returns:
- a handle to the opend file.
- Throws:
NullPointerException- iffileisnull.NativeErrorException- if the return value of the native function indicates an error.
-
openat64
public static final int openat64(int fd, String path, int oflag) throws NativeErrorException, NoSuchNativeMethodExceptionLinux: Available if _LARGEFILE64_SOURCE is defined. open, openat - open file.- Parameters:
fd- a filedescriptor of a directory.path- the pathname naming the file. If relative fd points to the parent direcory.oflag- the open flags.- Returns:
- a handle to the opend file.
- Throws:
NullPointerException- iffileisnull.NativeErrorException- if the return value of the native function indicates an error.NoSuchNativeMethodException- if _LARGEFILE64_SOURCE is not defined.
-
openat64
public static final int openat64(int fd, String path, int oflag, int mode) throws NativeErrorException, NoSuchNativeMethodExceptionLinux: Available if _LARGEFILE64_SOURCE is defined. open, openat - open file.- Parameters:
fd- a filedescriptor of a directory.path- the pathname naming the file. If relative fd points to the parent direcory.oflag- the open flags.mode- the file access modes fromStat.- Returns:
- a handle to the opend file.
- Throws:
NullPointerException- iffileisnull.NativeErrorException- if the return value of the native function indicates an error.NoSuchNativeMethodException- if _LARGEFILE64_SOURCE is not defined.
-
posix_fadvise
public static final void posix_fadvise(int fildes, long offset, long len, int advice) throws NativeErrorException, NoSuchNativeMethodException- Parameters:
fildes- a file descriptoroffset- the offset.len- the length.advice- the advice to be applied to the data is specified by the advice parameter.- Throws:
NativeErrorException- if the return value of the native function returns an error code.NoSuchNativeMethodException
-
posix_fadvise64
public static final void posix_fadvise64(int fildes, long offset, long len, int advice) throws NativeErrorException, NoSuchNativeMethodExceptionLinux: Available if _LARGEFILE64_SOURCE is defined. posix_fadvise - file advisory information (ADVANCED REALTIME).- Parameters:
fildes- a file descriptoroffset- the offset.len- the length.advice- the advice to be applied to the data is specified by the advice parameter.- Throws:
NativeErrorException- if the return value of the native function returns an error code.NoSuchNativeMethodException- if _LARGEFILE64_SOURCE is not defined.
-
posix_fallocate
public static final void posix_fallocate(int fildes, long offset, long len) throws NativeErrorException, NoSuchNativeMethodException- Parameters:
fildes- a file descriptoroffset- the offset.len- the length.- Throws:
NativeErrorException- if the return value of the native function returns an error code.NoSuchNativeMethodException
-
posix_fallocate64
public static final void posix_fallocate64(int fildes, long offset, long len) throws NativeErrorException, NoSuchNativeMethodExceptionLinux: Available if _LARGEFILE64_SOURCE is defined. posix_fallocate - file space control (ADVANCED REALTIME).- Parameters:
fildes- a file descriptoroffset- the offset.len- the length.- Throws:
NativeErrorException- if the return value of the native functionNoSuchNativeMethodException- if _LARGEFILE64_SOURCE is not defined. returns an error code.
-
-