Package net.bytebuddy.agent
Class VirtualMachine.ForOpenJ9.Dispatcher.ForJnaWindowsEnvironment
- java.lang.Object
-
- net.bytebuddy.agent.VirtualMachine.ForOpenJ9.Dispatcher.ForJnaWindowsEnvironment
-
- All Implemented Interfaces:
VirtualMachine.ForOpenJ9.Dispatcher
- Enclosing interface:
- VirtualMachine.ForOpenJ9.Dispatcher
public static class VirtualMachine.ForOpenJ9.Dispatcher.ForJnaWindowsEnvironment extends java.lang.Object implements VirtualMachine.ForOpenJ9.Dispatcher
A connector implementation for a Windows environment using JNA.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classVirtualMachine.ForOpenJ9.Dispatcher.ForJnaWindowsEnvironment.AttachmentHandleA handle for an attachment which is represented by a pair of handles.protected static interfaceVirtualMachine.ForOpenJ9.Dispatcher.ForJnaWindowsEnvironment.WindowsLibraryA library for interacting with Windows.-
Nested classes/interfaces inherited from interface net.bytebuddy.agent.VirtualMachine.ForOpenJ9.Dispatcher
VirtualMachine.ForOpenJ9.Dispatcher.ForJnaPosixEnvironment, VirtualMachine.ForOpenJ9.Dispatcher.ForJnaWindowsEnvironment
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringCREATION_MUTEX_NAMEThe name of the creation mutex.private VirtualMachine.ForOpenJ9.Dispatcher.ForJnaWindowsEnvironment.WindowsLibrarylibraryA library to use for interacting with Windows.private static intNO_USER_IDIndicates a missing user id what is not supported on Windows.
-
Constructor Summary
Constructors Constructor Description ForJnaWindowsEnvironment()Creates a new connector for a Windows environment using JNA.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchownFileToUser(java.io.File file, long userId)Changes the ownership of a file.voiddecrementSemaphore(java.io.File directory, java.lang.String name, boolean global, int count)Decrements a semaphore.intgetOwnerIdOf(java.io.File file)Returns the user id of the owner of the supplied file.java.lang.StringgetTemporaryFolder(java.lang.String processId)Returns this machine's temporary folder.voidincrementSemaphore(java.io.File directory, java.lang.String name, boolean global, int count)Increments a semaphore.booleanisExistingProcess(int processId)Returnstrueif the supplied process id is a running process.private VirtualMachine.ForOpenJ9.Dispatcher.ForJnaWindowsEnvironment.AttachmentHandleopenSemaphore(java.io.File directory, java.lang.String name, boolean global)Opens a semaphore for signaling another process that an attachment is performed.intpid()Returns the process id of this process.voidsetPermissions(java.io.File file, int permissions)Sets permissions for the supplied file.intuserId()Returns the user id of this process.
-
-
-
Field Detail
-
NO_USER_ID
private static final int NO_USER_ID
Indicates a missing user id what is not supported on Windows.- See Also:
- Constant Field Values
-
CREATION_MUTEX_NAME
private static final java.lang.String CREATION_MUTEX_NAME
The name of the creation mutex.- See Also:
- Constant Field Values
-
library
private final VirtualMachine.ForOpenJ9.Dispatcher.ForJnaWindowsEnvironment.WindowsLibrary library
A library to use for interacting with Windows.
-
-
Method Detail
-
getTemporaryFolder
public java.lang.String getTemporaryFolder(java.lang.String processId)
Returns this machine's temporary folder.- Specified by:
getTemporaryFolderin interfaceVirtualMachine.ForOpenJ9.Dispatcher- Parameters:
processId- The target process's id.- Returns:
- The temporary folder.
-
pid
public int pid()
Returns the process id of this process.- Specified by:
pidin interfaceVirtualMachine.ForOpenJ9.Dispatcher- Returns:
- The process id of this process.
-
userId
public int userId()
Returns the user id of this process.- Specified by:
userIdin interfaceVirtualMachine.ForOpenJ9.Dispatcher- Returns:
- The user id of this process
-
isExistingProcess
public boolean isExistingProcess(int processId)
Returnstrueif the supplied process id is a running process.- Specified by:
isExistingProcessin interfaceVirtualMachine.ForOpenJ9.Dispatcher- Parameters:
processId- The process id to evaluate.- Returns:
trueif the supplied process id is currently running.
-
getOwnerIdOf
public int getOwnerIdOf(java.io.File file)
Returns the user id of the owner of the supplied file.- Specified by:
getOwnerIdOfin interfaceVirtualMachine.ForOpenJ9.Dispatcher- Parameters:
file- The file for which to locate the owner.- Returns:
- The owner id of the supplied file.
-
setPermissions
public void setPermissions(java.io.File file, int permissions)Sets permissions for the supplied file.- Specified by:
setPermissionsin interfaceVirtualMachine.ForOpenJ9.Dispatcher- Parameters:
file- The file for which to set the permissions.permissions- The permission bits to set.
-
incrementSemaphore
public void incrementSemaphore(java.io.File directory, java.lang.String name, boolean global, int count)Increments a semaphore.- Specified by:
incrementSemaphorein interfaceVirtualMachine.ForOpenJ9.Dispatcher- Parameters:
directory- The sempahore's control directory.name- The semaphore's name.global-trueif the semaphore is in the global namespace (only applicable on Windows).count- The amount of increments.
-
decrementSemaphore
public void decrementSemaphore(java.io.File directory, java.lang.String name, boolean global, int count)Decrements a semaphore.- Specified by:
decrementSemaphorein interfaceVirtualMachine.ForOpenJ9.Dispatcher- Parameters:
directory- The sempahore's control directory.name- The semaphore's name.global-trueif the semaphore is in the global namespace (only applicable on Windows).count- The amount of decrements.
-
chownFileToUser
public void chownFileToUser(java.io.File file, long userId)Changes the ownership of a file. Can be called only if this process is owned by root.- Specified by:
chownFileToUserin interfaceVirtualMachine.ForOpenJ9.Dispatcher- Parameters:
file- The path of the file to change ownership of.userId- The user that should own the file.
-
openSemaphore
private VirtualMachine.ForOpenJ9.Dispatcher.ForJnaWindowsEnvironment.AttachmentHandle openSemaphore(java.io.File directory, java.lang.String name, boolean global)
Opens a semaphore for signaling another process that an attachment is performed.- Parameters:
directory- The control directory.name- The semaphore's name.global-trueif the semaphore is in the global namespace.- Returns:
- A handle for signaling an attachment to the target process.
-
-