简体   繁体   English

Android linux环境变量

[英]Android linux environment variables

I was poking around the /proc directory on my android device through adb shell, and looked at the contents of the environ file for one of the processes. 我通过adb shell在我的android设备上的/ proc目录中查看,并查看了其中一个进程的environ文件的内容。 The list of environment variables is as follows: 环境变量列表如下:

  • PATH 路径
  • LD_LIBRARY_PATH LD_LIBRARY_PATH
  • ANDROID_BOOTLOGO ANDROID_BOOTLOGO
  • ANDROID_ROOT ANDROID_ROOT
  • ANDROID_ASSETS ANDROID_ASSETS
  • ANDROID_DATA ANDROID_DATA
  • ANDROID_STORAGE ANDROID_STORAGE
  • ASEC_MOUNTPOINT ASEC_MOUNTPOINT
  • LOOP_MOUNTPOINT LOOP_MOUNTPOINT
  • BOOTCLASSPATH BOOTCLASSPATH
  • EXTERNAL_STORAGE 外置储存
  • EMULATED_STORAGE_SOURCE EMULATED_STORAGE_SOURCE
  • EMULATED_STORAGE_TARGET EMULATED_STORAGE_TARGET
  • ANDROID_PROPERTY_WORKSPACE ANDROID_PROPERTY_WORKSPACE
  • ANDROID_SOCKET_zygote ANDROID_SOCKET_zygote

This is list is different from the environment variables seen in Linux. 这个列表与Linux中看到的环境变量不同。 When I see the environ file of some process on my ubuntu-12.04, I see a list much longer and very different (only PATH is same). 当我在我的ubuntu-12.04上看到某个进程的environ文件时,我看到一个更长且非常不同的列表(只有PATH是相同的)。

I have the following questions: 我有以下问题:

  • where does Android define the environment variables ? Android在哪里定义环境变量?

    Since the environ file in Android is different from that of linux, it must have made a change somewhere 由于Android中的environ文件与linux不同,因此必须在某处进行更改

  • is there a way to provide default values for these variables ? 有没有办法为这些变量提供默认值?

    I presume that init might have the default values and forked processes inherit the values & there is possible modification of values somewhere after forking (if someone knows the actual location of such code, please share) 我假设init可能有默认值,forked进程继承值,并且在分叉后某处可能修改值(如果有人知道这些代码的实际位置,请分享)

  • What is the purpose of each environment variable in list ? 列表中每个环境变量的用途是什么?

    I understand the PATH & LD_LIBRARY_PATH variables, which are derived from linux. 我理解从Linux派生的PATH和LD_LIBRARY_PATH变量。 What about the others ? 其他人怎么样? When are they used ? 他们什么时候用? What would an Android app (possibly NDK) use them for ? Android应用程序(可能是NDK)将它们用于什么?

Thanks. 谢谢。

Android使用的是Linux,但它不是GNU / Linux,因此很多东西都不同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM