Path: blob/master/src/java.base/unix/native/libjava/ProcessHandleImpl_unix.h
41119 views
/*1* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#include <sys/types.h>2627/*28* Declaration of ProcessHandleImpl functions common on all Unix platforms.29* 'unix_' functions have a single implementation in ProcessHandleImpl_unix.c30* 'os_' prefixed functions have different, os-specific implementations in the31* various ProcessHandleImpl_{linux,macosx,aix}.c files.32* See ProcessHandleImpl_unix.c for more details.33*/3435/* Field id for jString 'command' in java.lang.ProcessHandleImpl.Info */36extern jfieldID ProcessHandleImpl_Info_commandID;3738/* Field id for jString 'commandLine' in java.lang.ProcessHandleImpl.Info */39extern jfieldID ProcessHandleImpl_Info_commandLineID;4041/* Field id for jString[] 'arguments' in java.lang.ProcessHandleImpl.Info */42extern jfieldID ProcessHandleImpl_Info_argumentsID;4344/* Field id for jlong 'totalTime' in java.lang.ProcessHandleImpl.Info */45extern jfieldID ProcessHandleImpl_Info_totalTimeID;4647/* Field id for jlong 'startTime' in java.lang.ProcessHandleImpl.Info */48extern jfieldID ProcessHandleImpl_Info_startTimeID;4950/* Field id for jString 'user' in java.lang.ProcessHandleImpl.Info */51extern jfieldID ProcessHandleImpl_Info_userID;5253/**54* Return: -1 is fail; >= 0 is parent pid55* 'total' will contain the running time of 'pid' in nanoseconds.56* 'start' will contain the start time of 'pid' in milliseconds since epoch.57*/58extern pid_t unix_getParentPidAndTimings(JNIEnv *env, pid_t pid,59jlong *total, jlong *start);60extern pid_t os_getParentPidAndTimings(JNIEnv *env, pid_t pid,61jlong *total, jlong *start);6263extern void unix_getCmdlineAndUserInfo(JNIEnv *env, jobject jinfo, pid_t pid);64extern void os_getCmdlineAndUserInfo(JNIEnv *env, jobject jinfo, pid_t pid);6566extern jint unix_getChildren(JNIEnv *env, jlong jpid, jlongArray array,67jlongArray jparentArray, jlongArray jstimesArray);68extern jint os_getChildren(JNIEnv *env, jlong jpid, jlongArray array,69jlongArray jparentArray, jlongArray jstimesArray);7071extern void unix_getUserInfo(JNIEnv* env, jobject jinfo, uid_t uid);72extern void unix_fillArgArray(JNIEnv *env, jobject jinfo, int nargs, char *cp,73char *argsEnd, jstring cmdexe, char *cmdline);7475extern void os_initNative(JNIEnv *env, jclass clazz);767778