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 Object
implements VirtualMachine.ForOpenJ9.Dispatcher
A connector implementation for a Windows environment using JNA.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
A handle for an attachment which is represented by a pair of handles.protected static interface
A 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
FieldsModifier and TypeFieldDescriptionprivate static final String
The name of the creation mutex.A library to use for interacting with Windows.private static final int
Indicates a missing user id what is not supported on Windows. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new connector for a Windows environment using JNA. -
Method Summary
Modifier and TypeMethodDescriptionvoid
chownFileToUser
(File file, long userId) Changes the ownership of a file.void
decrementSemaphore
(File directory, String name, boolean global, int count) Decrements a semaphore.int
getOwnerIdOf
(File file) Returns the user id of the owner of the supplied file.getTemporaryFolder
(String processId) Returns this machine's temporary folder.void
incrementSemaphore
(File directory, String name, boolean global, int count) Increments a semaphore.boolean
isExistingProcess
(int processId) Returnstrue
if the supplied process id is a running process.openSemaphore
(File directory, String name, boolean global) Opens a semaphore for signaling another process that an attachment is performed.int
pid()
Returns the process id of this process.void
setPermissions
(File file, int permissions) Sets permissions for the supplied file.int
userId()
Returns the user id of this process.
-
Field Details
-
NO_USER_ID
private static final int NO_USER_IDIndicates a missing user id what is not supported on Windows.- See Also:
-
CREATION_MUTEX_NAME
The name of the creation mutex.- See Also:
-
library
A library to use for interacting with Windows.
-
-
Constructor Details
-
ForJnaWindowsEnvironment
public ForJnaWindowsEnvironment()Creates a new connector for a Windows environment using JNA.
-
-
Method Details
-
getTemporaryFolder
Returns this machine's temporary folder.- Specified by:
getTemporaryFolder
in 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:
pid
in interfaceVirtualMachine.ForOpenJ9.Dispatcher
- Returns:
- The process id of this process.
-
userId
public int userId()Returns the user id of this process.- Specified by:
userId
in interfaceVirtualMachine.ForOpenJ9.Dispatcher
- Returns:
- The user id of this process
-
isExistingProcess
public boolean isExistingProcess(int processId) Returnstrue
if the supplied process id is a running process.- Specified by:
isExistingProcess
in interfaceVirtualMachine.ForOpenJ9.Dispatcher
- Parameters:
processId
- The process id to evaluate.- Returns:
true
if the supplied process id is currently running.
-
getOwnerIdOf
Returns the user id of the owner of the supplied file.- Specified by:
getOwnerIdOf
in interfaceVirtualMachine.ForOpenJ9.Dispatcher
- Parameters:
file
- The file for which to locate the owner.- Returns:
- The owner id of the supplied file.
-
setPermissions
Sets permissions for the supplied file.- Specified by:
setPermissions
in interfaceVirtualMachine.ForOpenJ9.Dispatcher
- Parameters:
file
- The file for which to set the permissions.permissions
- The permission bits to set.
-
incrementSemaphore
Increments a semaphore.- Specified by:
incrementSemaphore
in interfaceVirtualMachine.ForOpenJ9.Dispatcher
- Parameters:
directory
- The sempahore's control directory.name
- The semaphore's name.global
-true
if the semaphore is in the global namespace (only applicable on Windows).count
- The amount of increments.
-
decrementSemaphore
Decrements a semaphore.- Specified by:
decrementSemaphore
in interfaceVirtualMachine.ForOpenJ9.Dispatcher
- Parameters:
directory
- The sempahore's control directory.name
- The semaphore's name.global
-true
if the semaphore is in the global namespace (only applicable on Windows).count
- The amount of decrements.
-
chownFileToUser
Changes the ownership of a file. Can be called only if this process is owned by root.- Specified by:
chownFileToUser
in 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(File directory, 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
-true
if the semaphore is in the global namespace.- Returns:
- A handle for signaling an attachment to the target process.
-