Package jnr.posix
Class BaseNativePOSIX
- java.lang.Object
-
- jnr.posix.NativePOSIX
-
- jnr.posix.BaseNativePOSIX
-
- All Implemented Interfaces:
POSIX
- Direct Known Subclasses:
WindowsPOSIX
public abstract class BaseNativePOSIX extends NativePOSIX implements POSIX
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BaseNativePOSIX.PointerConverter
-
Field Summary
Fields Modifier and Type Field Description static jnr.ffi.mapper.ToNativeConverter<jnr.constants.Constant,java.lang.Integer>
ConstantConverter
static jnr.ffi.mapper.ToNativeConverter<FileStat,jnr.ffi.Pointer>
FileStatConverter
static BaseNativePOSIX.PointerConverter
GROUP
protected POSIXHandler
handler
protected JavaLibCHelper
helper
static jnr.ffi.mapper.ToNativeConverter<MsgHdr,jnr.ffi.Pointer>
MsgHdrConverter
protected java.util.Map<jnr.constants.platform.Signal,SignalHandler>
signalHandlers
static jnr.ffi.mapper.ToNativeConverter<NativeTimes,jnr.ffi.Pointer>
TimesConverter
-
Constructor Summary
Constructors Modifier Constructor Description protected
BaseNativePOSIX(LibCProvider libcProvider, POSIXHandler handler)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
access(java.lang.CharSequence path, int amode)
abstract FileStat
allocateStat()
Timeval
allocateTimeval()
int
chdir(java.lang.String path)
int
chmod(java.lang.String filename, int mode)
int
chown(java.lang.String filename, int user, int group)
int
close(int fd)
int
confstr(jnr.constants.platform.Confstr name, java.nio.ByteBuffer buf, int len)
Crypt
crypt()
byte[]
crypt(byte[] key, byte[] salt)
Call the crypt function with the given key and salt as raw null-terminated byte (C char) strings.java.lang.CharSequence
crypt(java.lang.CharSequence key, java.lang.CharSequence salt)
int
daemon(int nochdir, int noclose)
int
dup(int fd)
int
dup2(int oldFd, int newFd)
int
endgrent()
int
endpwent()
jnr.ffi.Pointer
environ()
int
errno()
void
errno(int value)
int
exec(java.lang.String path, java.lang.String... args)
Shell expanding and escaping version of exec which handles all the preparation of a command line or command list.int
exec(java.lang.String path, java.lang.String[] args, java.lang.String[] envp)
Shell expanding and escaping version of exec which handles all the preparation of a command line or command list.int
execv(java.lang.String path, java.lang.String[] args)
int
execve(java.lang.String path, java.lang.String[] args, java.lang.String[] env)
int
fchmod(int fd, int mode)
int
fchown(int fd, int user, int group)
int
fcntl(int fd, jnr.constants.platform.Fcntl fcntl)
int
fcntl(int fd, jnr.constants.platform.Fcntl fcntl, int arg)
int
fcntl(int fd, jnr.constants.platform.Fcntl fcntl, int... args)
Deprecated.int
fcntlInt(int fd, jnr.constants.platform.Fcntl fcntl, int arg)
int
fdatasync(int fd)
int
flock(int fd, int mode)
int
fork()
int
fpathconf(int fd, jnr.constants.platform.Pathconf name)
FileStat
fstat(int fd)
int
fstat(int fd, FileStat stat)
FileStat
fstat(java.io.FileDescriptor fileDescriptor)
int
fstat(java.io.FileDescriptor fileDescriptor, FileStat stat)
int
fsync(int fd)
int
ftruncate(int fd, long offset)
int
futimens(int fd, long[] atimespec, long[] mtimespec)
int
futimens(int fd, jnr.ffi.Pointer times)
int
futimes(int fd, long[] atimeval, long[] mtimeval)
java.lang.String
getcwd()
int
getdtablesize()
int
getegid()
java.lang.String
getenv(java.lang.String envName)
int
geteuid()
int
getfd(java.io.FileDescriptor descriptor)
int
getgid()
Group
getgrent()
Group
getgrgid(int which)
Group
getgrnam(java.lang.String which)
long[]
getgroups()
int
getgroups(int size, int[] groups)
java.lang.String
gethostname()
java.lang.String
getlogin()
int
getpgid()
int
getpgid(int pid)
int
getpgrp()
int
getpid()
int
getppid()
int
getpriority(int which, int who)
Passwd
getpwent()
Passwd
getpwnam(java.lang.String which)
Passwd
getpwuid(int which)
RLimit
getrlimit(int resource)
int
getrlimit(int resource, jnr.ffi.Pointer rlim)
int
getrlimit(int resource, RLimit rlim)
int
gettimeofday(Timeval tv)
int
getuid()
int
isatty(int fd)
boolean
isatty(java.io.FileDescriptor fd)
boolean
isNative()
int
kill(int pid, int signal)
int
kill(long pid, int signal)
int
lchmod(java.lang.String filename, int mode)
int
lchown(java.lang.String filename, int user, int group)
LibC
libc()
Returns null if isNative returns false.int
link(java.lang.String oldpath, java.lang.String newpath)
int
lseek(int fd, long offset, int whence)
long
lseekLong(int fd, long offset, int whence)
FileStat
lstat(java.lang.String path)
int
lstat(java.lang.String path, FileStat stat)
int
lutimes(java.lang.String path, long[] atimeval, long[] mtimeval)
int
mkdir(java.lang.String path, int mode)
int
mkfifo(java.lang.String filename, int mode)
ProcessMaker
newProcessMaker()
ProcessMaker
newProcessMaker(java.lang.String... command)
java.lang.String
nl_langinfo(int item)
int
open(java.lang.CharSequence path, int flags, int perm)
int
pipe(int[] fds)
long
posix_spawnp(java.lang.String path, java.util.Collection<? extends SpawnFileAction> fileActions, java.lang.CharSequence[] argv, java.lang.CharSequence[] envp)
long
posix_spawnp(java.lang.String path, java.util.Collection<? extends SpawnFileAction> fileActions, java.util.Collection<? extends java.lang.CharSequence> argv, java.util.Collection<? extends java.lang.CharSequence> envp)
long
posix_spawnp(java.lang.String path, java.util.Collection<? extends SpawnFileAction> fileActions, java.util.Collection<? extends SpawnAttribute> spawnAttributes, java.lang.CharSequence[] argv, java.lang.CharSequence[] envp)
long
posix_spawnp(java.lang.String path, java.util.Collection<? extends SpawnFileAction> fileActions, java.util.Collection<? extends SpawnAttribute> spawnAttributes, java.util.Collection<? extends java.lang.CharSequence> argv, java.util.Collection<? extends java.lang.CharSequence> envp)
int
pread(int fd, byte[] buf, int n, int offset)
long
pread(int fd, byte[] buf, long n, long offset)
int
pread(int fd, java.nio.ByteBuffer buf, int n, int offset)
long
pread(int fd, java.nio.ByteBuffer buf, long n, long offset)
int
pwrite(int fd, byte[] buf, int n, int offset)
long
pwrite(int fd, byte[] buf, long n, long offset)
int
pwrite(int fd, java.nio.ByteBuffer buf, int n, int offset)
long
pwrite(int fd, java.nio.ByteBuffer buf, long n, long offset)
int
raise(int sig)
int
read(int fd, byte[] buf, int n)
long
read(int fd, byte[] buf, long n)
int
read(int fd, java.nio.ByteBuffer buf, int n)
long
read(int fd, java.nio.ByteBuffer buf, long n)
int
readlink(java.lang.CharSequence path, byte[] buf, int bufsize)
int
readlink(java.lang.CharSequence path, java.nio.ByteBuffer buf, int bufsize)
int
readlink(java.lang.CharSequence path, jnr.ffi.Pointer bufPtr, int bufsize)
java.lang.String
readlink(java.lang.String oldpath)
int
recvmsg(int socket, MsgHdr message, int flags)
int
rename(java.lang.CharSequence oldName, java.lang.CharSequence newName)
int
rmdir(java.lang.String path)
int
sendmsg(int socket, MsgHdr message, int flags)
int
setegid(int egid)
int
setenv(java.lang.String envName, java.lang.String envValue, int overwrite)
int
seteuid(int euid)
int
setgid(int gid)
int
setgrent()
java.lang.String
setlocale(int category, java.lang.String locale)
int
setpgid(int pid, int pgid)
int
setpgrp(int pid, int pgrp)
int
setpriority(int which, int who, int prio)
int
setpwent()
int
setrlimit(int resource, long rlimCur, long rlimMax)
int
setrlimit(int resource, jnr.ffi.Pointer rlim)
int
setrlimit(int resource, RLimit rlim)
int
setsid()
int
setuid(int uid)
SignalHandler
signal(jnr.constants.platform.Signal sig, SignalHandler handler)
int
socketpair(int domain, int type, int protocol, int[] fds)
FileStat
stat(java.lang.String path)
int
stat(java.lang.String path, FileStat stat)
java.lang.String
strerror(int code)
int
symlink(java.lang.String oldpath, java.lang.String newpath)
long
sysconf(jnr.constants.platform.Sysconf name)
Times
times()
int
truncate(java.lang.CharSequence path, long length)
int
umask(int mask)
protected int
unimplementedInt()
protected <T> T
unimplementedNull()
int
unlink(java.lang.CharSequence path)
int
unsetenv(java.lang.String envName)
int
utimensat(int dirfd, java.lang.String path, long[] atimespec, long[] mtimespec, int flag)
int
utimensat(int dirfd, java.lang.String path, jnr.ffi.Pointer times, int flag)
int
utimes(java.lang.String path, long[] atimeval, long[] mtimeval)
int
utimes(java.lang.String path, jnr.ffi.Pointer times)
int
wait(int[] status)
int
waitpid(int pid, int[] status, int flags)
int
waitpid(long pid, int[] status, int flags)
int
write(int fd, byte[] buf, int n)
long
write(int fd, byte[] buf, long n)
int
write(int fd, java.nio.ByteBuffer buf, int n)
long
write(int fd, java.nio.ByteBuffer buf, long n)
-
Methods inherited from class jnr.posix.NativePOSIX
allocatePosixSpawnattr, allocatePosixSpawnFileActions, socketMacros
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jnr.posix.POSIX
allocateMsgHdr
-
-
-
-
Field Detail
-
handler
protected final POSIXHandler handler
-
helper
protected final JavaLibCHelper helper
-
signalHandlers
protected final java.util.Map<jnr.constants.platform.Signal,SignalHandler> signalHandlers
-
GROUP
public static final BaseNativePOSIX.PointerConverter GROUP
-
FileStatConverter
public static final jnr.ffi.mapper.ToNativeConverter<FileStat,jnr.ffi.Pointer> FileStatConverter
-
TimesConverter
public static final jnr.ffi.mapper.ToNativeConverter<NativeTimes,jnr.ffi.Pointer> TimesConverter
-
ConstantConverter
public static final jnr.ffi.mapper.ToNativeConverter<jnr.constants.Constant,java.lang.Integer> ConstantConverter
-
MsgHdrConverter
public static final jnr.ffi.mapper.ToNativeConverter<MsgHdr,jnr.ffi.Pointer> MsgHdrConverter
-
-
Constructor Detail
-
BaseNativePOSIX
protected BaseNativePOSIX(LibCProvider libcProvider, POSIXHandler handler)
-
-
Method Detail
-
newProcessMaker
public ProcessMaker newProcessMaker(java.lang.String... command)
- Specified by:
newProcessMaker
in interfacePOSIX
-
newProcessMaker
public ProcessMaker newProcessMaker()
- Specified by:
newProcessMaker
in interfacePOSIX
-
libc
public final LibC libc()
Description copied from interface:POSIX
Returns null if isNative returns false.
-
crypt
public final Crypt crypt()
-
unimplementedNull
protected <T> T unimplementedNull()
-
unimplementedInt
protected int unimplementedInt()
-
chown
public int chown(java.lang.String filename, int user, int group)
-
crypt
public java.lang.CharSequence crypt(java.lang.CharSequence key, java.lang.CharSequence salt)
-
crypt
public byte[] crypt(byte[] key, byte[] salt)
Description copied from interface:POSIX
Call the crypt function with the given key and salt as raw null-terminated byte (C char) strings.
-
exec
public int exec(java.lang.String path, java.lang.String... args)
Description copied from interface:POSIX
Shell expanding and escaping version of exec which handles all the preparation of a command line or command list.
-
exec
public int exec(java.lang.String path, java.lang.String[] args, java.lang.String[] envp)
Description copied from interface:POSIX
Shell expanding and escaping version of exec which handles all the preparation of a command line or command list.
-
execv
public int execv(java.lang.String path, java.lang.String[] args)
-
execve
public int execve(java.lang.String path, java.lang.String[] args, java.lang.String[] env)
-
fstat
public FileStat fstat(java.io.FileDescriptor fileDescriptor)
-
fstat
public int fstat(java.io.FileDescriptor fileDescriptor, FileStat stat)
-
getenv
public java.lang.String getenv(java.lang.String envName)
-
getdtablesize
public int getdtablesize()
- Specified by:
getdtablesize
in interfacePOSIX
-
getrlimit
public int getrlimit(int resource, RLimit rlim)
-
getrlimit
public int getrlimit(int resource, jnr.ffi.Pointer rlim)
-
setrlimit
public int setrlimit(int resource, RLimit rlim)
-
setrlimit
public int setrlimit(int resource, jnr.ffi.Pointer rlim)
-
setrlimit
public int setrlimit(int resource, long rlimCur, long rlimMax)
-
getfd
public int getfd(java.io.FileDescriptor descriptor)
-
signal
public SignalHandler signal(jnr.constants.platform.Signal sig, SignalHandler handler)
-
lchmod
public int lchmod(java.lang.String filename, int mode)
-
lchown
public int lchown(java.lang.String filename, int user, int group)
-
link
public int link(java.lang.String oldpath, java.lang.String newpath)
-
lstat
public int lstat(java.lang.String path, FileStat stat)
-
setenv
public int setenv(java.lang.String envName, java.lang.String envValue, int overwrite)
-
symlink
public int symlink(java.lang.String oldpath, java.lang.String newpath)
-
readlink
public java.lang.String readlink(java.lang.String oldpath) throws java.io.IOException
-
readlink
public int readlink(java.lang.CharSequence path, byte[] buf, int bufsize)
-
readlink
public int readlink(java.lang.CharSequence path, java.nio.ByteBuffer buf, int bufsize)
-
readlink
public int readlink(java.lang.CharSequence path, jnr.ffi.Pointer bufPtr, int bufsize)
-
utimes
public int utimes(java.lang.String path, long[] atimeval, long[] mtimeval)
-
utimes
public int utimes(java.lang.String path, jnr.ffi.Pointer times)
-
futimes
public int futimes(int fd, long[] atimeval, long[] mtimeval)
-
lutimes
public int lutimes(java.lang.String path, long[] atimeval, long[] mtimeval)
-
utimensat
public int utimensat(int dirfd, java.lang.String path, long[] atimespec, long[] mtimespec, int flag)
-
utimensat
public int utimensat(int dirfd, java.lang.String path, jnr.ffi.Pointer times, int flag)
-
futimens
public int futimens(int fd, long[] atimespec, long[] mtimespec)
-
futimens
public int futimens(int fd, jnr.ffi.Pointer times)
-
waitpid
public int waitpid(int pid, int[] status, int flags)
-
waitpid
public int waitpid(long pid, int[] status, int flags)
-
getpriority
public int getpriority(int which, int who)
- Specified by:
getpriority
in interfacePOSIX
-
setpriority
public int setpriority(int which, int who, int prio)
- Specified by:
setpriority
in interfacePOSIX
-
posix_spawnp
public long posix_spawnp(java.lang.String path, java.util.Collection<? extends SpawnFileAction> fileActions, java.lang.CharSequence[] argv, java.lang.CharSequence[] envp)
-
posix_spawnp
public long posix_spawnp(java.lang.String path, java.util.Collection<? extends SpawnFileAction> fileActions, java.util.Collection<? extends java.lang.CharSequence> argv, java.util.Collection<? extends java.lang.CharSequence> envp)
- Specified by:
posix_spawnp
in interfacePOSIX
-
posix_spawnp
public long posix_spawnp(java.lang.String path, java.util.Collection<? extends SpawnFileAction> fileActions, java.util.Collection<? extends SpawnAttribute> spawnAttributes, java.util.Collection<? extends java.lang.CharSequence> argv, java.util.Collection<? extends java.lang.CharSequence> envp)
- Specified by:
posix_spawnp
in interfacePOSIX
-
posix_spawnp
public long posix_spawnp(java.lang.String path, java.util.Collection<? extends SpawnFileAction> fileActions, java.util.Collection<? extends SpawnAttribute> spawnAttributes, java.lang.CharSequence[] argv, java.lang.CharSequence[] envp)
-
fcntlInt
public int fcntlInt(int fd, jnr.constants.platform.Fcntl fcntl, int arg)
-
fcntl
public int fcntl(int fd, jnr.constants.platform.Fcntl fcntl)
-
fcntl
public int fcntl(int fd, jnr.constants.platform.Fcntl fcntl, int arg)
-
fcntl
@Deprecated public int fcntl(int fd, jnr.constants.platform.Fcntl fcntl, int... args)
Deprecated.Description copied from interface:POSIX
fcntl(2)- Specified by:
fcntl
in interfacePOSIX
- Parameters:
fd
- the file descriptor on which to actfcntl
- theFcntl
enum value for the flag to setargs
- arguments for the flag or null if none- Returns:
- 0 if success, -1 if error
- See Also:
POSIX.fcntlInt(int, jnr.constants.platform.Fcntl, int)
-
access
public int access(java.lang.CharSequence path, int amode)
-
allocateStat
public abstract FileStat allocateStat()
- Specified by:
allocateStat
in interfacePOSIX
-
sysconf
public long sysconf(jnr.constants.platform.Sysconf name)
-
confstr
public int confstr(jnr.constants.platform.Confstr name, java.nio.ByteBuffer buf, int len)
-
fpathconf
public int fpathconf(int fd, jnr.constants.platform.Pathconf name)
-
open
public int open(java.lang.CharSequence path, int flags, int perm)
-
read
public long read(int fd, java.nio.ByteBuffer buf, long n)
-
write
public long write(int fd, java.nio.ByteBuffer buf, long n)
-
pread
public long pread(int fd, byte[] buf, long n, long offset)
-
pwrite
public long pwrite(int fd, byte[] buf, long n, long offset)
-
pread
public long pread(int fd, java.nio.ByteBuffer buf, long n, long offset)
-
pwrite
public long pwrite(int fd, java.nio.ByteBuffer buf, long n, long offset)
-
write
public int write(int fd, java.nio.ByteBuffer buf, int n)
-
pread
public int pread(int fd, byte[] buf, int n, int offset)
-
pwrite
public int pwrite(int fd, byte[] buf, int n, int offset)
-
pread
public int pread(int fd, java.nio.ByteBuffer buf, int n, int offset)
-
pwrite
public int pwrite(int fd, java.nio.ByteBuffer buf, int n, int offset)
-
lseekLong
public long lseekLong(int fd, long offset, int whence)
-
socketpair
public int socketpair(int domain, int type, int protocol, int[] fds)
- Specified by:
socketpair
in interfacePOSIX
-
sendmsg
public int sendmsg(int socket, MsgHdr message, int flags)
-
recvmsg
public int recvmsg(int socket, MsgHdr message, int flags)
-
truncate
public int truncate(java.lang.CharSequence path, long length)
-
rename
public int rename(java.lang.CharSequence oldName, java.lang.CharSequence newName)
-
gethostname
public java.lang.String gethostname()
- Specified by:
gethostname
in interfacePOSIX
-
mkfifo
public int mkfifo(java.lang.String filename, int mode)
-
nl_langinfo
public java.lang.String nl_langinfo(int item)
- Specified by:
nl_langinfo
in interfacePOSIX
-
setlocale
public java.lang.String setlocale(int category, java.lang.String locale)
-
allocateTimeval
public Timeval allocateTimeval()
- Specified by:
allocateTimeval
in interfacePOSIX
-
gettimeofday
public int gettimeofday(Timeval tv)
- Specified by:
gettimeofday
in interfacePOSIX
-
-