Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/jcl/common/extendedosmbean.c
6000 views
1
/*******************************************************************************
2
* Copyright (c) 1998, 2019 IBM Corp. and others
3
*
4
* This program and the accompanying materials are made available under
5
* the terms of the Eclipse Public License 2.0 which accompanies this
6
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7
* or the Apache License, Version 2.0 which accompanies this distribution and
8
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9
*
10
* This Source Code may also be made available under the following
11
* Secondary Licenses when the conditions for such availability set
12
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13
* General Public License, version 2 with the GNU Classpath
14
* Exception [1] and GNU General Public License, version 2 with the
15
* OpenJDK Assembly Exception [2].
16
*
17
* [1] https://www.gnu.org/software/classpath/license.html
18
* [2] http://openjdk.java.net/legal/assembly-exception.html
19
*
20
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
21
*******************************************************************************/
22
23
#include <assert.h>
24
25
#include "j9.h"
26
#include "j9port.h"
27
#include "jclglob.h"
28
#include "jclprots.h"
29
#include "jni.h"
30
#include "portnls.h"
31
32
#define MESSAGE_STRING_LENGTH 256
33
34
/**
35
* Function returns the Class ID of ProcessorUsage and method ID of the named methods. This is
36
* a common code that routines dealing with ProcessorUsage class need. Internally, the function
37
* resolves the IDs only the first time and caches them up. Every next time, the cached values
38
* are returned, provided that the resolution (up on the first call) was successful.
39
*
40
* @param[in] env The JNI env.
41
* @param[out] ProcessorUsage A pointer to the class ProcessorUsage's ID.
42
* @param[out] ProcessorUsageCtor A pointer to ProcessorUsage's default constructor.
43
* @param[out] UpdateValues A pointer to ProcessorUsage's updateValues() constructor.
44
*
45
* @return 0, on success; -1, on failure.
46
*/
47
static I_32
48
resolveProcessorUsageIDs(JNIEnv *env,
49
jclass *ProcessorUsage,
50
jmethodID *ProcessorUsageCtor,
51
jmethodID *UpdateValues)
52
{
53
/* Check whether the class ID and the method IDs have already been cached or not. */
54
if (NULL == JCL_CACHE_GET(env, MID_com_ibm_lang_management_ProcessorUsage_init)) {
55
jclass localProcUsageRef = NULL;
56
57
/* Get the class ID for the Java class ProcessorUsage. */
58
localProcUsageRef = (*env)->FindClass(env, "com/ibm/lang/management/ProcessorUsage");
59
if (NULL == localProcUsageRef) {
60
return -1;
61
}
62
63
/* Convert this into a Global reference. */
64
*ProcessorUsage = (*env)->NewGlobalRef(env, localProcUsageRef);
65
66
/* Delete the local reference. */
67
(*env)->DeleteLocalRef(env, localProcUsageRef);
68
if (NULL == ProcessorUsage) {
69
return -1;
70
}
71
72
/* Cache the thus resolved global class ID for ProcessorUsage class. */
73
JCL_CACHE_SET(env, CLS_com_ibm_lang_management_ProcessorUsage, *ProcessorUsage);
74
75
/* Obtain the method ID for ProcessorUsage's updateValues() method. */
76
*UpdateValues = (*env)->GetMethodID(env, *ProcessorUsage, "updateValues", "(JJJJJIIJ)V" );
77
if (NULL == *UpdateValues) {
78
return -1;
79
}
80
81
/* Save the method ID for updateValues() into the cache. */
82
JCL_CACHE_SET(env, MID_com_ibm_lang_management_ProcessorUsage_updateValues, *UpdateValues);
83
84
/* Find the default constructor's method ID. */
85
*ProcessorUsageCtor = (*env)->GetMethodID(env, *ProcessorUsage, "<init>", "()V");
86
if (NULL == *ProcessorUsageCtor) {
87
return -1;
88
}
89
90
/* Save this method ID for constructor into the cache. */
91
JCL_CACHE_SET(env, MID_com_ibm_lang_management_ProcessorUsage_init, *ProcessorUsageCtor);
92
} else {
93
/* Turns out that these have already been resolved and cached in a prior call. Return these. */
94
*ProcessorUsage = JCL_CACHE_GET(env, CLS_com_ibm_lang_management_ProcessorUsage);
95
*ProcessorUsageCtor = JCL_CACHE_GET(env, MID_com_ibm_lang_management_ProcessorUsage_init);
96
*UpdateValues = JCL_CACHE_GET(env, MID_com_ibm_lang_management_ProcessorUsage_updateValues);
97
}
98
99
return 0;
100
}
101
102
static const struct { char *name; } objType[] = {
103
{ "Processor Usage" },
104
{ "Memory Usage" },
105
};
106
107
typedef enum {
108
PROCESSOR_USAGE_ERROR = 0,
109
MEMORY_USAGE_ERROR
110
} objTypes;
111
112
/**
113
* @internal Throw appropriate exception based on the error code passed
114
*
115
* @param error Error code from port library
116
* @param type Error when retrieving either GUEST_PROCESSOR or GUEST_MEMORY statistics
117
*
118
* @return Always returns 0
119
*/
120
static jint
121
handle_error(JNIEnv *env, IDATA error, jint type)
122
{
123
PORT_ACCESS_FROM_ENV(env);
124
jclass exceptionClass = NULL;
125
const char *formatString = NULL;
126
char exceptionMessage[MESSAGE_STRING_LENGTH] = {0};
127
128
assert((type == PROCESSOR_USAGE_ERROR || type == MEMORY_USAGE_ERROR));
129
130
/* If out of memory setup a pending OutOfMemoryError */
131
if (J9PORT_ERROR_SYSINFO_MEMORY_ALLOC_FAILED == error) {
132
((J9VMThread *)env)->javaVM->internalVMFunctions->throwNativeOOMError(env, J9NLS_PORT_SYSINFO_OUT_OF_MEMORY_ERROR_MSG);
133
return 0;
134
}
135
136
/* Read in the generic usage retrieval error string */
137
formatString = j9nls_lookup_message(J9NLS_DO_NOT_PRINT_MESSAGE_TAG | J9NLS_DO_NOT_APPEND_NEWLINE,
138
J9NLS_PORT_SYSINFO_USAGE_RETRIEVAL_ERROR_MSG,
139
NULL);
140
/* Add in the specific error and the type. */
141
j9str_printf(PORTLIB,
142
exceptionMessage,
143
sizeof(exceptionMessage),
144
(char *)formatString,
145
error,
146
objType[type].name);
147
148
if (PROCESSOR_USAGE_ERROR == type) {
149
exceptionClass = (*env)->FindClass(env, "com/ibm/lang/management/ProcessorUsageRetrievalException");
150
} else if (MEMORY_USAGE_ERROR == type) {
151
exceptionClass = (*env)->FindClass(env, "com/ibm/lang/management/MemoryUsageRetrievalException");
152
}
153
if (NULL != exceptionClass) {
154
(*env)->ThrowNew(env, exceptionClass, exceptionMessage);
155
}
156
157
return 0;
158
}
159
160
/**
161
* Function obtains Processor usage statistics by invoking an appropriate port library routine.
162
* It also sets up a pending exception should processor usage retrieval fail.
163
*
164
* @param[in] env The JNI env.
165
* @param[out] procInfo Pointer to a J9ProcessorInfos instance to be populated with usage stats.
166
*
167
* @return 0, on success; -1, on failure.
168
*/
169
static IDATA
170
getProcessorUsage(JNIEnv *env, J9ProcessorInfos *procInfo)
171
{
172
IDATA rc = 0;
173
/* Need port library access for calling j9sysinfo_get_processor_info(). */
174
PORT_ACCESS_FROM_ENV(env);
175
176
/* Retrieve processor usage stats - overall as well as individual for each online processor. */
177
rc = j9sysinfo_get_processor_info(procInfo);
178
if (0 != rc) {
179
handle_error(env, rc, PROCESSOR_USAGE_ERROR);
180
return -1;
181
}
182
183
return 0;
184
}
185
186
/**
187
* Retrieves the system-wide (total) usage statistics for online processors on the underlying machine.
188
*
189
* Class: com_ibm_lang_management_internal_ExtendedOperatingSystemMXBeanImpl
190
* Method: getTotalProcessorUsageImpl
191
*
192
* @param[in] env The JNI env.
193
* @param[in] instance The this pointer.
194
* @param[in] procTotalObject An object of kind ProcessorUsage that will be populated with aggregates
195
* of all online processors usage times.
196
*
197
* @return A ProcessorUsage object, if processor usage data retrieval successful. NULL for failure
198
* conditions.
199
*/
200
jobject JNICALL
201
Java_com_ibm_lang_management_internal_ExtendedOperatingSystemMXBeanImpl_getTotalProcessorUsageImpl(JNIEnv *env,
202
jobject instance,
203
jobject procTotalObject)
204
{
205
IDATA rc = 0;
206
J9ProcessorInfos procInfo = {0};
207
jclass CID_ProcessorUsage = NULL;
208
jmethodID MID_updateValues = NULL;
209
jmethodID MID_ProcessorUsageCtor = NULL;
210
211
PORT_ACCESS_FROM_ENV(env);
212
213
/* Resolve the class ID for the Java class ProcessorUsage and the method IDs for its default
214
* constructor and the updateValues() method.
215
*/
216
rc = resolveProcessorUsageIDs(env, &CID_ProcessorUsage, &MID_ProcessorUsageCtor, &MID_updateValues);
217
if (0 != rc) {
218
/* If a resolution failed, there is a pending exception here. */
219
return NULL;
220
}
221
222
/* Now obtain the processor usage statistics on the underlying platform. */
223
rc = getProcessorUsage(env, &procInfo);
224
if (0 != rc) {
225
/* If processor usage statistics retrieval failed for some reason, there is already a
226
* pending exception. Returning a NULL anyway.
227
*/
228
return NULL;
229
}
230
231
/* Invoke updateValues() method on the ProcessorUsage object initializing the instance fields. */
232
(*env)->CallVoidMethod(env,
233
procTotalObject,
234
MID_updateValues,
235
(jlong)procInfo.procInfoArray[0].userTime,
236
(jlong)procInfo.procInfoArray[0].systemTime,
237
(jlong)procInfo.procInfoArray[0].idleTime,
238
(jlong)procInfo.procInfoArray[0].waitTime,
239
(jlong)procInfo.procInfoArray[0].busyTime,
240
((jint) -1),
241
(jint)procInfo.procInfoArray[0].online,
242
(jlong)procInfo.timestamp);
243
244
/* Clean up the local arrays. */
245
j9sysinfo_destroy_processor_info(&procInfo);
246
247
return procTotalObject;
248
}
249
250
/**
251
* Retrieves the system-wide usage statistics for online processors on the underlying machine.
252
*
253
* Class: com_ibm_lang_management_internal_ExtendedOperatingSystemMXBeanImpl
254
* Method: getProcessorUsageImpl
255
*
256
* @param[in] env The JNI env.
257
* @param[in] instance The this pointer.
258
* @param[in] procUsageArray An array of objects of kind ProcessorUsage.
259
*
260
* @return An array of ProcessorUsage objects, if processor usage data retrieval successful. NULL for
261
* failure conditions.
262
*/
263
jobjectArray JNICALL
264
Java_com_ibm_lang_management_internal_ExtendedOperatingSystemMXBeanImpl_getProcessorUsageImpl(JNIEnv *env,
265
jobject instance,
266
jobjectArray procUsageArray)
267
{
268
I_32 i = 0;
269
IDATA rc = 0;
270
J9ProcessorInfos procInfo = {0};
271
jobject procUsageObject = NULL;
272
jclass CID_ProcessorUsage = NULL;
273
jmethodID MID_ProcessorUsageCtor = NULL;
274
jmethodID MID_updateValues = NULL;
275
276
PORT_ACCESS_FROM_ENV(env);
277
278
/* Resolve the class ID for the Java class ProcessorUsage and the method IDs for its default
279
* constructor and the updateValues() method.
280
*/
281
rc = resolveProcessorUsageIDs(env, &CID_ProcessorUsage, &MID_ProcessorUsageCtor, &MID_updateValues);
282
if (0 != rc) {
283
/* If a resolution failed, there is a pending exception here. */
284
return NULL;
285
}
286
287
/* Now obtain the processor usage statistics on the underlying platform. */
288
rc = getProcessorUsage(env, &procInfo);
289
if (0 != rc) {
290
/* If processor usage statistics retrieval failed for some reason, there is already a
291
* pending exception. Returning a NULL anyway.
292
*/
293
return NULL;
294
}
295
296
/* Did we receive a NULL array? If yes, allocate space to hold an array of suitable length. */
297
if (NULL == procUsageArray) {
298
jobject procObject;
299
300
procUsageArray = (*env)->NewObjectArray(env,
301
(jsize)procInfo.totalProcessorCount,
302
CID_ProcessorUsage,
303
NULL);
304
if (NULL == procUsageArray) {
305
/* Array creation failed. There is a pending OutOfMemoryError that will be
306
* thrown when we return to the Java layer. Here, we simply clean up and return.
307
*/
308
j9sysinfo_destroy_processor_info(&procInfo);
309
return NULL;
310
}
311
312
/* Allocate memory for all the processors and fill in the array using these objects. */
313
for (i = 0; i < procInfo.totalProcessorCount; i++) {
314
procObject = (*env)->NewObject(env, CID_ProcessorUsage, MID_ProcessorUsageCtor);
315
if (NULL == procObject) {
316
/* If allocation failed there is a pending exception here. */
317
j9sysinfo_destroy_processor_info(&procInfo);
318
return NULL;
319
}
320
(*env)->SetObjectArrayElement(env, procUsageArray, (jsize)i, procObject);
321
}
322
} else if ((*env)->GetArrayLength(env, procUsageArray) < procInfo.totalProcessorCount) {
323
324
/* Array provided has insufficient entries as there are more CPUs to report on. */
325
throwNewIllegalArgumentException(env, "Insufficient sized processor array received");
326
327
/* Cleanup before returning - we have already set up an exception to be thrown. */
328
j9sysinfo_destroy_processor_info(&procInfo);
329
return NULL;
330
}
331
332
/* Initialize the jobjectArray procUsageArray with the processor usage data as retrieved
333
* through by j9sysinfo_get_processor_info().
334
*/
335
for (i = 1; i <= procInfo.totalProcessorCount; i++) {
336
procUsageObject = (*env)->GetObjectArrayElement(env, procUsageArray, i - 1);
337
338
/* Invoke updateValues() method on each ProcessorUsage object in the array to initialize
339
* the fields in that instance.
340
*/
341
(*env)->CallVoidMethod(env,
342
procUsageObject,
343
MID_updateValues,
344
(jlong)procInfo.procInfoArray[i].userTime,
345
(jlong)procInfo.procInfoArray[i].systemTime,
346
(jlong)procInfo.procInfoArray[i].idleTime,
347
(jlong)procInfo.procInfoArray[i].waitTime,
348
(jlong)procInfo.procInfoArray[i].busyTime,
349
(jint)procInfo.procInfoArray[i].proc_id,
350
(jint)procInfo.procInfoArray[i].online,
351
(jlong)procInfo.timestamp);
352
} /* end for(;;) */
353
354
/* Clean up the local array. */
355
j9sysinfo_destroy_processor_info(&procInfo);
356
357
return procUsageArray;
358
}
359
360
/**
361
* Retrieves system-wide memory statistics for the underlying machine.
362
*
363
* Class: com_ibm_lang_management_internal_ExtendedOperatingSystemMXBeanImpl
364
* Method: getMemoryUsageImpl
365
*
366
* @param[in] env The JNI env.
367
* @param[in] instance The this pointer.
368
* @param[in] memUsageObject An object of type MemoryUsage
369
*
370
* @return A MemoryUsage object, if memory stats usage retrieval successful. NULL, in case of a failure.
371
*/
372
jobject JNICALL
373
Java_com_ibm_lang_management_internal_ExtendedOperatingSystemMXBeanImpl_getMemoryUsageImpl(JNIEnv *env,
374
jobject instance,
375
jobject memUsageObject)
376
{
377
IDATA rc = 0;
378
J9MemoryInfo memInfo = {0};
379
jclass CID_MemoryUsage = NULL;
380
jmethodID MID_updateValues = NULL;
381
382
PORT_ACCESS_FROM_ENV(env);
383
384
/* Check whether MemoryUsage class has already been resolved and cached. If not, do so now.*/
385
if (NULL == JCL_CACHE_GET(env, MID_com_ibm_lang_management_MemoryUsage_updateValues)) {
386
jclass localMemoryUsageRef;
387
388
/* Find the class ID for the Java class MemoryUsage and cache.*/
389
localMemoryUsageRef = (*env)->GetObjectClass(env, memUsageObject);
390
391
/* Convert this into a Global reference. */
392
CID_MemoryUsage = (*env)->NewGlobalRef(env, localMemoryUsageRef);
393
394
/* Delete the local reference. */
395
(*env)->DeleteLocalRef(env, localMemoryUsageRef);
396
if (NULL == CID_MemoryUsage) {
397
return NULL;
398
}
399
400
/* Cache the resolved global class ID for MemoryUsage class. */
401
JCL_CACHE_SET(env, CLS_com_ibm_lang_management_MemoryUsage, CID_MemoryUsage);
402
403
/* Also, cache the method ID for updateValues() method. */
404
MID_updateValues = (*env)->GetMethodID(env, CID_MemoryUsage, "updateValues", "(JJJJJJJ)V");
405
if (NULL == MID_updateValues) {
406
return NULL;
407
}
408
JCL_CACHE_SET(env, MID_com_ibm_lang_management_MemoryUsage_updateValues, MID_updateValues);
409
} else {
410
MID_updateValues = JCL_CACHE_GET(env, MID_com_ibm_lang_management_MemoryUsage_updateValues);
411
}
412
413
/* Call port library routine to collect memory usage statistics on current system. */
414
rc = j9sysinfo_get_memory_info(&memInfo);
415
if (0 != rc) {
416
handle_error(env, rc, MEMORY_USAGE_ERROR);
417
return NULL;
418
}
419
420
/* Invoke the updateValues() method on the MemoryUsage object so as to initialize the fields
421
* in that instance with the values obtained from j9sysinfo_get_memory_info().
422
*/
423
(*env)->CallVoidMethod(env,
424
memUsageObject,
425
MID_updateValues,
426
(jlong)memInfo.totalPhysical,
427
(jlong)memInfo.availPhysical,
428
(jlong)memInfo.totalSwap,
429
(jlong)memInfo.availSwap,
430
(jlong)memInfo.cached,
431
(jlong)memInfo.buffered,
432
(jlong)memInfo.timestamp);
433
434
return memUsageObject;
435
}
436
437
/**
438
* Retrieves the configured number of processors on the current machine.
439
* [UNUSED] Currently there is no native function in the Java class
440
* com.ibm.lang.management.internal.ExtendedOperatingSystem
441
* by the name of getProcessorCountImpl() as this is not required or used
442
* (most of the time we use online CPU count, than physical CPU count).
443
* However, we let this be around and add a Java native only when needed.
444
*
445
* Class: com_ibm_lang_management_internal_ExtendedOperatingSystemMXBeanImpl
446
* Method: getProcessorCountImpl
447
*
448
* @param[in] env The JNI env.
449
* @param[in] instance The this pointer.
450
*
451
* @return processor count; if not available on current platform, -1 is returned.
452
*/
453
jint JNICALL
454
Java_com_ibm_lang_management_internal_ExtendedOperatingSystemMXBeanImpl_getProcessorCountImpl(JNIEnv *env, jobject instance)
455
{
456
PORT_ACCESS_FROM_ENV(env);
457
jint result = (jint)j9sysinfo_get_number_CPUs_by_type(J9PORT_CPU_PHYSICAL);
458
if (0 == result) {
459
result = -1;
460
}
461
return result;
462
}
463
464
/**
465
* @brief Call j9sysinfo_get_number_CPUs_by_type to get the instantaneous online CPU count.
466
* Class: com_ibm_lang_management_internal_ExtendedOperatingSystemMXBeanImpl
467
* Method: getOnlineProcessorsImpl
468
*
469
* @param[in] env The JNI env.
470
* @param[in] instance The this pointer.
471
* @return Online CPU count.
472
*/
473
jint JNICALL
474
Java_com_ibm_lang_management_internal_ExtendedOperatingSystemMXBeanImpl_getOnlineProcessorsImpl(JNIEnv *env, jobject instance)
475
{
476
jint onlineCPUs = 0;
477
PORT_ACCESS_FROM_ENV(env);
478
479
onlineCPUs = (jint) j9sysinfo_get_number_CPUs_by_type(J9PORT_CPU_ONLINE);
480
481
/* If the port-library failed determining the online CPU count, return 1 as the minimum CPU count. */
482
return (0 != onlineCPUs) ? onlineCPUs : 1;
483
}
484
485
/**
486
* Retrieve hardware model
487
*
488
* @param env The JNI env.
489
* @param obj bean instance.
490
*
491
* @return String containing the hardware model. NULL in case of an error.
492
* @throws UnsupportedOperationException if the operation is not implemented on this platform.
493
* UnsupportedOperationException will also be thrown if the operation is implemented but it
494
* cannot be performed because the system does not satisfy all the requirements, for example,
495
* an OS service is not installed.
496
*/
497
jstring JNICALL
498
Java_com_ibm_lang_management_internal_ExtendedOperatingSystemMXBeanImpl_getHardwareModelImpl(JNIEnv *env, jobject obj)
499
{
500
const char * str = NULL;
501
I_32 rc = 0;
502
char buf[J9PORT_SYSINFO_HW_INFO_MODEL_BUF_LENGTH];
503
PORT_ACCESS_FROM_ENV(env);
504
505
rc = j9sysinfo_get_hw_info(J9PORT_SYSINFO_GET_HW_INFO_MODEL, buf, sizeof(buf));
506
507
switch (rc) {
508
case J9PORT_SYSINFO_GET_HW_INFO_SUCCESS:
509
str = buf;
510
break;
511
case J9PORT_SYSINFO_GET_HW_INFO_NOT_AVAILABLE:
512
throwNewUnsupportedOperationException(env);
513
break;
514
default:
515
break;
516
}
517
518
return (NULL == str) ? NULL : (*env)->NewStringUTF(env, str);
519
}
520
521
/**
522
* Returns the maximum number of file descriptors that can be opened in a process.
523
*
524
* Class: com_ibm_lang_management_internal_UnixExtendedOperatingSystem
525
* Method: getMaxFileDescriptorCountImpl
526
*
527
* @param[in] env The JNI env.
528
* @param[in] theClass The bean class.
529
*
530
* @return The maximum number of file descriptors that can be opened in a process;
531
* -1 on failure. If this is set to unlimited on the OS, simply return the signed
532
* integer (long long) limit.
533
*/
534
jlong JNICALL
535
Java_com_ibm_lang_management_internal_UnixExtendedOperatingSystem_getMaxFileDescriptorCountImpl(JNIEnv *env, jclass theClass)
536
{
537
U_32 rc = 0;
538
U_64 limit = 0;
539
PORT_ACCESS_FROM_ENV(env);
540
rc = j9sysinfo_get_limit(OMRPORT_RESOURCE_FILE_DESCRIPTORS, &limit);
541
if (OMRPORT_LIMIT_UNKNOWN == rc) { /* The port library failed! */
542
limit = ((U_64) -1);
543
} else if (OMRPORT_LIMIT_UNLIMITED == rc) { /* No limit set (i.e., "unlimited"). */
544
limit = ((U_64) LLONG_MAX);
545
}
546
return ((jlong) limit);
547
}
548
549
/**
550
* Returns the current number of file descriptors that are in opened state.
551
*
552
* Class: com_ibm_lang_management_internal_UnixExtendedOperatingSystem
553
* Method: getOpenFileDescriptorCountImpl
554
*
555
* @param[in] env The JNI env.
556
* @param[in] theClass The bean class.
557
*
558
* @return The current number of file descriptors that are in opened state;
559
* -1 on failure.
560
*/
561
jlong JNICALL
562
Java_com_ibm_lang_management_internal_UnixExtendedOperatingSystem_getOpenFileDescriptorCountImpl(JNIEnv *env, jclass theClass)
563
{
564
I_32 ret = 0;
565
U_64 count = 0;
566
PORT_ACCESS_FROM_ENV(env);
567
ret = j9sysinfo_get_open_file_count(&count);
568
/* Check if an error occurred while obtaining the open file count. */
569
if (ret < 0) {
570
count = ((U_64) -1);
571
}
572
return ((jlong) count);
573
}
574
575