- java.lang.Object
-
- jnr.posix.NativePOSIX
-
- jnr.posix.BaseNativePOSIX
-
- jnr.posix.WindowsPOSIX
-
- All Implemented Interfaces:
POSIX
public final class WindowsPOSIX extends BaseNativePOSIX
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jnr.posix.BaseNativePOSIX
BaseNativePOSIX.PointerConverter
-
-
Field Summary
Fields Modifier and Type Field Description static intFILE_FLAG_BACKUP_SEMANTICSstatic BaseNativePOSIX.PointerConverterPASSWD-
Fields inherited from class jnr.posix.BaseNativePOSIX
ConstantConverter, FileStatConverter, GROUP, handler, helper, MsgHdrConverter, signalHandlers, TimesConverter
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MsgHdrallocateMsgHdr()FileStatallocateStat()TimevalallocateTimeval()intaspawn(boolean overlay, String program, String[] argv, String path, String[] envp)intchdir(String path)intchmod(String filename, int mode)intchown(String filename, int user, int group)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)intendgrent()intendpwent()jnr.ffi.Pointerenviron()intexec(String path, String[] argv)Shell expanding and escaping version of exec which handles all the preparation of a command line or command list.intexec(String path, String[] argv, 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[] argv)intfcntlInt(int fd, jnr.constants.platform.Fcntl fcntl, int arg)intfindFirstFile(String path, FileStat stat)FileStatfstat(int fd)intfstat(FileDescriptor fileDescriptor, FileStat stat)intgetegid()intgeteuid()intgetgid()Groupgetgrent()Groupgetgrgid(int which)Groupgetgrnam(String which)Stringgethostname()Stringgetlogin()intgetpgid()intgetpgid(int pid)intgetpid()intgetppid()intgetpriority(int which, int who)Passwdgetpwent()Passwdgetpwnam(String which)Passwdgetpwuid(int which)intgettimeofday(Timeval tv)intgetuid()intisatty(int fd)booleanisatty(FileDescriptor fd)intkill(int pid, int signal)intkill(long pid, int signal)intlchmod(String filename, int mode)intlchown(String filename, int user, int group)intlink(String oldpath, String newpath)FileStatlstat(String path)intlstat(String path, FileStat stat)intmkdir(String path, int mode)intmkfifo(String filename, int mode)intpipe(int[] fds)Stringreadlink(String oldpath)intrmdir(String path)The logic here is a bit strange and this copies MRI (Ruby) which may not be language agnostic, but windows (win7 and others) automatically mark folders as read-only when it contains other files and folders within it.intsetegid(int egid)intsetenv(String envName, String envValue, int overwrite)intseteuid(int euid)intsetgid(int gid)intsetgrent()intsetpgid(int pid, int pgid)intsetpriority(int which, int who, int prio)intsetpwent()intsetuid(int uid)SocketMacrossocketMacros()intspawn(boolean overlay, String command, String program, String path, String[] envp)intstat(String path, FileStat stat)inttruncate(CharSequence path, long length)intumask(int mask)intunsetenv(String envName)intutimensat(int dirfd, String path, long[] atimespec, long[] mtimespec, int flag)intutimes(String path, long[] atimeval, long[] mtimeval)intwait(int[] status)intwaitpid(int pid, int[] status, int flags)intwaitpid(long pid, int[] status, int flags)-
Methods inherited from class jnr.posix.BaseNativePOSIX
access, close, confstr, crypt, daemon, dup, dup2, errno, errno, execve, fchmod, fchown, fcntl, fcntl, fcntl, fdatasync, flock, fork, fpathconf, fstat, fstat, fsync, ftruncate, futimens, futimens, futimes, getcwd, getdtablesize, getenv, getfd, getgroups, getgroups, getpgrp, getrlimit, getrlimit, getrlimit, isNative, libc, lseek, lseekLong, lutimes, newProcessMaker, newProcessMaker, nl_langinfo, open, posix_spawnp, posix_spawnp, posix_spawnp, posix_spawnp, pread, pread, pread, pread, pwrite, pwrite, pwrite, pwrite, raise, read, read, read, read, readlink, readlink, readlink, recvmsg, rename, sendmsg, setlocale, setpgrp, setrlimit, setrlimit, setrlimit, setsid, signal, socketpair, stat, strerror, symlink, sysconf, times, unimplementedInt, unimplementedNull, unlink, utimensat, utimes, write, write, write, write
-
Methods inherited from class jnr.posix.NativePOSIX
allocatePosixSpawnattr, allocatePosixSpawnFileActions
-
-
-
-
Field Detail
-
FILE_FLAG_BACKUP_SEMANTICS
public static final int FILE_FLAG_BACKUP_SEMANTICS
- See Also:
- Constant Field Values
-
PASSWD
public static final BaseNativePOSIX.PointerConverter PASSWD
-
-
Method Detail
-
allocateStat
public FileStat allocateStat()
- Specified by:
allocateStatin interfacePOSIX- Specified by:
allocateStatin classBaseNativePOSIX
-
allocateMsgHdr
public MsgHdr allocateMsgHdr()
-
socketMacros
public SocketMacros socketMacros()
- Specified by:
socketMacrosin classNativePOSIX
-
kill
public int kill(int pid, int signal)- Specified by:
killin interfacePOSIX- Overrides:
killin classBaseNativePOSIX
-
kill
public int kill(long pid, int signal)- Specified by:
killin interfacePOSIX- Overrides:
killin classBaseNativePOSIX
-
chmod
public int chmod(String filename, int mode)
- Specified by:
chmodin interfacePOSIX- Overrides:
chmodin classBaseNativePOSIX
-
chdir
public int chdir(String path)
- Specified by:
chdirin interfacePOSIX- Overrides:
chdirin classBaseNativePOSIX
-
chown
public int chown(String filename, int user, int group)
- Specified by:
chownin interfacePOSIX- Overrides:
chownin classBaseNativePOSIX
-
exec
public int exec(String path, String[] argv)
Description copied from interface:POSIXShell expanding and escaping version of exec which handles all the preparation of a command line or command list.- Specified by:
execin interfacePOSIX- Overrides:
execin classBaseNativePOSIX- Parameters:
path- the path to executeargv- the arguments to pass, with arg0 equal to the desired process name- Returns:
- does not return if successful; -1 if failed
-
crypt
public CharSequence crypt(CharSequence key, CharSequence salt)
- Specified by:
cryptin interfacePOSIX- Overrides:
cryptin classBaseNativePOSIX
-
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.- Specified by:
cryptin interfacePOSIX- Overrides:
cryptin classBaseNativePOSIX- Parameters:
key- null-terminated key bytessalt- null-terminated salt bytes- Returns:
- null-terminated crypted bytes, or null if there was an error
-
exec
public int exec(String path, String[] argv, 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.- Specified by:
execin interfacePOSIX- Overrides:
execin classBaseNativePOSIX- Parameters:
path- the path to executeargv- the arguments to pass, with arg0 equal to the desired process nameenvp- a set of KEY=VALUE environment strings to set for the new execution- Returns:
- does not return if successful; -1 if failed
-
execv
public int execv(String path, String[] argv)
- Specified by:
execvin interfacePOSIX- Overrides:
execvin classBaseNativePOSIX
-
getegid
public int getegid()
- Specified by:
getegidin interfacePOSIX- Overrides:
getegidin classBaseNativePOSIX
-
setegid
public int setegid(int egid)
- Specified by:
setegidin interfacePOSIX- Overrides:
setegidin classBaseNativePOSIX
-
geteuid
public int geteuid()
- Specified by:
geteuidin interfacePOSIX- Overrides:
geteuidin classBaseNativePOSIX
-
seteuid
public int seteuid(int euid)
- Specified by:
seteuidin interfacePOSIX- Overrides:
seteuidin classBaseNativePOSIX
-
getuid
public int getuid()
- Specified by:
getuidin interfacePOSIX- Overrides:
getuidin classBaseNativePOSIX
-
setuid
public int setuid(int uid)
- Specified by:
setuidin interfacePOSIX- Overrides:
setuidin classBaseNativePOSIX
-
getgid
public int getgid()
- Specified by:
getgidin interfacePOSIX- Overrides:
getgidin classBaseNativePOSIX
-
setgid
public int setgid(int gid)
- Specified by:
setgidin interfacePOSIX- Overrides:
setgidin classBaseNativePOSIX
-
getpgid
public int getpgid(int pid)
- Specified by:
getpgidin interfacePOSIX- Overrides:
getpgidin classBaseNativePOSIX
-
getpgid
public int getpgid()
- Specified by:
getpgidin interfacePOSIX- Overrides:
getpgidin classBaseNativePOSIX
-
setpgid
public int setpgid(int pid, int pgid)- Specified by:
setpgidin interfacePOSIX- Overrides:
setpgidin classBaseNativePOSIX
-
getpriority
public int getpriority(int which, int who)- Specified by:
getpriorityin interfacePOSIX- Overrides:
getpriorityin classBaseNativePOSIX
-
setpriority
public int setpriority(int which, int who, int prio)- Specified by:
setpriorityin interfacePOSIX- Overrides:
setpriorityin classBaseNativePOSIX
-
getpid
public int getpid()
- Specified by:
getpidin interfacePOSIX- Overrides:
getpidin classBaseNativePOSIX
-
getppid
public int getppid()
- Specified by:
getppidin interfacePOSIX- Overrides:
getppidin classBaseNativePOSIX
-
lchmod
public int lchmod(String filename, int mode)
- Specified by:
lchmodin interfacePOSIX- Overrides:
lchmodin classBaseNativePOSIX
-
lchown
public int lchown(String filename, int user, int group)
- Specified by:
lchownin interfacePOSIX- Overrides:
lchownin classBaseNativePOSIX
-
gethostname
public String gethostname()
- Specified by:
gethostnamein interfacePOSIX- Overrides:
gethostnamein classBaseNativePOSIX
-
fstat
public FileStat fstat(int fd)
- Specified by:
fstatin interfacePOSIX- Overrides:
fstatin classBaseNativePOSIX
-
fstat
public int fstat(FileDescriptor fileDescriptor, FileStat stat)
- Specified by:
fstatin interfacePOSIX- Overrides:
fstatin classBaseNativePOSIX
-
lstat
public FileStat lstat(String path)
- Specified by:
lstatin interfacePOSIX- Overrides:
lstatin classBaseNativePOSIX
-
lstat
public int lstat(String path, FileStat stat)
- Specified by:
lstatin interfacePOSIX- Overrides:
lstatin classBaseNativePOSIX
-
stat
public int stat(String path, FileStat stat)
- Specified by:
statin interfacePOSIX- Overrides:
statin classBaseNativePOSIX
-
readlink
public String readlink(String oldpath)
- Specified by:
readlinkin interfacePOSIX- Overrides:
readlinkin classBaseNativePOSIX
-
environ
public jnr.ffi.Pointer environ()
- Specified by:
environin interfacePOSIX- Overrides:
environin classBaseNativePOSIX
-
setenv
public int setenv(String envName, String envValue, int overwrite)
- Specified by:
setenvin interfacePOSIX- Overrides:
setenvin classBaseNativePOSIX
-
umask
public int umask(int mask)
- Specified by:
umaskin interfacePOSIX- Overrides:
umaskin classBaseNativePOSIX
-
unsetenv
public int unsetenv(String envName)
- Specified by:
unsetenvin interfacePOSIX- Overrides:
unsetenvin classBaseNativePOSIX
-
utimes
public int utimes(String path, long[] atimeval, long[] mtimeval)
- Specified by:
utimesin interfacePOSIX- Overrides:
utimesin classBaseNativePOSIX
-
utimensat
public int utimensat(int dirfd, String path, long[] atimespec, long[] mtimespec, int flag)- Specified by:
utimensatin interfacePOSIX- Overrides:
utimensatin classBaseNativePOSIX
-
wait
public int wait(int[] status)
- Specified by:
waitin interfacePOSIX- Overrides:
waitin classBaseNativePOSIX
-
waitpid
public int waitpid(int pid, int[] status, int flags)- Specified by:
waitpidin interfacePOSIX- Overrides:
waitpidin classBaseNativePOSIX
-
waitpid
public int waitpid(long pid, int[] status, int flags)- Specified by:
waitpidin interfacePOSIX- Overrides:
waitpidin classBaseNativePOSIX
-
getlogin
public String getlogin()
- Specified by:
getloginin interfacePOSIX- Overrides:
getloginin classBaseNativePOSIX
-
endgrent
public int endgrent()
- Specified by:
endgrentin interfacePOSIX- Overrides:
endgrentin classBaseNativePOSIX
-
endpwent
public int endpwent()
- Specified by:
endpwentin interfacePOSIX- Overrides:
endpwentin classBaseNativePOSIX
-
getgrent
public Group getgrent()
- Specified by:
getgrentin interfacePOSIX- Overrides:
getgrentin classBaseNativePOSIX
-
getpwent
public Passwd getpwent()
- Specified by:
getpwentin interfacePOSIX- Overrides:
getpwentin classBaseNativePOSIX
-
getgrgid
public Group getgrgid(int which)
- Specified by:
getgrgidin interfacePOSIX- Overrides:
getgrgidin classBaseNativePOSIX
-
getpwnam
public Passwd getpwnam(String which)
- Specified by:
getpwnamin interfacePOSIX- Overrides:
getpwnamin classBaseNativePOSIX
-
getgrnam
public Group getgrnam(String which)
- Specified by:
getgrnamin interfacePOSIX- Overrides:
getgrnamin classBaseNativePOSIX
-
setgrent
public int setgrent()
- Specified by:
setgrentin interfacePOSIX- Overrides:
setgrentin classBaseNativePOSIX
-
setpwent
public int setpwent()
- Specified by:
setpwentin interfacePOSIX- Overrides:
setpwentin classBaseNativePOSIX
-
getpwuid
public Passwd getpwuid(int which)
- Specified by:
getpwuidin interfacePOSIX- Overrides:
getpwuidin classBaseNativePOSIX
-
isatty
public boolean isatty(FileDescriptor fd)
- Specified by:
isattyin interfacePOSIX- Overrides:
isattyin classBaseNativePOSIX
-
isatty
public int isatty(int fd)
- Specified by:
isattyin interfacePOSIX- Overrides:
isattyin classBaseNativePOSIX
-
mkdir
public int mkdir(String path, int mode)
- Specified by:
mkdirin interfacePOSIX- Overrides:
mkdirin classBaseNativePOSIX
-
rmdir
public int rmdir(String path)
The logic here is a bit strange and this copies MRI (Ruby) which may not be language agnostic, but windows (win7 and others) automatically mark folders as read-only when it contains other files and folders within it. This document explains more: http://support.microsoft.com/kb/326549 I think the logic is based around idea that if you removed all other files it would be empty but will stay marked as read-only.- Specified by:
rmdirin interfacePOSIX- Overrides:
rmdirin classBaseNativePOSIX- Parameters:
path- the path to remove- Returns:
- 0 if successful, -1 if failed
-
link
public int link(String oldpath, String newpath)
- Specified by:
linkin interfacePOSIX- Overrides:
linkin classBaseNativePOSIX
-
aspawn
public int aspawn(boolean overlay, String program, String[] argv, String path, String[] envp)- Parameters:
overlay- is P_OVERLAY if true and P_NOWAIT if falseprogram- to be invokedargv- is all args including argv0 being what is executedpath- is path to be searched when needed (delimited by ; on windows)envp- is a set of KEY=VALUE strings to be set in the child process- Returns:
- the pid
-
pipe
public int pipe(int[] fds)
- Specified by:
pipein interfacePOSIX- Overrides:
pipein classBaseNativePOSIX
-
truncate
public int truncate(CharSequence path, long length)
- Specified by:
truncatein interfacePOSIX- Overrides:
truncatein classBaseNativePOSIX
-
fcntlInt
public int fcntlInt(int fd, jnr.constants.platform.Fcntl fcntl, int arg)- Specified by:
fcntlIntin interfacePOSIX- Overrides:
fcntlIntin classBaseNativePOSIX
-
spawn
public int spawn(boolean overlay, String command, String program, String path, String[] envp)- Parameters:
overlay- is P_OVERLAY if true and P_NOWAIT if falsecommand- full command stringprogram- program to be invokedpath- is path to be searched when needed (delimited by ; on windows)envp- is a set of KEY=VALUE strings to be set in the child process- Returns:
- the pid
-
mkfifo
public int mkfifo(String filename, int mode)
- Specified by:
mkfifoin interfacePOSIX- Overrides:
mkfifoin classBaseNativePOSIX
-
allocateTimeval
public Timeval allocateTimeval()
- Specified by:
allocateTimevalin interfacePOSIX- Overrides:
allocateTimevalin classBaseNativePOSIX
-
gettimeofday
public int gettimeofday(Timeval tv)
- Specified by:
gettimeofdayin interfacePOSIX- Overrides:
gettimeofdayin classBaseNativePOSIX
-
-