- 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 classBaseNativePOSIX.PointerConverter
-
Field Summary
Fields Modifier and Type Field Description static jnr.ffi.mapper.ToNativeConverter<jnr.constants.Constant,Integer>ConstantConverterstatic jnr.ffi.mapper.ToNativeConverter<FileStat,jnr.ffi.Pointer>FileStatConverterstatic BaseNativePOSIX.PointerConverterGROUPprotected POSIXHandlerhandlerprotected JavaLibCHelperhelperstatic jnr.ffi.mapper.ToNativeConverter<MsgHdr,jnr.ffi.Pointer>MsgHdrConverterprotected Map<jnr.constants.platform.Signal,SignalHandler>signalHandlersstatic jnr.ffi.mapper.ToNativeConverter<NativeTimes,jnr.ffi.Pointer>TimesConverter
-
Constructor Summary
Constructors Modifier Constructor Description protectedBaseNativePOSIX(LibCProvider libcProvider, POSIXHandler handler)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intaccess(CharSequence path, int amode)abstract FileStatallocateStat()TimevalallocateTimeval()intchdir(String path)intchmod(String filename, int mode)intchown(String filename, int user, int group)intclose(int fd)intconfstr(jnr.constants.platform.Confstr name, ByteBuffer buf, int len)Cryptcrypt()byte[]crypt(byte[] key, byte[] salt)Call the crypt function with the given key and salt as raw null-terminated byte (C char) strings.CharSequencecrypt(CharSequence key, CharSequence salt)intdaemon(int nochdir, int noclose)intdup(int fd)intdup2(int oldFd, int newFd)intendgrent()intendpwent()jnr.ffi.Pointerenviron()interrno()voiderrno(int value)intexec(String path, String... args)Shell expanding and escaping version of exec which handles all the preparation of a command line or command list.intexec(String path, String[] args, String[] envp)Shell expanding and escaping version of exec which handles all the preparation of a command line or command list.intexecv(String path, String[] args)intexecve(String path, String[] args, String[] env)intfchmod(int fd, int mode)intfchown(int fd, int user, int group)intfcntl(int fd, jnr.constants.platform.Fcntl fcntl)intfcntl(int fd, jnr.constants.platform.Fcntl fcntl, int arg)intfcntl(int fd, jnr.constants.platform.Fcntl fcntl, int... args)Deprecated.intfcntlInt(int fd, jnr.constants.platform.Fcntl fcntl, int arg)intfdatasync(int fd)intflock(int fd, int mode)intfork()intfpathconf(int fd, jnr.constants.platform.Pathconf name)FileStatfstat(int fd)intfstat(int fd, FileStat stat)FileStatfstat(FileDescriptor fileDescriptor)intfstat(FileDescriptor fileDescriptor, FileStat stat)intfsync(int fd)intftruncate(int fd, long offset)intfutimens(int fd, long[] atimespec, long[] mtimespec)intfutimens(int fd, jnr.ffi.Pointer times)intfutimes(int fd, long[] atimeval, long[] mtimeval)Stringgetcwd()intgetdtablesize()intgetegid()Stringgetenv(String envName)intgeteuid()intgetfd(FileDescriptor descriptor)intgetgid()Groupgetgrent()Groupgetgrgid(int which)Groupgetgrnam(String which)long[]getgroups()intgetgroups(int size, int[] groups)Stringgethostname()Stringgetlogin()intgetpgid()intgetpgid(int pid)intgetpgrp()intgetpid()intgetppid()intgetpriority(int which, int who)Passwdgetpwent()Passwdgetpwnam(String which)Passwdgetpwuid(int which)RLimitgetrlimit(int resource)intgetrlimit(int resource, jnr.ffi.Pointer rlim)intgetrlimit(int resource, RLimit rlim)intgettimeofday(Timeval tv)intgetuid()intisatty(int fd)booleanisatty(FileDescriptor fd)booleanisNative()intkill(int pid, int signal)intkill(long pid, int signal)intlchmod(String filename, int mode)intlchown(String filename, int user, int group)LibClibc()Returns null if isNative returns false.intlink(String oldpath, String newpath)intlseek(int fd, long offset, int whence)longlseekLong(int fd, long offset, int whence)FileStatlstat(String path)intlstat(String path, FileStat stat)intlutimes(String path, long[] atimeval, long[] mtimeval)intmkdir(String path, int mode)intmkfifo(String filename, int mode)ProcessMakernewProcessMaker()ProcessMakernewProcessMaker(String... command)Stringnl_langinfo(int item)intopen(CharSequence path, int flags, int perm)intpipe(int[] fds)longposix_spawnp(String path, Collection<? extends SpawnFileAction> fileActions, CharSequence[] argv, CharSequence[] envp)longposix_spawnp(String path, Collection<? extends SpawnFileAction> fileActions, Collection<? extends CharSequence> argv, Collection<? extends CharSequence> envp)longposix_spawnp(String path, Collection<? extends SpawnFileAction> fileActions, Collection<? extends SpawnAttribute> spawnAttributes, CharSequence[] argv, CharSequence[] envp)longposix_spawnp(String path, Collection<? extends SpawnFileAction> fileActions, Collection<? extends SpawnAttribute> spawnAttributes, Collection<? extends CharSequence> argv, Collection<? extends CharSequence> envp)intpread(int fd, byte[] buf, int n, int offset)longpread(int fd, byte[] buf, long n, long offset)intpread(int fd, ByteBuffer buf, int n, int offset)longpread(int fd, ByteBuffer buf, long n, long offset)intpwrite(int fd, byte[] buf, int n, int offset)longpwrite(int fd, byte[] buf, long n, long offset)intpwrite(int fd, ByteBuffer buf, int n, int offset)longpwrite(int fd, ByteBuffer buf, long n, long offset)intraise(int sig)intread(int fd, byte[] buf, int n)longread(int fd, byte[] buf, long n)intread(int fd, ByteBuffer buf, int n)longread(int fd, ByteBuffer buf, long n)intreadlink(CharSequence path, byte[] buf, int bufsize)intreadlink(CharSequence path, ByteBuffer buf, int bufsize)intreadlink(CharSequence path, jnr.ffi.Pointer bufPtr, int bufsize)Stringreadlink(String oldpath)intrecvmsg(int socket, MsgHdr message, int flags)intrename(CharSequence oldName, CharSequence newName)intrmdir(String path)intsendmsg(int socket, MsgHdr message, int flags)intsetegid(int egid)intsetenv(String envName, String envValue, int overwrite)intseteuid(int euid)intsetgid(int gid)intsetgrent()Stringsetlocale(int category, String locale)intsetpgid(int pid, int pgid)intsetpgrp(int pid, int pgrp)intsetpriority(int which, int who, int prio)intsetpwent()intsetrlimit(int resource, long rlimCur, long rlimMax)intsetrlimit(int resource, jnr.ffi.Pointer rlim)intsetrlimit(int resource, RLimit rlim)intsetsid()intsetuid(int uid)SignalHandlersignal(jnr.constants.platform.Signal sig, SignalHandler handler)intsocketpair(int domain, int type, int protocol, int[] fds)FileStatstat(String path)intstat(String path, FileStat stat)Stringstrerror(int code)intsymlink(String oldpath, String newpath)longsysconf(jnr.constants.platform.Sysconf name)Timestimes()inttruncate(CharSequence path, long length)intumask(int mask)protected intunimplementedInt()protected <T> TunimplementedNull()intunlink(CharSequence path)intunsetenv(String envName)intutimensat(int dirfd, String path, long[] atimespec, long[] mtimespec, int flag)intutimensat(int dirfd, String path, jnr.ffi.Pointer times, int flag)intutimes(String path, long[] atimeval, long[] mtimeval)intutimes(String path, jnr.ffi.Pointer times)intwait(int[] status)intwaitpid(int pid, int[] status, int flags)intwaitpid(long pid, int[] status, int flags)intwrite(int fd, byte[] buf, int n)longwrite(int fd, byte[] buf, long n)intwrite(int fd, ByteBuffer buf, int n)longwrite(int fd, 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 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,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(String... command)
- Specified by:
newProcessMakerin interfacePOSIX
-
newProcessMaker
public ProcessMaker newProcessMaker()
- Specified by:
newProcessMakerin interfacePOSIX
-
libc
public final LibC libc()
Description copied from interface:POSIXReturns null if isNative returns false.
-
crypt
public final Crypt crypt()
-
unimplementedNull
protected <T> T unimplementedNull()
-
unimplementedInt
protected int unimplementedInt()
-
chown
public int chown(String filename, int user, int group)
-
crypt
public CharSequence crypt(CharSequence key, CharSequence salt)
-
crypt
public byte[] crypt(byte[] key, byte[] salt)Description copied from interface:POSIXCall the crypt function with the given key and salt as raw null-terminated byte (C char) strings.
-
exec
public int exec(String path, String... args)
Description copied from interface:POSIXShell expanding and escaping version of exec which handles all the preparation of a command line or command list.
-
exec
public int exec(String path, String[] args, String[] envp)
Description copied from interface:POSIXShell expanding and escaping version of exec which handles all the preparation of a command line or command list.
-
fstat
public FileStat fstat(FileDescriptor fileDescriptor)
-
fstat
public int fstat(FileDescriptor fileDescriptor, FileStat stat)
-
getdtablesize
public int getdtablesize()
- Specified by:
getdtablesizein 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(FileDescriptor descriptor)
-
signal
public SignalHandler signal(jnr.constants.platform.Signal sig, SignalHandler handler)
-
lchown
public int lchown(String filename, int user, int group)
-
readlink
public String readlink(String oldpath) throws IOException
- Specified by:
readlinkin interfacePOSIX- Throws:
IOException
-
readlink
public int readlink(CharSequence path, byte[] buf, int bufsize)
-
readlink
public int readlink(CharSequence path, ByteBuffer buf, int bufsize)
-
readlink
public int readlink(CharSequence path, jnr.ffi.Pointer bufPtr, int bufsize)
-
utimes
public int utimes(String path, long[] atimeval, long[] mtimeval)
-
utimes
public int utimes(String path, jnr.ffi.Pointer times)
-
futimes
public int futimes(int fd, long[] atimeval, long[] mtimeval)
-
lutimes
public int lutimes(String path, long[] atimeval, long[] mtimeval)
-
utimensat
public int utimensat(int dirfd, String path, long[] atimespec, long[] mtimespec, int flag)
-
utimensat
public int utimensat(int dirfd, 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:
getpriorityin interfacePOSIX
-
setpriority
public int setpriority(int which, int who, int prio)- Specified by:
setpriorityin interfacePOSIX
-
isatty
public boolean isatty(FileDescriptor fd)
-
posix_spawnp
public long posix_spawnp(String path, Collection<? extends SpawnFileAction> fileActions, CharSequence[] argv, CharSequence[] envp)
-
posix_spawnp
public long posix_spawnp(String path, Collection<? extends SpawnFileAction> fileActions, Collection<? extends CharSequence> argv, Collection<? extends CharSequence> envp)
- Specified by:
posix_spawnpin interfacePOSIX
-
posix_spawnp
public long posix_spawnp(String path, Collection<? extends SpawnFileAction> fileActions, Collection<? extends SpawnAttribute> spawnAttributes, Collection<? extends CharSequence> argv, Collection<? extends CharSequence> envp)
- Specified by:
posix_spawnpin interfacePOSIX
-
posix_spawnp
public long posix_spawnp(String path, Collection<? extends SpawnFileAction> fileActions, Collection<? extends SpawnAttribute> spawnAttributes, CharSequence[] argv, 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:POSIXfcntl(2)- Specified by:
fcntlin interfacePOSIX- Parameters:
fd- the file descriptor on which to actfcntl- theFcntlenum 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(CharSequence path, int amode)
-
allocateStat
public abstract FileStat allocateStat()
- Specified by:
allocateStatin interfacePOSIX
-
sysconf
public long sysconf(jnr.constants.platform.Sysconf name)
-
confstr
public int confstr(jnr.constants.platform.Confstr name, ByteBuffer buf, int len)
-
fpathconf
public int fpathconf(int fd, jnr.constants.platform.Pathconf name)
-
unlink
public int unlink(CharSequence path)
-
open
public int open(CharSequence path, int flags, int perm)
-
read
public long read(int fd, ByteBuffer buf, long n)
-
write
public long write(int fd, 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, ByteBuffer buf, long n, long offset)
-
pwrite
public long pwrite(int fd, ByteBuffer buf, long n, long offset)
-
read
public int read(int fd, ByteBuffer buf, int n)
-
write
public int write(int fd, 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, ByteBuffer buf, int n, int offset)
-
pwrite
public int pwrite(int fd, 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:
socketpairin 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(CharSequence path, long length)
-
rename
public int rename(CharSequence oldName, CharSequence newName)
-
gethostname
public String gethostname()
- Specified by:
gethostnamein interfacePOSIX
-
nl_langinfo
public String nl_langinfo(int item)
- Specified by:
nl_langinfoin interfacePOSIX
-
allocateTimeval
public Timeval allocateTimeval()
- Specified by:
allocateTimevalin interfacePOSIX
-
gettimeofday
public int gettimeofday(Timeval tv)
- Specified by:
gettimeofdayin interfacePOSIX
-
-