Skip to content
Add a system call “pstree” in Android OS
C C++ Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Add a system call “pstree” in Android OS


  1. JDK

  1. SDK

  2. NDK

extract into ~/android or /usr/lib/android/

type ndk-build -v to check

  1. android shell

    extract into the usr folder


  1. Modify the environment variables in ~/.bashrc

export PATH=${PATH}:/home/lanouyu/Downloads/android-sdk-linux/tools

export PATH=${PATH}:/home/lanouyu/Downloads/android-sdk-linux/platform-tools

export JAVA_HOME=/usr/lib/jdk1.8.0_73

export JRE_HOME=/usr/lib/jdk1.8.0_73/jre


export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin

export PATH=${PATH}:~/android

export PATH=${PATH}:/home/lanouyu/Downloads/android-ndk-linux/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin 2. Start AVD with the new shell

please install 32-bit lib first:

sudo apt-get install libc6:i386 libgcc1:i386 gcc-4.6-base:i386 libstdc++5:i386 libstdc++6:i386

sudo apt-get install lib32stdc++6

then start it:

~/Downloads/android-sdk-linux/tools/emulator -avd OsPrj-5140309001 -kernel ~/kernel/goldfish/arch/arm/boot/zImage -show-kernel

this process maybe very slow, please wait patiently.

to check AVD status: adb devices

  1. type make in ptree folder, then we get a file ptree.ko, which is our module


  1. upload ptree.ko file to AVD

adb push ptree.ko /data/misc

  1. go to adb shell and install mod

adb shell

cd data/misc

insmod ptree.ko

lsmod (to check)

  1. test cd ../test/jni

ndk-build (The executable file is in test/libs/armeabi)

adb push ../libs/armeabi/ptree /data/misc



You can’t perform that action at this time.