Package jnr.posix
Class WindowsPOSIX
java.lang.Object
jnr.posix.NativePOSIX
jnr.posix.BaseNativePOSIX
jnr.posix.WindowsPOSIX
- All Implemented Interfaces:
POSIX
-
Nested Class Summary
Nested classes/interfaces inherited from class jnr.posix.BaseNativePOSIX
BaseNativePOSIX.PointerConverter
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final FileStat
private static final int
private static final int
(package private) static final int
static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
(package private) static final int
private static final int
private static final int
static final BaseNativePOSIX.PointerConverter
private static final int
private static final int
Fields inherited from class jnr.posix.BaseNativePOSIX
ConstantConverter, FileStatConverter, GROUP, handler, helper, MsgHdrConverter, signalHandlers, TimesConverter
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
int
private int
checkFd
(int fd) private int
childResult
(WindowsChildRecord child, boolean overlay) int
int
private WindowsChildRecord
createProcess
(String callingMethodName, String command, String program, WindowsSecurityAttributes securityAttributes, HANDLE input, HANDLE output, HANDLE error, String[] envp) byte[]
crypt
(byte[] key, byte[] salt) Call the crypt function with the given key and salt as raw null-terminated byte (C char) strings.crypt
(CharSequence key, CharSequence salt) private FileTime
int
endgrent()
int
endpwent()
jnr.ffi.Pointer
environ()
int
Shell expanding and escaping version of exec which handles all the preparation of a command line or command list.int
Shell expanding and escaping version of exec which handles all the preparation of a command line or command list.int
int
fcntlInt
(int fd, jnr.constants.platform.Fcntl fcntl, int arg) int
findFirstFile
(String path, FileStat stat) fstat
(int fd) int
fstat
(FileDescriptor fileDescriptor, FileStat stat) int
getegid()
int
geteuid()
int
getgid()
getgrent()
getgrgid
(int which) getlogin()
int
getpgid()
int
getpgid
(int pid) int
getpid()
int
getppid()
int
getpriority
(int which, int who) getpwent()
getpwuid
(int which) int
gettimeofday
(Timeval tv) int
getuid()
int
isatty
(int fd) boolean
isatty
(FileDescriptor fd) int
kill
(int pid, int signal) int
kill
(long pid, int signal) int
int
int
int
private static jnr.constants.platform.Errno
mapErrorToErrno
(int error) int
int
private FileTime
int
pipe
(int[] fds) int
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.int
setegid
(int egid) int
int
seteuid
(int euid) private int
setFileTime
(String path, FileTime aTime, FileTime mTime) int
setgid
(int gid) int
setgrent()
int
setpgid
(int pid, int pgid) int
setpriority
(int which, int who, int prio) int
setpwent()
int
setuid
(int uid) int
int
private FileTime
timespecToFileTime
(long[] timespec) private FileTime
timevalToFileTime
(long[] timeval) int
truncate
(CharSequence path, long length) int
umask
(int mask) private FileTime
unixTimeToFileTime
(long unixEpochIn100ns) int
int
int
int
wait
(int[] status) int
waitpid
(int pid, int[] status, int flags) int
waitpid
(long pid, int[] status, int flags) private WindowsLibC
wlibc()
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, handler, 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, getRuntime
-
Field Details
-
FILE_TYPE_CHAR
private static final int FILE_TYPE_CHAR- See Also:
-
errorToErrnoMapper
-
checkFdStat
-
GENERIC_ALL
private static final int GENERIC_ALL- See Also:
-
GENERIC_READ
private static final int GENERIC_READ- See Also:
-
GENERIC_WRITE
private static final int GENERIC_WRITE- See Also:
-
GENERIC_EXECUTE
private static final int GENERIC_EXECUTE- See Also:
-
FILE_SHARE_DELETE
private static final int FILE_SHARE_DELETE- See Also:
-
FILE_SHARE_READ
private static final int FILE_SHARE_READ- See Also:
-
FILE_SHARE_WRITE
private static final int FILE_SHARE_WRITE- See Also:
-
CREATE_ALWAYS
private static final int CREATE_ALWAYS- See Also:
-
CREATE_NEW
private static final int CREATE_NEW- See Also:
-
OPEN_ALWAYS
private static final int OPEN_ALWAYS- See Also:
-
OPEN_EXISTING
private static final int OPEN_EXISTING- See Also:
-
TRUNCATE_EXISTING
private static final int TRUNCATE_EXISTING- See Also:
-
FILE_FLAG_BACKUP_SEMANTICS
public static final int FILE_FLAG_BACKUP_SEMANTICS- See Also:
-
FILE_ATTRIBUTE_READONLY
static final int FILE_ATTRIBUTE_READONLY- See Also:
-
INVALID_FILE_ATTRIBUTES
static final int INVALID_FILE_ATTRIBUTES- See Also:
-
STARTF_USESTDHANDLES
private static final int STARTF_USESTDHANDLES- See Also:
-
PASSWD
-
-
Constructor Details
-
WindowsPOSIX
WindowsPOSIX(LibCProvider libc, POSIXHandler handler)
-
-
Method Details
-
allocateStat
- Specified by:
allocateStat
in interfacePOSIX
- Specified by:
allocateStat
in classBaseNativePOSIX
-
allocateMsgHdr
-
socketMacros
- Specified by:
socketMacros
in classNativePOSIX
-
kill
public int kill(int pid, int signal) - Specified by:
kill
in interfacePOSIX
- Overrides:
kill
in classBaseNativePOSIX
-
kill
public int kill(long pid, int signal) - Specified by:
kill
in interfacePOSIX
- Overrides:
kill
in classBaseNativePOSIX
-
chmod
- Specified by:
chmod
in interfacePOSIX
- Overrides:
chmod
in classBaseNativePOSIX
-
chdir
- Specified by:
chdir
in interfacePOSIX
- Overrides:
chdir
in classBaseNativePOSIX
-
chown
- Specified by:
chown
in interfacePOSIX
- Overrides:
chown
in classBaseNativePOSIX
-
exec
Description copied from interface:POSIX
Shell expanding and escaping version of exec which handles all the preparation of a command line or command list.- Specified by:
exec
in interfacePOSIX
- Overrides:
exec
in 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
- Specified by:
crypt
in interfacePOSIX
- Overrides:
crypt
in classBaseNativePOSIX
-
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.- Specified by:
crypt
in interfacePOSIX
- Overrides:
crypt
in classBaseNativePOSIX
- Parameters:
key
- null-terminated key bytessalt
- null-terminated salt bytes- Returns:
- null-terminated crypted bytes, or null if there was an error
-
exec
Description copied from interface:POSIX
Shell expanding and escaping version of exec which handles all the preparation of a command line or command list.- Specified by:
exec
in interfacePOSIX
- Overrides:
exec
in 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
- Specified by:
execv
in interfacePOSIX
- Overrides:
execv
in classBaseNativePOSIX
-
getegid
public int getegid()- Specified by:
getegid
in interfacePOSIX
- Overrides:
getegid
in classBaseNativePOSIX
-
setegid
public int setegid(int egid) - Specified by:
setegid
in interfacePOSIX
- Overrides:
setegid
in classBaseNativePOSIX
-
geteuid
public int geteuid()- Specified by:
geteuid
in interfacePOSIX
- Overrides:
geteuid
in classBaseNativePOSIX
-
seteuid
public int seteuid(int euid) - Specified by:
seteuid
in interfacePOSIX
- Overrides:
seteuid
in classBaseNativePOSIX
-
getuid
public int getuid()- Specified by:
getuid
in interfacePOSIX
- Overrides:
getuid
in classBaseNativePOSIX
-
setuid
public int setuid(int uid) - Specified by:
setuid
in interfacePOSIX
- Overrides:
setuid
in classBaseNativePOSIX
-
getgid
public int getgid()- Specified by:
getgid
in interfacePOSIX
- Overrides:
getgid
in classBaseNativePOSIX
-
setgid
public int setgid(int gid) - Specified by:
setgid
in interfacePOSIX
- Overrides:
setgid
in classBaseNativePOSIX
-
getpgid
public int getpgid(int pid) - Specified by:
getpgid
in interfacePOSIX
- Overrides:
getpgid
in classBaseNativePOSIX
-
getpgid
public int getpgid()- Specified by:
getpgid
in interfacePOSIX
- Overrides:
getpgid
in classBaseNativePOSIX
-
setpgid
public int setpgid(int pid, int pgid) - Specified by:
setpgid
in interfacePOSIX
- Overrides:
setpgid
in classBaseNativePOSIX
-
getpriority
public int getpriority(int which, int who) - Specified by:
getpriority
in interfacePOSIX
- Overrides:
getpriority
in classBaseNativePOSIX
-
setpriority
public int setpriority(int which, int who, int prio) - Specified by:
setpriority
in interfacePOSIX
- Overrides:
setpriority
in classBaseNativePOSIX
-
getpid
public int getpid()- Specified by:
getpid
in interfacePOSIX
- Overrides:
getpid
in classBaseNativePOSIX
-
getppid
public int getppid()- Specified by:
getppid
in interfacePOSIX
- Overrides:
getppid
in classBaseNativePOSIX
-
lchmod
- Specified by:
lchmod
in interfacePOSIX
- Overrides:
lchmod
in classBaseNativePOSIX
-
lchown
- Specified by:
lchown
in interfacePOSIX
- Overrides:
lchown
in classBaseNativePOSIX
-
gethostname
- Specified by:
gethostname
in interfacePOSIX
- Overrides:
gethostname
in classBaseNativePOSIX
-
fstat
- Specified by:
fstat
in interfacePOSIX
- Overrides:
fstat
in classBaseNativePOSIX
-
fstat
- Specified by:
fstat
in interfacePOSIX
- Overrides:
fstat
in classBaseNativePOSIX
-
lstat
- Specified by:
lstat
in interfacePOSIX
- Overrides:
lstat
in classBaseNativePOSIX
-
lstat
- Specified by:
lstat
in interfacePOSIX
- Overrides:
lstat
in classBaseNativePOSIX
-
stat
- Specified by:
stat
in interfacePOSIX
- Overrides:
stat
in classBaseNativePOSIX
-
findFirstFile
-
readlink
- Specified by:
readlink
in interfacePOSIX
- Overrides:
readlink
in classBaseNativePOSIX
-
environ
public jnr.ffi.Pointer environ()- Specified by:
environ
in interfacePOSIX
- Overrides:
environ
in classBaseNativePOSIX
-
setenv
- Specified by:
setenv
in interfacePOSIX
- Overrides:
setenv
in classBaseNativePOSIX
-
umask
public int umask(int mask) - Specified by:
umask
in interfacePOSIX
- Overrides:
umask
in classBaseNativePOSIX
-
unsetenv
- Specified by:
unsetenv
in interfacePOSIX
- Overrides:
unsetenv
in classBaseNativePOSIX
-
utimes
- Specified by:
utimes
in interfacePOSIX
- Overrides:
utimes
in classBaseNativePOSIX
-
utimensat
- Specified by:
utimensat
in interfacePOSIX
- Overrides:
utimensat
in classBaseNativePOSIX
-
timevalToFileTime
-
timespecToFileTime
-
setFileTime
-
unixTimeToFileTime
- Parameters:
unixEpochIn100ns
- epoch time in 100-ns precision- Returns:
- associated FILETIME structure
-
nullFileTime
-
currentFileTime
-
wait
public int wait(int[] status) - Specified by:
wait
in interfacePOSIX
- Overrides:
wait
in classBaseNativePOSIX
-
waitpid
public int waitpid(int pid, int[] status, int flags) - Specified by:
waitpid
in interfacePOSIX
- Overrides:
waitpid
in classBaseNativePOSIX
-
waitpid
public int waitpid(long pid, int[] status, int flags) - Specified by:
waitpid
in interfacePOSIX
- Overrides:
waitpid
in classBaseNativePOSIX
-
getlogin
- Specified by:
getlogin
in interfacePOSIX
- Overrides:
getlogin
in classBaseNativePOSIX
-
endgrent
public int endgrent()- Specified by:
endgrent
in interfacePOSIX
- Overrides:
endgrent
in classBaseNativePOSIX
-
endpwent
public int endpwent()- Specified by:
endpwent
in interfacePOSIX
- Overrides:
endpwent
in classBaseNativePOSIX
-
getgrent
- Specified by:
getgrent
in interfacePOSIX
- Overrides:
getgrent
in classBaseNativePOSIX
-
getpwent
- Specified by:
getpwent
in interfacePOSIX
- Overrides:
getpwent
in classBaseNativePOSIX
-
getgrgid
- Specified by:
getgrgid
in interfacePOSIX
- Overrides:
getgrgid
in classBaseNativePOSIX
-
getpwnam
- Specified by:
getpwnam
in interfacePOSIX
- Overrides:
getpwnam
in classBaseNativePOSIX
-
getgrnam
- Specified by:
getgrnam
in interfacePOSIX
- Overrides:
getgrnam
in classBaseNativePOSIX
-
setgrent
public int setgrent()- Specified by:
setgrent
in interfacePOSIX
- Overrides:
setgrent
in classBaseNativePOSIX
-
setpwent
public int setpwent()- Specified by:
setpwent
in interfacePOSIX
- Overrides:
setpwent
in classBaseNativePOSIX
-
getpwuid
- Specified by:
getpwuid
in interfacePOSIX
- Overrides:
getpwuid
in classBaseNativePOSIX
-
isatty
- Specified by:
isatty
in interfacePOSIX
- Overrides:
isatty
in classBaseNativePOSIX
-
isatty
public int isatty(int fd) - Specified by:
isatty
in interfacePOSIX
- Overrides:
isatty
in classBaseNativePOSIX
-
mkdir
- Specified by:
mkdir
in interfacePOSIX
- Overrides:
mkdir
in classBaseNativePOSIX
-
rmdir
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:
rmdir
in interfacePOSIX
- Overrides:
rmdir
in classBaseNativePOSIX
- Parameters:
path
- the path to remove- Returns:
- 0 if successful, -1 if failed
-
link
- Specified by:
link
in interfacePOSIX
- Overrides:
link
in classBaseNativePOSIX
-
aspawn
- 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:
pipe
in interfacePOSIX
- Overrides:
pipe
in classBaseNativePOSIX
-
truncate
- Specified by:
truncate
in interfacePOSIX
- Overrides:
truncate
in classBaseNativePOSIX
-
fcntlInt
public int fcntlInt(int fd, jnr.constants.platform.Fcntl fcntl, int arg) - Specified by:
fcntlInt
in interfacePOSIX
- Overrides:
fcntlInt
in classBaseNativePOSIX
-
wlibc
-
spawn
- 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
-
childResult
-
mapErrorToErrno
private static jnr.constants.platform.Errno mapErrorToErrno(int error) -
createProcess
private WindowsChildRecord createProcess(String callingMethodName, String command, String program, WindowsSecurityAttributes securityAttributes, HANDLE input, HANDLE output, HANDLE error, String[] envp) -
checkFd
private int checkFd(int fd) -
mkfifo
- Specified by:
mkfifo
in interfacePOSIX
- Overrides:
mkfifo
in classBaseNativePOSIX
-
allocateTimeval
- Specified by:
allocateTimeval
in interfacePOSIX
- Overrides:
allocateTimeval
in classBaseNativePOSIX
-
gettimeofday
- Specified by:
gettimeofday
in interfacePOSIX
- Overrides:
gettimeofday
in classBaseNativePOSIX
-