1.System/core/libutils
│ Android.mk
│ BasicHashtable.cpp
│ BlobCache.cpp
│ CallStack.cpp
│ CleanSpec.mk
│ FileMap.cpp
│ JenkinsHash.cpp
│ LinearAllocator.cpp
│ LinearTransform.cpp
│ Log.cpp
│ Looper.cpp
│ misc.cpp
│ MODULE_LICENSE_APACHE2
│ NativeHandle.cpp
│ NOTICE
│ primes.py
│ Printer.cpp
│ ProcessCallStack.cpp
│ PropertyMap.cpp
│ README
│ RefBase.cpp
│ SharedBuffer.cpp
│ Static.cpp
│ StopWatch.cpp
│ String16.cpp
│ String8.cpp
│ SystemClock.cpp
│ Threads.cpp
│ Timers.cpp
│ Tokenizer.cpp
│ Trace.cpp
│ Unicode.cpp
│ VectorImpl.cpp
│
└─tests
Android.mk
BasicHashtable_test.cpp
BitSet_test.cpp
BlobCache_test.cpp
Looper_test.cpp
LruCache_test.cpp
String8_test.cpp
TestHelpers.h
Unicode_test.cpp
Vector_test.cpp
libutils.so
这个库可以分成两个部分,一个部分是底层的工具,另外一个就是实现主要为实现 IPC (进程间通讯)的 Binder 机制。 来自 http://blog.csdn.net/koozxcv/article/details/51728793
5.1的实际目录不同
2.System/core
├─.git
├─adb 【adb相关】
├─adf
│ ├─libadf
│ │ └─include
│ │ └─adf
│ └─libadfhwc
│ └─include
│ └─adfhwc
├─cpio
├─debuggerd
│ ├─arm
│ ├─arm64
│ ├─mips
│ ├─x86
│ └─x86_64
├─fastboot 【fastboot相关】
├─fastbootd
│ ├─commands
│ └─other
│ └─sign
│ └─src
├─fs_mgr
│ └─include
├─gpttool
├─healthd
│ └─images
├─【include】
│ ├─android
│ ├─backtrace
│ ├─ctest
│ ├─cutils
│ ├─diskconfig
│ ├─log
│ ├─memtrack
│ ├─mincrypt
│ ├─nativebridge
│ ├─netutils
│ ├─pixelflinger
│ ├─private
│ │ └─pixelflinger
│ ├─system
│ ├─sysutils
│ ├─usbhost 【usb】
│ ├─utils 【Looper.h】
│ ├─ziparchive
│ └─zipfile
├─init 【init】
├─libbacktrace
├─libcutils
│ ├─arch-arm
│ ├─arch-arm64
│ ├─arch-mips
│ ├─arch-x86
│ ├─arch-x86_64
│ └─tests
├─libdiskconfig
├─libion
│ ├─include
│ │ └─ion
│ ├─kernel-headers
│ │ └─linux
│ ├─original-kernel-headers
│ │ └─linux
│ └─tests
├─liblog
│ └─tests
├─libmemtrack
├─libmincrypt
│ ├─test
│ └─tools
├─libnativebridge
│ └─tests
├─libnetutils 【dhcp相关】
├─libpixelflinger
│ ├─arch-arm64
│ ├─arch-mips
│ ├─codeflinger
│ │ └─tinyutils
│ └─tests
│ ├─arch-arm64
│ │ ├─assembler
│ │ ├─col32cb16blend
│ │ ├─disassembler
│ │ └─t32cb16blend
│ ├─codegen
│ └─gglmul
├─libprocessgroup
│ └─include
│ └─processgroup
├─libsparse
│ └─include
│ └─sparse
├─libsuspend
│ └─include
│ └─suspend
├─libsync
│ ├─include
│ │ └─sync
│ └─tests
├─libsysutils
│ └─src
├─libusbhost
├─libutils
│ └─tests
├─libziparchive
│ └─testdata
├─libzipfile
├─lmkd
├─logcat
│ └─tests
├─logd
│ └─tests
├─logwrapper
│ └─include
│ └─logwrap
├─mkbootimg
├─netcfg
├─reboot
├─rootdir
│ └─etc
├─run-as
├─sdcard
└─toolbox
└─upstream-netbsd
├─bin
│ ├─cat
│ ├─cp
│ ├─dd
│ ├─kill
│ ├─ln
│ ├─mv
│ ├─rm
│ ├─rmdir
│ ├─sleep
│ └─sync
├─include
│ └─sys
├─lib
│ ├─libc
│ │ ├─gen
│ │ ├─stdlib
│ │ └─string
│ └─libutil
├─sbin
│ └─chown
└─usr.bin
├─du
├─grep 【queue.c】
└─printenv
3.\bionic\libc\include
│ alloca.h
│ ar.h
│ assert.h
│ byteswap.h
│ ctype.h
│ dirent.h
│ dlfcn.h
│ elf.h
│ endian.h
│ err.h
│ errno.h
│ fcntl.h
│ features.h
│ fnmatch.h
│ fts.h
│ ftw.h
│ getopt.h
│ grp.h
│ inttypes.h
│ lastlog.h
│ libgen.h
│ limits.h
│ link.h
│ locale.h
│ malloc.h
│ memory.h
│ mntent.h
│ netdb.h
│ nsswitch.h
│ pathconf.h
│ paths.h
│ poll.h
│ pthread.h
│ pwd.h
│ regex.h
│ resolv.h
│ sched.h
│ search.h
│ semaphore.h
│ setjmp.h
│ sgidefs.h
│ sgtty.h
│ signal.h
│ stdatomic.h
│ stdint.h
│ stdio.h
│ stdlib.h
│ string.h
│ strings.h
│ syslog.h
│ termio.h
│ termios.h
│ time.h
│ time64.h
│ uchar.h
│ ucontext.h
│ unistd.h
│ util.h
│ utime.h
│ utmp.h
│ wchar.h
│ wctype.h
│ xlocale.h
│
├─android
│ api-level.h
│ dlext.h
│ set_abort_message.h
│
├─arpa
│ inet.h
│ nameser.h
│ nameser_compat.h
│ telnet.h
│
├─machine
│ ieee.h
│ wchar_limits.h
│
├─net
│ ethernet.h
│ ethertypes.h
│ if.h
│ if_arp.h
│ if_ether.h
│ if_ieee1394.h
│ if_packet.h
│ if_types.h
│ route.h
│
├─netinet
│ ether.h
│ icmp6.h
│ if_ether.h
│ in.h
│ in6.h
│ in_systm.h
│ ip.h
│ ip6.h
│ ip_icmp.h
│ tcp.h
│ udp.h
│
├─netpacket
│ packet.h
│
└─【sys】
auxv.h
cachectl.h
capability.h
cdefs.h
cdefs_elf.h
endian.h
epoll.h
errno.h
eventfd.h
file.h
fsuid.h
glibc-syscalls.h
inotify.h
ioctl.h
ioctl_compat.h
ipc.h
klog.h
limits.h
mman.h
mount.h
msg.h
param.h
personality.h
poll.h
prctl.h
ptrace.h
queue.h 【概述 http://www.cnblogs.com/imlgc/archive/2012/05/02/2479654.html】
reboot.h
reg.h
resource.h
select.h
sem.h
sendfile.h
shm.h
signal.h
signalfd.h
socket.h
socketcalls.h
stat.h
statfs.h
statvfs.h
swap.h
syscall.h
sysconf.h
sysinfo.h
syslimits.h
sysmacros.h
system_properties.h
time.h
timerfd.h
times.h
timex.h
ttychars.h
ttydefaults.h
ttydev.h
types.h
ucontext.h
uio.h
un.h
user.h
utime.h
utsname.h
vfs.h
vt.h
wait.h
xattr.h
_errdefs.h
_sigdefs.h
_system_properties.h
4.hardware\invensense\6515\libsensors_iio
│ Android.mk
│ CompassSensor.AKM.cpp
│ CompassSensor.AKM.h
│ CompassSensor.IIO.9150.cpp
│ CompassSensor.IIO.9150.h
│ CompassSensor.IIO.primary.cpp
│ CompassSensor.IIO.primary.h
│ InputEventReader.cpp
│ InputEventReader.h
│ libmllite.so
│ libmplmpu.so
│ License.txt
│ MPLSensor.cpp
│ MPLSensor.h
│ MPLSupport.cpp
│ MPLSupport.h
│ PressureSensor.IIO.secondary.cpp
│ PressureSensor.IIO.secondary.h
│ SensorBase.cpp
│ SensorBase.h
│ sensors.h
│ sensors_mpl.cpp
│ sensor_params.h
│
└─software
├─build
│ └─android
│ common.mk
│ shared.mk
│
├─core
│ ├─driver
│ │ └─include
│ │ log.h
│ │ mlinclude.h
│ │ mlmath.h
│ │ mlsl.h
│ │ mltypes.h
│ │ stdint_invensense.h
│ │
│ ├─mllite
│ │ │ data_builder.c
│ │ │ data_builder.h
│ │ │ hal_outputs.c
│ │ │ hal_outputs.h
│ │ │ invensense.h
│ │ │ message_layer.c
│ │ │ message_layer.h
│ │ │ ml_math_func.c
│ │ │ ml_math_func.h
│ │ │ mpl.c
│ │ │ mpl.h
│ │ │ results_holder.c
│ │ │ results_holder.h
│ │ │ start_manager.c
│ │ │ start_manager.h
│ │ │ storage_manager.c
│ │ │ storage_manager.h
│ │ │
│ │ ├─build
│ │ │ │ filelist.mk
│ │ │ │
│ │ │ └─android
│ │ │ libmllite.so
│ │ │ shared.mk
│ │ │
│ │ └─linux
│ │ inv_sysfs_utils.c
│ │ inv_sysfs_utils.h
│ │ mlos.h
│ │ mlos_linux.c
│ │ ml_load_dmp.c
│ │ ml_load_dmp.h
│ │ ml_stored_data.c
│ │ ml_stored_data.h
│ │ ml_sysfs_helper.c
│ │ ml_sysfs_helper.h
│ │
│ └─mpl
│ │ accel_auto_cal.h
│ │ authenticate.h
│ │ compass_bias_w_gyro.h
│ │ compass_fit.h
│ │ compass_vec_cal.h
│ │ fast_no_motion.h
│ │ fusion_9axis.h
│ │ gyro_tc.h
│ │ heading_from_gyro.h
│ │ invensense_adv.h
│ │ inv_math.h
│ │ mag_disturb.h
│ │ motion_no_motion.h
│ │ no_gyro_fusion.h
│ │ quaternion_supervisor.h
│ │ quat_accuracy_monitor.h
│ │ shake.h
│ │
│ └─build
│ │ filelist.mk
│ │
│ └─android
│ libmplmpu.so
│ shared.mk
│
└─simple_apps
├─common
│ console_helper.c
│ console_helper.h
│ mlerrorcode.c
│ mlerrorcode.h
│ testsupport.h
│
├─devnode_parser
│ │ iio_utils.h
│ │ read_device_node.c
│ │
│ └─build
│ │ filelist.mk
│ │
│ └─android
│ inv_devnode_parser-shared
│ shared.mk
│
├─gesture_test
│ │ inv_gesture_test.c
│ │
│ └─build
│ │ filelist.mk
│ │
│ └─android
│ inv_gesture_test-shared
│ shared.mk
│
├─mpu_iio
│ │ iio_utils.h
│ │ mpu_iio.c
│ │
│ └─build
│ │ filelist.mk
│ │
│ └─android
│ inv_mpu_iio-shared
│ shared.mk
│
├─playback
│ └─linux
│ │ and_constructor.c
│ │ and_constructor.h
│ │ datalogger_outputs.c
│ │ datalogger_outputs.h
│ │ main.c
│ │
│ └─build
│ │ filelist.mk
│ │
│ └─android
│ inv_playback-shared
│ shared.mk
│
├─self_test
│ │ inv_self_test.c
│ │
│ └─build
│ │ filelist.mk
│ │
│ └─android
│ inv_self_test-shared
│ shared.mk
│
└─stress_iio
│ iio_utils.h
│ README
│ stress_iio.c
│
└─build
│ filelist.mk
│
└─android
shared.mk
Sensors_mpl.cpp中使用了
5.\system\core\toolbox\upstream-netbsd\usr.bin\grep
fastgrep.c
file.c
grep.c
grep.h
queue.c
util.c
Queue.c
引用#include < sys/queue.h> 封装了
单链尾队列(singled-linked tail queue)
来自 http://www.cnblogs.com/imlgc/archive/2012/05/02/2479654.html
Grep.h声明grep_malloc()方法,grep.c中使用,定义却在util.c中
/*
* Safe malloc() for internal use.
*/
void *
grep_malloc(size_t size)
{
void *ptr;
if ((ptr = malloc(size)) == NULL)
err(2, "malloc");
return (ptr);
}
Grep.h定义struct str结构体
struct file {
int fd;
bool binary;
};
struct str {
off_t off;
size_t len;
char *dat;
char *file;
int line_no;
};
Util.c中定义输出方法
void
printline(struct str *line, int sep, regmatch_t *matches, int m)