IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
IKVM.Java.Externs.java.lang.UNIXProcess Class Reference

Static Public Member Functions

static unsafe void init ()
 Implements the native method 'init'.
 

Detailed Description

Definition at line 12 of file UNIXProcess.cs.

Member Function Documentation

◆ init()

static unsafe void IKVM.Java.Externs.java.lang.UNIXProcess.init ( )
static

Implements the native method 'init'.

We save and load the old SIGCHLD handler between calls to prevent Java from overwriting the .NET handler. This isn't thread safe but should suffice since it's limited to static initialization.

Returns

Definition at line 35 of file UNIXProcess.cs.

36 {
37#if FIRST_PASS
38 throw new NotImplementedException();
39#else
40 if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
41 return;
42
43 // get size of sigaction structure and allocate space
44 var size = LibIkvm.Instance.sig_get_size_sigaction();
45 Debug.Assert(size > 0);
46 var save = stackalloc byte[size];
47
48 // save old SIGCHLD structure
49 if (LibIkvm.Instance.sig_get_chld_action(save) != 0)
50 throw new InternalException("Could not save SIGCHLD handler.");
51
52 try
53 {
54 __callerID ??= global::ikvm.@internal.CallerID.create(UNIXProcessAccessor.Type.TypeHandle);
55 __jniPtr__init ??= Marshal.GetDelegateForFunctionPointer<__jniDelegate__init>(JNIFrame.GetFuncPtr(__callerID, "java/lang/UNIXProcess", nameof(init), "()V"));
56 var jniFrm = new JNIFrame();
57 var jniEnv = jniFrm.Enter(__callerID);
58 try
59 {
60 __jniPtr__init(jniEnv, jniFrm.MakeLocalRef(typeof(ClassLiteral<>).MakeGenericType(UNIXProcessAccessor.Type)));
61 }
62 catch (Exception ex)
63 {
64 global::System.Console.WriteLine("*** exception in native code ***");
65 global::System.Console.WriteLine(ex);
66 throw;
67 }
68 finally
69 {
70 jniFrm.Leave();
71 }
72 }
73 finally
74 {
75 // restore old SIGCHLD structure
76 if (LibIkvm.Instance.sig_set_chld_action(save) != 0)
77 throw new InternalException("Could not restore SIGCHLD handler.");
78 }
79#endif
80 }
static unsafe void init()
Implements the native method 'init'.
Provides a static cache of java.lang.Class instances per .NET type.
Represents an internal error that occurred within IKVM.
static nint GetFuncPtr(object callerID, string clazz, string name, string sig)
Invoked by managed code to acquire a function pointer to a native JNI method.
Definition JNIFrame.cs:43

The documentation for this class was generated from the following file: