hi,

I notice that the zygote process name change to "main" Lollipop , but in
KitKat and before, the zygote process name is "zygote".

in Lollipop:

$ adb shell ps | grep -i zygote

root      376   1     1492064 67316 ffffffff 00000000 S zygote



$ adb shell cat /proc/376/stat

376 (main) R 1 376 0 0 -1 4194560 170602 262860 825 248 283 137 226 174 20
0 1 0 637 1522405376 16861 4294967295 1 1 0 0 0 0 4612 0 103672 4294967295
0 0 17 3 0 0 0 0 0 0 0 0



$ adb shell cat /proc/376/comm

main


in KitKat:

$ adb shell ps | grep -i zygote

root      329   1     867640 64860 ffffffff 00000000 S zygote



$ adb shell cat /proc/329/stat

329 (zygote) S 1 329 0 0 -1 1077936384 106227 3303200 682 1688 618 798
27926 9112 20 0 4 0 1254 888463360 16215 4294967295 1 1 0 0 0 0 4612 0
103672 4294967295 0 0 17 0 0 0 0 0 0 0 0 0



$ adb shell cat /proc/329/comm

zygote


In app_main.cpp when start zygote, it will set nicename, and set the
process name with niceName.


frameworks/base/cmds/app_process/app_main.cpp


int main(int argc, char* const argv[])

...

        if (strcmp(arg, "--zygote") == 0) {

            zygote = true;

            niceName = ZYGOTE_NICE_NAME;

...

    if (!niceName.isEmpty()) {

        runtime.setArgv0(niceName.string());

        set_process_name(niceName.string());

    }


but in new AndroidRuntime ART, the will change the name "zygote" to "main"

    if (zygote) {

        runtime.start("com.android.internal.os.ZygoteInit", args);


#0  0xb6f0116c in prctl  /system/lib/libc.so

    bionic/libc/arch-arm/syscalls/prctl.S:16

#1  0xb6edda48 in pthread_setname_np+0x0040(+64)  /system/lib/libc.so

    bionic/libc/bionic/pthread_setname_np.cpp:56

      t (long int) = -1225441592(0xb6f53ec8)

      thread_name (char *) = 0xbedc94a4 "main" [@ENTRY=0xbedc94a4 "main"]

#2  0xb4f479ae in art::SetThreadName+0x006e(+110)  /system/lib/libart.so

    art/runtime/utils.cc:1010

      thread_name (char *) = 0xb4fd9904 "main" [@ENTRY=0xb4fd9904 "main"]

      buf (char [16]) =  "main"

#3  0xb4f31f7a in art::Thread::Attach+0x00b2(+178)  /system/lib/libart.so

    art/runtime/thread.cc:409

      thread_name (char *) = 0xb4fd9904 "main"

#4  0xb4f20204 in art::Runtime::Init+0x0338(+824)  /system/lib/libart.so

    art/runtime/runtime.cc:788

#5  0xb4f21dde in art::Runtime::Create+0x0032(+50)  /system/lib/libart.so

    art/runtime/runtime.cc:335

#6  0xb4ed99d2 in JNI_CreateJavaVM+0x01b2(+434)  /system/lib/libart.so

    art/runtime/jni_internal.cc:3026

#7  0xb6e19266 in android::AndroidRuntime::startVm+0x0882(+2178)
 /system/lib/libandroid_runtime.so

    frameworks/base/core/jni/AndroidRuntime.cpp:887

#8  0xb6e19892 in android::AndroidRuntime::start+0x00fe(+254)
 /system/lib/libandroid_runtime.so

    frameworks/base/core/jni/AndroidRuntime.cpp:967

      this (AndroidRuntime *) = 0xbedca858

      className (char *) = 0xb6f56f50 "com.android.internal.os.ZygoteInit"

#9  0xb6f56658 in main+0x02ec(+748)  /system/bin/app_process32

    frameworks/base/cmds/app_process/app_main.cpp:309

      niceName (String8) = {

        mString (char *) = 0xb5018418 "zygote"}


So the zygote process name is set "zygote" first, then change to "main" in
Lollipop, Is it a bug?


Thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to