Ejemplo n.º 1
0
 /**
  * Returns the thread group leader id for a currently running thread.
  *
  * @param tid the thread id
  * @return the thread group leader id of the thread, or -1 if the thread is not running. This is
  *     same as what getpid(2) would return if called by tid.
  * @hide
  */
 public static final int getThreadGroupLeader(int tid) {
   String[] procStatusLabels = {"Tgid:"};
   long[] procStatusValues = new long[1];
   procStatusValues[0] = -1;
   Process.readProcLines("/proc/" + tid + "/status", procStatusLabels, procStatusValues);
   return (int) procStatusValues[0];
 }
Ejemplo n.º 2
0
 /**
  * Returns the parent process id for a currently running process.
  *
  * @param pid the process id
  * @return the parent process id of the process, or -1 if the process is not running.
  * @hide
  */
 public static final int getParentPid(int pid) {
   String[] procStatusLabels = {"PPid:"};
   long[] procStatusValues = new long[1];
   procStatusValues[0] = -1;
   Process.readProcLines("/proc/" + pid + "/status", procStatusLabels, procStatusValues);
   return (int) procStatusValues[0];
 }