├── .gitignore ├── Android.mk ├── CleanSpec.mk ├── README ├── ThirdPartyProject.prop ├── adb ├── Android.mk ├── MODULE_LICENSE_APACHE2 ├── NOTICE ├── OVERVIEW.TXT ├── SERVICES.TXT ├── adb.c ├── adb.h ├── adb_auth.h ├── adb_auth_client.c ├── adb_auth_host.c ├── adb_client.c ├── adb_client.h ├── backup_service.c ├── commandline.c ├── console.c ├── fdevent.c ├── fdevent.h ├── file_sync_client.c ├── file_sync_service.c ├── file_sync_service.h ├── framebuffer_service.c ├── get_my_path_darwin.c ├── get_my_path_freebsd.c ├── get_my_path_linux.c ├── get_my_path_windows.c ├── jdwp_service.c ├── log_service.c ├── mutex_list.h ├── protocol.txt ├── remount_service.c ├── services.c ├── sockets.c ├── sockets.dia ├── sysdeps.h ├── sysdeps_win32.c ├── test_track_devices.c ├── test_track_jdwp.c ├── transport.c ├── transport.h ├── transport_local.c ├── transport_usb.c ├── usb_libusb.c ├── usb_linux.c ├── usb_linux_client.c ├── usb_osx.c ├── usb_vendors.c ├── usb_vendors.h ├── usb_windows.c ├── utils.c └── utils.h ├── charger ├── Android.mk ├── charger.c └── images │ ├── battery_0.png │ ├── battery_1.png │ ├── battery_2.png │ ├── battery_3.png │ ├── battery_4.png │ ├── battery_5.png │ ├── battery_charge.png │ └── battery_fail.png ├── cpio ├── Android.mk └── mkbootfs.c ├── debuggerd ├── Android.mk ├── MODULE_LICENSE_APACHE2 ├── NOTICE ├── arm │ ├── crashglue.S │ └── machine.c ├── backtrace.c ├── backtrace.h ├── crasher.c ├── debuggerd.c ├── getevent.c ├── getevent.h ├── machine.h ├── mips │ ├── crashglue.S │ └── machine.c ├── tombstone.c ├── tombstone.h ├── utility.c ├── utility.h ├── vfp-crasher.c ├── vfp.S └── x86 │ ├── crashglue.S │ └── machine.c ├── fastboot ├── Android.mk ├── bootimg.c ├── engine.c ├── engineering_key.p12 ├── fastboot.c ├── fastboot.h ├── genkey.sh ├── p12topem.sh ├── protocol.c ├── signfile.sh ├── usb.h ├── usb_linux.c ├── usb_osx.c ├── usb_windows.c ├── usbtest.c ├── util_linux.c ├── util_osx.c └── util_windows.c ├── fs_mgr ├── Android.mk ├── fs_mgr.c ├── fs_mgr_main.c ├── fs_mgr_priv.h └── include │ └── fs_mgr.h ├── gpttool ├── Android.mk └── gpttool.c ├── include ├── android │ └── log.h ├── corkscrew │ ├── backtrace.h │ ├── demangle.h │ ├── map_info.h │ ├── ptrace.h │ └── symbol_table.h ├── ctest │ └── ctest.h ├── cutils │ ├── abort_socket.h │ ├── android_reboot.h │ ├── array.h │ ├── ashmem.h │ ├── atomic-arm.h │ ├── atomic-inline.h │ ├── atomic-mips.h │ ├── atomic-x86.h │ ├── atomic.h │ ├── bitops.h │ ├── compiler.h │ ├── config_utils.h │ ├── cpu_info.h │ ├── debugger.h │ ├── dir_hash.h │ ├── event_tag_map.h │ ├── fs.h │ ├── hashmap.h │ ├── iosched_policy.h │ ├── jstring.h │ ├── klog.h │ ├── list.h │ ├── log.h │ ├── logd.h │ ├── logger.h │ ├── logprint.h │ ├── memory.h │ ├── misc.h │ ├── mq.h │ ├── multiuser.h │ ├── native_handle.h │ ├── open_memstream.h │ ├── partition_utils.h │ ├── process_name.h │ ├── properties.h │ ├── qsort_r_compat.h │ ├── qtaguid.h │ ├── record_stream.h │ ├── sched_policy.h │ ├── selector.h │ ├── sockets.h │ ├── str_parms.h │ ├── threads.h │ ├── tztime.h │ ├── uevent.h │ ├── uio.h │ └── zygote.h ├── diskconfig │ └── diskconfig.h ├── ion │ └── ion.h ├── mincrypt │ ├── rsa.h │ └── sha.h ├── netutils │ ├── dhcp.h │ └── ifc.h ├── pixelflinger │ ├── format.h │ └── pixelflinger.h ├── private │ ├── android_filesystem_config.h │ └── pixelflinger │ │ ├── ggl_context.h │ │ └── ggl_fixed.h ├── sync │ └── sync.h ├── system │ ├── audio.h │ ├── audio_policy.h │ ├── camera.h │ ├── graphics.h │ └── window.h ├── sysutils │ ├── FrameworkClient.h │ ├── FrameworkCommand.h │ ├── FrameworkListener.h │ ├── List.h │ ├── NetlinkEvent.h │ ├── NetlinkListener.h │ ├── ServiceManager.h │ ├── SocketClient.h │ └── SocketListener.h ├── usbhost │ └── usbhost.h └── zipfile │ └── zipfile.h ├── init ├── Android.mk ├── MODULE_LICENSE_APACHE2 ├── NOTICE ├── README.BOOTCHART ├── bootchart.c ├── bootchart.h ├── builtins.c ├── devices.c ├── devices.h ├── grab-bootchart.sh ├── init.c ├── init.h ├── init_parser.c ├── init_parser.h ├── keychords.c ├── keychords.h ├── keywords.h ├── log.h ├── logo.c ├── parser.c ├── parser.h ├── property_service.c ├── property_service.h ├── readme.txt ├── signal_handler.c ├── signal_handler.h ├── ueventd.c ├── ueventd.h ├── ueventd_parser.c ├── ueventd_parser.h ├── util.c ├── util.h ├── watchdogd.c └── watchdogd.h ├── libcorkscrew ├── Android.mk ├── MODULE_LICENSE_APACHE2 ├── NOTICE ├── arch-arm │ ├── backtrace-arm.c │ └── ptrace-arm.c ├── arch-mips │ ├── backtrace-mips.c │ └── ptrace-mips.c ├── arch-x86 │ ├── backtrace-x86.c │ └── ptrace-x86.c ├── backtrace-arch.h ├── backtrace-helper.c ├── backtrace-helper.h ├── backtrace.c ├── demangle.c ├── map_info.c ├── ptrace-arch.h ├── ptrace.c ├── symbol_table.c └── test.c ├── libctest ├── Android.mk ├── NOTICE └── ctest.c ├── libcutils ├── Android.mk ├── MODULE_LICENSE_APACHE2 ├── NOTICE ├── abort_socket.c ├── android_reboot.c ├── arch-arm │ └── memset32.S ├── arch-x86 │ ├── android_memset16.S │ ├── android_memset32.S │ ├── cache_wrapper.S │ ├── sse2-memset16-atom.S │ └── sse2-memset32-atom.S ├── array.c ├── ashmem-dev.c ├── ashmem-host.c ├── atomic.c ├── buffer.c ├── buffer.h ├── config_utils.c ├── cpu_info.c ├── debugger.c ├── dir_hash.c ├── dlmalloc_stubs.c ├── fs.c ├── hashmap.c ├── iosched_policy.c ├── klog.c ├── list.c ├── load_file.c ├── loghack.h ├── memory.c ├── mq.c ├── multiuser.c ├── native_handle.c ├── open_memstream.c ├── partition_utils.c ├── private.h ├── process_name.c ├── properties.c ├── qsort_r_compat.c ├── qtaguid.c ├── record_stream.c ├── sched_policy.c ├── selector.c ├── socket_inaddr_any_server.c ├── socket_local.h ├── socket_local_client.c ├── socket_local_server.c ├── socket_loopback_client.c ├── socket_loopback_server.c ├── socket_network_client.c ├── sockets.c ├── str_parms.c ├── strdup16to8.c ├── strdup8to16.c ├── threads.c ├── tzfile.h ├── tzstrftime.c ├── tztime.c ├── uevent.c ├── uio.c └── zygote.c ├── libdiskconfig ├── Android.mk ├── config_mbr.c ├── diskconfig.c ├── diskutils.c ├── dump_diskconfig.c └── write_lst.c ├── libion ├── Android.mk ├── ion.c └── ion_test.c ├── liblinenoise ├── Android.mk ├── MODULE_LICENSE_BSD_LIKE ├── NOTICE ├── linenoise.c └── linenoise.h ├── liblog ├── Android.mk ├── NOTICE ├── event_tag_map.c ├── fake_log_device.c ├── logd_write.c └── logprint.c ├── libmincrypt ├── Android.mk ├── NOTICE ├── rsa.c ├── rsa_e_3.c ├── rsa_e_f4.c ├── sha.c └── tools │ ├── Android.mk │ ├── DumpPublicKey.java │ └── DumpPublicKey.mf ├── libnetutils ├── Android.mk ├── NOTICE ├── dhcp_utils.c ├── dhcpclient.c ├── dhcpmsg.c ├── dhcpmsg.h ├── ifc_utils.c ├── packet.c └── packet.h ├── libnl_2 ├── .gitignore ├── Android.mk ├── README ├── attr.c ├── cache.c ├── dbg.c ├── genl │ ├── family.c │ └── genl.c ├── handlers.c ├── msg.c ├── netlink.c ├── object.c └── socket.c ├── libpixelflinger ├── Android.mk ├── MODULE_LICENSE_APACHE2 ├── NOTICE ├── arch-mips │ └── t32cb16blend.S ├── buffer.cpp ├── buffer.h ├── clear.cpp ├── clear.h ├── codeflinger │ ├── ARMAssembler.cpp │ ├── ARMAssembler.h │ ├── ARMAssemblerInterface.cpp │ ├── ARMAssemblerInterface.h │ ├── ARMAssemblerProxy.cpp │ ├── ARMAssemblerProxy.h │ ├── CodeCache.cpp │ ├── CodeCache.h │ ├── GGLAssembler.cpp │ ├── GGLAssembler.h │ ├── MIPSAssembler.cpp │ ├── MIPSAssembler.h │ ├── armreg.h │ ├── blending.cpp │ ├── disassem.c │ ├── disassem.h │ ├── load_store.cpp │ ├── mips_disassem.c │ ├── mips_disassem.h │ ├── mips_opcode.h │ └── texturing.cpp ├── col32cb16blend.S ├── col32cb16blend_neon.S ├── fixed.cpp ├── format.cpp ├── picker.cpp ├── picker.h ├── pixelflinger.cpp ├── raster.cpp ├── raster.h ├── rotate90CW_4x4_16v6.S ├── scanline.cpp ├── scanline.h ├── t32cb16blend.S ├── tests │ ├── Android.mk │ └── codegen │ │ ├── Android.mk │ │ └── codegen.cpp ├── tinyutils │ ├── Errors.h │ ├── KeyedVector.h │ ├── SharedBuffer.cpp │ ├── SharedBuffer.h │ ├── SortedVector.h │ ├── TypeHelpers.h │ ├── Vector.h │ ├── VectorImpl.cpp │ ├── VectorImpl.h │ └── smartpointer.h ├── trap.cpp └── trap.h ├── libsparse ├── Android.mk ├── backed_block.c ├── backed_block.h ├── img2simg.c ├── include │ └── sparse │ │ └── sparse.h ├── output_file.c ├── output_file.h ├── simg2img.c ├── simg2simg.c ├── simg_dump.py ├── sparse.c ├── sparse_crc32.c ├── sparse_crc32.h ├── sparse_defs.h ├── sparse_err.c ├── sparse_file.h ├── sparse_format.h └── sparse_read.c ├── libsuspend ├── Android.mk ├── autosuspend.c ├── autosuspend_autosleep.c ├── autosuspend_earlysuspend.c ├── autosuspend_ops.h ├── autosuspend_wakeup_count.c └── include │ └── suspend │ └── autosuspend.h ├── libsync ├── Android.mk ├── sync.c └── sync_test.c ├── libsysutils ├── Android.mk ├── EventLogTags.logtags └── src │ ├── FrameworkClient.cpp │ ├── FrameworkCommand.cpp │ ├── FrameworkListener.cpp │ ├── NetlinkEvent.cpp │ ├── NetlinkListener.cpp │ ├── ServiceManager.cpp │ ├── SocketClient.cpp │ └── SocketListener.cpp ├── libusbhost ├── Android.mk └── usbhost.c ├── libzipfile ├── Android.mk ├── MODULE_LICENSE_APACHE2 ├── NOTICE ├── centraldir.c ├── private.h ├── test_zipfile.c └── zipfile.c ├── logcat ├── Android.mk ├── MODULE_LICENSE_APACHE2 ├── NOTICE ├── event.logtags └── logcat.cpp ├── logwrapper ├── Android.mk ├── NOTICE └── logwrapper.c ├── mkbootimg ├── Android.mk ├── bootimg.h └── mkbootimg.c ├── netcfg ├── Android.mk ├── MODULE_LICENSE_APACHE2 ├── NOTICE └── netcfg.c ├── rootdir ├── Android.mk ├── etc │ ├── dbus.conf │ ├── hosts │ ├── init.goldfish.rc │ ├── init.goldfish.sh │ ├── init.testmenu │ ├── mountd.conf │ ├── ueventd.goldfish.rc │ └── vold.fstab ├── init.rc ├── init.trace.rc ├── init.usb.rc └── ueventd.rc ├── run-as ├── Android.mk ├── NOTICE ├── package.c ├── package.h └── run-as.c ├── sdcard ├── Android.mk ├── fuse.h └── sdcard.c ├── sh ├── Android.mk ├── MODULE_LICENSE_BSD ├── NOTICE ├── TOUR ├── ThirdPartyProject.prop ├── alias.c ├── alias.h ├── arith.c ├── arith.h ├── arith.y ├── arith_lex.c ├── arith_lex.l ├── bltin │ ├── bltin.h │ ├── echo.1 │ └── echo.c ├── builtins.c ├── builtins.def ├── builtins.h ├── cd.c ├── cd.h ├── error.c ├── error.h ├── eval.c ├── eval.h ├── exec.c ├── exec.h ├── expand.c ├── expand.h ├── funcs │ ├── cmv │ ├── dirs │ ├── kill │ ├── login │ ├── newgrp │ ├── popd │ ├── pushd │ └── suspend ├── histedit.c ├── init.c ├── init.h ├── input.c ├── input.h ├── jobs.c ├── jobs.h ├── machdep.h ├── main.c ├── main.h ├── memalloc.c ├── memalloc.h ├── miscbltin.c ├── miscbltin.h ├── mkbuiltins ├── mkinit.sh ├── mknodes.sh ├── mktokens ├── myhistedit.h ├── mystring.c ├── mystring.h ├── nodes.c ├── nodes.c.pat ├── nodes.h ├── nodetypes ├── options.c ├── options.h ├── output.c ├── output.h ├── parser.c ├── parser.h ├── redir.c ├── redir.h ├── sh.1 ├── shell.h ├── show.c ├── show.h ├── syntax.c ├── syntax.h ├── token.h ├── trap.c ├── trap.h ├── var.c └── var.h └── toolbox ├── Android.mk ├── MODULE_LICENSE_BSD ├── NOTICE ├── alarm.c ├── cat.c ├── chcon.c ├── chmod.c ├── chown.c ├── cmp.c ├── cp ├── cp.c ├── extern.h └── utils.c ├── date.c ├── dd.c ├── dd.h ├── df.c ├── dmesg.c ├── du.c ├── dynarray.c ├── dynarray.h ├── exists.c ├── getenforce.c ├── getevent.c ├── getevent.h ├── getprop.c ├── getsebool.c ├── grep ├── fastgrep.c ├── file.c ├── grep.c ├── grep.h ├── queue.c └── util.c ├── hd.c ├── id.c ├── ifconfig.c ├── iftop.c ├── insmod.c ├── ioctl.c ├── ionice.c ├── kill.c ├── ln.c ├── load_policy.c ├── log.c ├── ls.c ├── lsmod.c ├── lsof.c ├── lsusb.c ├── md5.c ├── mkdir.c ├── mount.c ├── mv.c ├── nandread.c ├── netstat.c ├── newfs_msdos.c ├── notify.c ├── printenv.c ├── ps.c ├── r.c ├── readtty.c ├── reboot.c ├── renice.c ├── restorecon.c ├── rm.c ├── rmdir.c ├── rmmod.c ├── rotatefb.c ├── route.c ├── runcon.c ├── schedtop.c ├── sendevent.c ├── setconsole.c ├── setenforce.c ├── setkey.c ├── setprop.c ├── setsebool.c ├── sleep.c ├── smd.c ├── start.c ├── stop.c ├── sync.c ├── syren.c ├── toolbox.c ├── top.c ├── touch.c ├── umount.c ├── uptime.c ├── vmstat.c ├── watchprops.c └── wipe.c /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | LOCAL/ 3 | -------------------------------------------------------------------------------- /Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2008 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | LOCAL_PATH := $(my-dir) 17 | 18 | include $(call first-makefiles-under,$(LOCAL_PATH)) 19 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | 2 | The system/ directory is intended for pieces of the world that are the 3 | core of the embedded linux platform at the heart of Android. These 4 | essential bits are required for basic booting, operation, and debugging. 5 | 6 | They should not depend on libraries outside of system/... (some of them 7 | do currently -- they need to be updated or changed) and they should not 8 | be required for the simulator build. 9 | 10 | The license for all these pieces should be clean (Apache2, BSD, or MIT). 11 | 12 | Currently system/bluetooth/... and system/extra/... have some pieces 13 | with GPL/LGPL licensed code. 14 | 15 | Assorted Issues: 16 | 17 | - pppd depends on libutils for logging 18 | - pppd depends on libcrypt/libcrypto 19 | - init, linker, debuggerd, toolbox, usbd depend on libcutils 20 | - should probably rename bionic to libc 21 | -------------------------------------------------------------------------------- /ThirdPartyProject.prop: -------------------------------------------------------------------------------- 1 | # Copyright 2010 Google Inc. All Rights Reserved. 2 | #Fri Jul 16 10:03:09 PDT 2010 3 | currentVersion=2.6.32 4 | version=2.6.32 5 | isNative=true 6 | feedurl=http\://kernel.org/pub/linux/kernel/v2.6/ 7 | name=linux 8 | keywords=linux 9 | onDevice=true 10 | homepage=http\://kernel.org 11 | -------------------------------------------------------------------------------- /adb/MODULE_LICENSE_APACHE2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chainfire/platform_system_core/f3600a1c929744ec5e91c7a1baa0dabaeeab1028/adb/MODULE_LICENSE_APACHE2 -------------------------------------------------------------------------------- /adb/adb_client.h: -------------------------------------------------------------------------------- 1 | #ifndef _ADB_CLIENT_H_ 2 | #define _ADB_CLIENT_H_ 3 | 4 | #include "adb.h" 5 | 6 | /* connect to adb, connect to the named service, and return 7 | ** a valid fd for interacting with that service upon success 8 | ** or a negative number on failure 9 | */ 10 | int adb_connect(const char *service); 11 | int _adb_connect(const char *service); 12 | 13 | /* connect to adb, connect to the named service, return 0 if 14 | ** the connection succeeded AND the service returned OKAY 15 | */ 16 | int adb_command(const char *service); 17 | 18 | /* connect to adb, connect to the named service, return 19 | ** a malloc'd string of its response upon success or NULL 20 | ** on failure. 21 | */ 22 | char *adb_query(const char *service); 23 | 24 | /* Set the preferred transport to connect to. 25 | */ 26 | void adb_set_transport(transport_type type, const char* serial); 27 | 28 | /* Set TCP specifics of the transport to use 29 | */ 30 | void adb_set_tcp_specifics(int server_port); 31 | 32 | /* Return the console port of the currently connected emulator (if any) 33 | * of -1 if there is no emulator, and -2 if there is more than one. 34 | * assumes adb_set_transport() was alled previously... 35 | */ 36 | int adb_get_emulator_console_port(void); 37 | 38 | /* send commands to the current emulator instance. will fail if there 39 | * is zero, or more than one emulator connected (or if you use -s 40 | * with a that does not designate an emulator) 41 | */ 42 | int adb_send_emulator_command(int argc, char** argv); 43 | 44 | /* return verbose error string from last operation */ 45 | const char *adb_error(void); 46 | 47 | /* read a standard adb status response (OKAY|FAIL) and 48 | ** return 0 in the event of OKAY, -1 in the event of FAIL 49 | ** or protocol error 50 | */ 51 | int adb_status(int fd); 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /adb/console.c: -------------------------------------------------------------------------------- 1 | #include "sysdeps.h" 2 | #include "adb.h" 3 | #include "adb_client.h" 4 | #include 5 | 6 | static int connect_to_console(void) 7 | { 8 | int fd, port; 9 | 10 | port = adb_get_emulator_console_port(); 11 | if (port < 0) { 12 | if (port == -2) 13 | fprintf(stderr, "error: more than one emulator detected. use -s option\n"); 14 | else 15 | fprintf(stderr, "error: no emulator detected\n"); 16 | return -1; 17 | } 18 | fd = socket_loopback_client( port, SOCK_STREAM ); 19 | if (fd < 0) { 20 | fprintf(stderr, "error: could not connect to TCP port %d\n", port); 21 | return -1; 22 | } 23 | return fd; 24 | } 25 | 26 | 27 | int adb_send_emulator_command(int argc, char** argv) 28 | { 29 | int fd, nn; 30 | 31 | fd = connect_to_console(); 32 | if (fd < 0) 33 | return 1; 34 | 35 | #define QUIT "quit\n" 36 | 37 | for (nn = 1; nn < argc; nn++) { 38 | adb_write( fd, argv[nn], strlen(argv[nn]) ); 39 | adb_write( fd, (nn == argc-1) ? "\n" : " ", 1 ); 40 | } 41 | adb_write( fd, QUIT, sizeof(QUIT)-1 ); 42 | adb_close(fd); 43 | 44 | return 0; 45 | } 46 | -------------------------------------------------------------------------------- /adb/get_my_path_darwin.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #import 18 | #include 19 | 20 | void get_my_path(char *s, size_t maxLen) 21 | { 22 | ProcessSerialNumber psn; 23 | GetCurrentProcess(&psn); 24 | CFDictionaryRef dict; 25 | dict = ProcessInformationCopyDictionary(&psn, 0xffffffff); 26 | CFStringRef value = (CFStringRef)CFDictionaryGetValue(dict, 27 | CFSTR("CFBundleExecutable")); 28 | CFStringGetCString(value, s, maxLen, kCFStringEncodingUTF8); 29 | } 30 | 31 | -------------------------------------------------------------------------------- /adb/get_my_path_freebsd.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 bsdroid project 3 | * Alexey Tarasov 4 | * 5 | * Copyright (C) 2007 The Android Open Source Project 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | void 26 | get_my_path(char *exe, size_t maxLen) 27 | { 28 | char proc[64]; 29 | 30 | snprintf(proc, sizeof(proc), "/proc/%d/file", getpid()); 31 | 32 | int err = readlink(proc, exe, maxLen - 1); 33 | 34 | exe[err > 0 ? err : 0] = '\0'; 35 | } 36 | 37 | -------------------------------------------------------------------------------- /adb/get_my_path_linux.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | void get_my_path(char *exe, size_t maxLen) 23 | { 24 | char proc[64]; 25 | snprintf(proc, sizeof proc, "/proc/%d/exe", getpid()); 26 | int err = readlink(proc, exe, maxLen - 1); 27 | if(err > 0) { 28 | exe[err] = '\0'; 29 | } else { 30 | exe[0] = '\0'; 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /adb/get_my_path_windows.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | void get_my_path(char *exe, size_t maxLen) 22 | { 23 | char *r; 24 | 25 | /* XXX: should be GetModuleFileNameA */ 26 | if (GetModuleFileName(NULL, exe, maxLen) > 0) { 27 | r = strrchr(exe, '\\'); 28 | if (r != NULL) 29 | *r = '\0'; 30 | } else { 31 | exe[0] = '\0'; 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /adb/mutex_list.h: -------------------------------------------------------------------------------- 1 | /* the list of mutexes used by adb */ 2 | /* #ifndef __MUTEX_LIST_H 3 | * Do not use an include-guard. This file is included once to declare the locks 4 | * and once in win32 to actually do the runtime initialization. 5 | */ 6 | #ifndef ADB_MUTEX 7 | #error ADB_MUTEX not defined when including this file 8 | #endif 9 | ADB_MUTEX(dns_lock) 10 | ADB_MUTEX(socket_list_lock) 11 | ADB_MUTEX(transport_lock) 12 | #if ADB_HOST 13 | ADB_MUTEX(local_transports_lock) 14 | #endif 15 | ADB_MUTEX(usb_lock) 16 | 17 | // Sadly logging to /data/adb/adb-... is not thread safe. 18 | // After modifying adb.h::D() to count invocations: 19 | // DEBUG(jpa):0:Handling main() 20 | // DEBUG(jpa):1:[ usb_init - starting thread ] 21 | // (Oopsies, no :2:, and matching message is also gone.) 22 | // DEBUG(jpa):3:[ usb_thread - opening device ] 23 | // DEBUG(jpa):4:jdwp control socket started (10) 24 | ADB_MUTEX(D_lock) 25 | 26 | #undef ADB_MUTEX 27 | -------------------------------------------------------------------------------- /adb/sockets.dia: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chainfire/platform_system_core/f3600a1c929744ec5e91c7a1baa0dabaeeab1028/adb/sockets.dia -------------------------------------------------------------------------------- /adb/transport.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __TRANSPORT_H 18 | #define __TRANSPORT_H 19 | 20 | /* convenience wrappers around read/write that will retry on 21 | ** EINTR and/or short read/write. Returns 0 on success, -1 22 | ** on error or EOF. 23 | */ 24 | int readx(int fd, void *ptr, size_t len); 25 | int writex(int fd, const void *ptr, size_t len); 26 | #endif /* __TRANSPORT_H */ 27 | -------------------------------------------------------------------------------- /adb/usb_vendors.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __USB_VENDORS_H 18 | #define __USB_VENDORS_H 19 | 20 | extern int vendorIds[]; 21 | extern unsigned vendorIdCount; 22 | 23 | void usb_vendors_init(void); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /charger/Android.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2011 The Android Open Source Project 2 | 3 | ifneq ($(BUILD_TINY_ANDROID),true) 4 | 5 | LOCAL_PATH := $(call my-dir) 6 | include $(CLEAR_VARS) 7 | 8 | LOCAL_SRC_FILES := \ 9 | charger.c 10 | 11 | ifeq ($(strip $(BOARD_CHARGER_DISABLE_INIT_BLANK)),true) 12 | LOCAL_CFLAGS := -DCHARGER_DISABLE_INIT_BLANK 13 | endif 14 | 15 | LOCAL_MODULE := charger 16 | LOCAL_MODULE_TAGS := optional 17 | LOCAL_FORCE_STATIC_EXECUTABLE := true 18 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) 19 | LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED) 20 | 21 | LOCAL_C_INCLUDES := bootable/recovery 22 | 23 | LOCAL_STATIC_LIBRARIES := libminui libpixelflinger_static libpng 24 | LOCAL_STATIC_LIBRARIES += libz libstdc++ libcutils libm libc 25 | 26 | include $(BUILD_EXECUTABLE) 27 | 28 | define _add-charger-image 29 | include $$(CLEAR_VARS) 30 | LOCAL_MODULE := system_core_charger_$(notdir $(1)) 31 | LOCAL_MODULE_STEM := $(notdir $(1)) 32 | _img_modules += $$(LOCAL_MODULE) 33 | LOCAL_SRC_FILES := $1 34 | LOCAL_MODULE_TAGS := optional 35 | LOCAL_MODULE_CLASS := ETC 36 | LOCAL_MODULE_PATH := $$(TARGET_ROOT_OUT)/res/images/charger 37 | include $$(BUILD_PREBUILT) 38 | endef 39 | 40 | _img_modules := 41 | _images := 42 | $(foreach _img, $(call find-subdir-subdir-files, "images", "*.png"), \ 43 | $(eval $(call _add-charger-image,$(_img)))) 44 | 45 | include $(CLEAR_VARS) 46 | LOCAL_MODULE := charger_res_images 47 | LOCAL_MODULE_TAGS := optional 48 | LOCAL_REQUIRED_MODULES := $(_img_modules) 49 | include $(BUILD_PHONY_PACKAGE) 50 | 51 | _add-charger-image := 52 | _img_modules := 53 | 54 | endif 55 | -------------------------------------------------------------------------------- /charger/images/battery_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chainfire/platform_system_core/f3600a1c929744ec5e91c7a1baa0dabaeeab1028/charger/images/battery_0.png -------------------------------------------------------------------------------- /charger/images/battery_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chainfire/platform_system_core/f3600a1c929744ec5e91c7a1baa0dabaeeab1028/charger/images/battery_1.png -------------------------------------------------------------------------------- /charger/images/battery_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chainfire/platform_system_core/f3600a1c929744ec5e91c7a1baa0dabaeeab1028/charger/images/battery_2.png -------------------------------------------------------------------------------- /charger/images/battery_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chainfire/platform_system_core/f3600a1c929744ec5e91c7a1baa0dabaeeab1028/charger/images/battery_3.png -------------------------------------------------------------------------------- /charger/images/battery_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chainfire/platform_system_core/f3600a1c929744ec5e91c7a1baa0dabaeeab1028/charger/images/battery_4.png -------------------------------------------------------------------------------- /charger/images/battery_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chainfire/platform_system_core/f3600a1c929744ec5e91c7a1baa0dabaeeab1028/charger/images/battery_5.png -------------------------------------------------------------------------------- /charger/images/battery_charge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chainfire/platform_system_core/f3600a1c929744ec5e91c7a1baa0dabaeeab1028/charger/images/battery_charge.png -------------------------------------------------------------------------------- /charger/images/battery_fail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chainfire/platform_system_core/f3600a1c929744ec5e91c7a1baa0dabaeeab1028/charger/images/battery_fail.png -------------------------------------------------------------------------------- /cpio/Android.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2005 The Android Open Source Project 2 | 3 | LOCAL_PATH:= $(call my-dir) 4 | include $(CLEAR_VARS) 5 | 6 | LOCAL_SRC_FILES := \ 7 | mkbootfs.c 8 | 9 | LOCAL_MODULE := mkbootfs 10 | 11 | include $(BUILD_HOST_EXECUTABLE) 12 | 13 | $(call dist-for-goals,dist_files,$(LOCAL_BUILT_MODULE)) 14 | -------------------------------------------------------------------------------- /debuggerd/Android.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2005 The Android Open Source Project 2 | 3 | ifneq ($(filter arm mips x86,$(TARGET_ARCH)),) 4 | 5 | LOCAL_PATH:= $(call my-dir) 6 | include $(CLEAR_VARS) 7 | 8 | LOCAL_SRC_FILES:= \ 9 | backtrace.c \ 10 | debuggerd.c \ 11 | getevent.c \ 12 | tombstone.c \ 13 | utility.c \ 14 | $(TARGET_ARCH)/machine.c 15 | 16 | LOCAL_CFLAGS := -Wall -Wno-unused-parameter -std=gnu99 17 | LOCAL_MODULE := debuggerd 18 | 19 | ifeq ($(ARCH_ARM_HAVE_VFP),true) 20 | LOCAL_CFLAGS += -DWITH_VFP 21 | endif # ARCH_ARM_HAVE_VFP 22 | ifeq ($(ARCH_ARM_HAVE_VFP_D32),true) 23 | LOCAL_CFLAGS += -DWITH_VFP_D32 24 | endif # ARCH_ARM_HAVE_VFP_D32 25 | 26 | LOCAL_SHARED_LIBRARIES := \ 27 | libcutils \ 28 | libc \ 29 | libcorkscrew \ 30 | libselinux 31 | 32 | include $(BUILD_EXECUTABLE) 33 | 34 | include $(CLEAR_VARS) 35 | LOCAL_SRC_FILES := crasher.c 36 | LOCAL_SRC_FILES += $(TARGET_ARCH)/crashglue.S 37 | LOCAL_MODULE := crasher 38 | LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) 39 | LOCAL_MODULE_TAGS := optional 40 | #LOCAL_FORCE_STATIC_EXECUTABLE := true 41 | LOCAL_SHARED_LIBRARIES := libcutils libc 42 | include $(BUILD_EXECUTABLE) 43 | 44 | ifeq ($(ARCH_ARM_HAVE_VFP),true) 45 | include $(CLEAR_VARS) 46 | 47 | LOCAL_CFLAGS += -DWITH_VFP 48 | ifeq ($(ARCH_ARM_HAVE_VFP_D32),true) 49 | LOCAL_CFLAGS += -DWITH_VFP_D32 50 | endif # ARCH_ARM_HAVE_VFP_D32 51 | 52 | LOCAL_SRC_FILES := vfp-crasher.c vfp.S 53 | LOCAL_MODULE := vfp-crasher 54 | LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) 55 | LOCAL_MODULE_TAGS := optional 56 | LOCAL_SHARED_LIBRARIES := libcutils libc 57 | include $(BUILD_EXECUTABLE) 58 | endif # ARCH_ARM_HAVE_VFP == true 59 | 60 | endif # arm or x86 in TARGET_ARCH 61 | -------------------------------------------------------------------------------- /debuggerd/MODULE_LICENSE_APACHE2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chainfire/platform_system_core/f3600a1c929744ec5e91c7a1baa0dabaeeab1028/debuggerd/MODULE_LICENSE_APACHE2 -------------------------------------------------------------------------------- /debuggerd/arm/crashglue.S: -------------------------------------------------------------------------------- 1 | .globl crash1 2 | .type crash1, %function 3 | .globl crashnostack 4 | .type crashnostack, %function 5 | 6 | crash1: 7 | ldr r0, =0xa5a50000 8 | ldr r1, =0xa5a50001 9 | ldr r2, =0xa5a50002 10 | ldr r3, =0xa5a50003 11 | ldr r4, =0xa5a50004 12 | ldr r5, =0xa5a50005 13 | ldr r6, =0xa5a50006 14 | ldr r7, =0xa5a50007 15 | ldr r8, =0xa5a50008 16 | ldr r9, =0xa5a50009 17 | ldr r10, =0xa5a50010 18 | ldr r11, =0xa5a50011 19 | ldr r12, =0xa5a50012 20 | 21 | mov lr, #0 22 | ldr lr, [lr] 23 | b . 24 | 25 | 26 | crashnostack: 27 | mov sp, #0 28 | mov r0, #0 29 | ldr r0, [r0] 30 | b . 31 | -------------------------------------------------------------------------------- /debuggerd/backtrace.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _DEBUGGERD_BACKTRACE_H 18 | #define _DEBUGGERD_BACKTRACE_H 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include 25 | 26 | /* Dumps a backtrace using a format similar to what Dalvik uses so that the result 27 | * can be intermixed in a bug report. */ 28 | void dump_backtrace(int fd, pid_t pid, pid_t tid, bool* detach_failed, 29 | int* total_sleep_time_usec); 30 | 31 | #endif // _DEBUGGERD_BACKTRACE_H 32 | -------------------------------------------------------------------------------- /debuggerd/getevent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _DEBUGGERD_GETEVENT_H 18 | #define _DEBUGGERD_GETEVENT_H 19 | 20 | int init_getevent(); 21 | void uninit_getevent(); 22 | int get_event(struct input_event* event, int timeout); 23 | 24 | #endif // _DEBUGGERD_GETEVENT_H 25 | -------------------------------------------------------------------------------- /debuggerd/machine.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _DEBUGGERD_MACHINE_H 18 | #define _DEBUGGERD_MACHINE_H 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include 25 | 26 | #include "utility.h" 27 | 28 | void dump_memory_and_code(const ptrace_context_t* context, log_t* log, pid_t tid, bool at_fault); 29 | void dump_registers(const ptrace_context_t* context, log_t* log, pid_t tid, bool at_fault); 30 | 31 | #endif // _DEBUGGERD_MACHINE_H 32 | -------------------------------------------------------------------------------- /debuggerd/mips/crashglue.S: -------------------------------------------------------------------------------- 1 | .set noat 2 | 3 | .globl crash1 4 | .globl crashnostack 5 | 6 | crash1: 7 | li $0,0xdead0000+0 8 | li $1,0xdead0000+1 9 | li $2,0xdead0000+2 10 | li $3,0xdead0000+3 11 | li $4,0xdead0000+4 12 | li $5,0xdead0000+5 13 | li $6,0xdead0000+6 14 | li $7,0xdead0000+7 15 | li $8,0xdead0000+8 16 | li $9,0xdead0000+9 17 | li $10,0xdead0000+10 18 | li $11,0xdead0000+11 19 | li $12,0xdead0000+12 20 | li $13,0xdead0000+13 21 | li $14,0xdead0000+14 22 | li $15,0xdead0000+15 23 | li $16,0xdead0000+16 24 | li $17,0xdead0000+17 25 | li $18,0xdead0000+18 26 | li $19,0xdead0000+19 27 | li $20,0xdead0000+20 28 | li $21,0xdead0000+21 29 | li $22,0xdead0000+22 30 | li $23,0xdead0000+23 31 | li $24,0xdead0000+24 32 | li $25,0xdead0000+25 33 | li $26,0xdead0000+26 34 | li $27,0xdead0000+27 35 | li $28,0xdead0000+28 36 | # don't trash the stack otherwise the signal handler won't run 37 | #li $29,0xdead0000+29 38 | li $30,0xdead0000+30 39 | li $31,0xdead0000+31 40 | 41 | lw $zero,($0) 42 | b . 43 | 44 | 45 | crashnostack: 46 | li $sp, 0 47 | lw $zero,($0) 48 | b . 49 | -------------------------------------------------------------------------------- /debuggerd/tombstone.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _DEBUGGERD_TOMBSTONE_H 18 | #define _DEBUGGERD_TOMBSTONE_H 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include 25 | 26 | /* Creates a tombstone file and writes the crash dump to it. 27 | * Returns the path of the tombstone, which must be freed using free(). */ 28 | char* engrave_tombstone(pid_t pid, pid_t tid, int signal, 29 | bool dump_sibling_threads, bool quiet, bool* detach_failed, int* total_sleep_time_usec); 30 | 31 | #endif // _DEBUGGERD_TOMBSTONE_H 32 | -------------------------------------------------------------------------------- /debuggerd/utility.h: -------------------------------------------------------------------------------- 1 | /* system/debuggerd/utility.h 2 | ** 3 | ** Copyright 2008, The Android Open Source Project 4 | ** 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); 6 | ** you may not use this file except in compliance with the License. 7 | ** You may obtain a copy of the License at 8 | ** 9 | ** http://www.apache.org/licenses/LICENSE-2.0 10 | ** 11 | ** Unless required by applicable law or agreed to in writing, software 12 | ** distributed under the License is distributed on an "AS IS" BASIS, 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ** See the License for the specific language governing permissions and 15 | ** limitations under the License. 16 | */ 17 | 18 | #ifndef _DEBUGGERD_UTILITY_H 19 | #define _DEBUGGERD_UTILITY_H 20 | 21 | #include 22 | #include 23 | 24 | typedef struct { 25 | /* tombstone file descriptor */ 26 | int tfd; 27 | /* if true, does not log anything to the Android logcat */ 28 | bool quiet; 29 | } log_t; 30 | 31 | /* Log information onto the tombstone. */ 32 | void _LOG(log_t* log, bool in_tombstone_only, const char *fmt, ...) 33 | __attribute__ ((format(printf, 3, 4))); 34 | 35 | #define LOG(fmt...) _LOG(NULL, 0, fmt) 36 | 37 | /* Set to 1 for normal debug traces */ 38 | #if 0 39 | #define XLOG(fmt...) _LOG(NULL, 0, fmt) 40 | #else 41 | #define XLOG(fmt...) do {} while(0) 42 | #endif 43 | 44 | /* Set to 1 for chatty debug traces. Includes all resolved dynamic symbols */ 45 | #if 0 46 | #define XLOG2(fmt...) _LOG(NULL, 0, fmt) 47 | #else 48 | #define XLOG2(fmt...) do {} while(0) 49 | #endif 50 | 51 | int wait_for_signal(pid_t tid, int* total_sleep_time_usec); 52 | void wait_for_stop(pid_t tid, int* total_sleep_time_usec); 53 | 54 | #endif // _DEBUGGERD_UTILITY_H 55 | -------------------------------------------------------------------------------- /debuggerd/vfp-crasher.c: -------------------------------------------------------------------------------- 1 | int main() 2 | { 3 | extern void crash(void); 4 | 5 | crash(); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /debuggerd/vfp.S: -------------------------------------------------------------------------------- 1 | .text 2 | .align 2 3 | .global crash 4 | .type crash, %function 5 | crash: 6 | fconstd d0, #0 7 | fconstd d1, #1 8 | fconstd d2, #2 9 | fconstd d3, #3 10 | fconstd d4, #4 11 | fconstd d5, #5 12 | fconstd d6, #6 13 | fconstd d7, #7 14 | fconstd d8, #8 15 | fconstd d9, #9 16 | fconstd d10, #10 17 | fconstd d11, #11 18 | fconstd d12, #12 19 | fconstd d13, #13 20 | fconstd d14, #14 21 | fconstd d15, #15 22 | #ifdef WITH_VFP_D32 23 | fconstd d16, #16 24 | fconstd d17, #17 25 | fconstd d18, #18 26 | fconstd d19, #19 27 | fconstd d20, #20 28 | fconstd d21, #21 29 | fconstd d22, #22 30 | fconstd d23, #23 31 | fconstd d24, #24 32 | fconstd d25, #25 33 | fconstd d26, #26 34 | fconstd d27, #27 35 | fconstd d28, #28 36 | fconstd d29, #29 37 | fconstd d30, #30 38 | fconstd d31, #31 39 | #endif 40 | mov r0, #0 41 | str r0, [r0] 42 | bx lr 43 | 44 | -------------------------------------------------------------------------------- /debuggerd/x86/crashglue.S: -------------------------------------------------------------------------------- 1 | .globl crash1 2 | .globl crashnostack 3 | 4 | crash1: 5 | movl $0xa5a50000, %eax 6 | movl $0xa5a50001, %ebx 7 | movl $0xa5a50002, %ecx 8 | 9 | movl $0, %edx 10 | jmp *%edx 11 | 12 | 13 | crashnostack: 14 | movl $0, %ebp 15 | jmp *%ebp 16 | -------------------------------------------------------------------------------- /fastboot/engineering_key.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chainfire/platform_system_core/f3600a1c929744ec5e91c7a1baa0dabaeeab1028/fastboot/engineering_key.p12 -------------------------------------------------------------------------------- /fastboot/genkey.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ $# -ne 2 ] 4 | then 5 | echo "Usage: $0 alias \"pass phrase\"" 6 | exit -1 7 | fi 8 | 9 | # Generate a 2048 bit RSA key with public exponent 3. 10 | # Encrypt private key with provided password. 11 | openssl genrsa -3 -out $1.pem -passout pass:"$2" 2048 12 | 13 | # Create a self-signed cert for this key. 14 | openssl req -new -x509 -key $1.pem -passin pass:"$2" \ 15 | -out $1-cert.pem \ 16 | -batch -days 10000 17 | 18 | # Create a PKCS12 store containing the generated private key. 19 | # Protect the keystore and the private key with the provided password. 20 | openssl pkcs12 -export -in $1-cert.pem -inkey $1.pem -passin pass:"$2" \ 21 | -out $1.p12 -name $1 -passout pass:"$2" 22 | 23 | rm $1.pem 24 | rm $1-cert.pem 25 | 26 | -------------------------------------------------------------------------------- /fastboot/p12topem.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ $# -ne 2 ] 4 | then 5 | echo "Usage: $0 alias passphrase" 6 | exit -1 7 | fi 8 | 9 | openssl pkcs12 -passin pass:"$2" -passout pass:"$2" -in $1.p12 -out $1.pem 10 | -------------------------------------------------------------------------------- /fastboot/signfile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ $# -ne 3 ] 4 | then 5 | echo "Usage: $0 alias filename passpharse" 6 | exit -1 7 | fi 8 | 9 | openssl dgst -passin pass:"$3" -binary -sha1 -sign $1.pem $2 > $2.sign 10 | 11 | -------------------------------------------------------------------------------- /fs_mgr/Android.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2011 The Android Open Source Project 2 | 3 | LOCAL_PATH:= $(call my-dir) 4 | include $(CLEAR_VARS) 5 | 6 | LOCAL_SRC_FILES:= fs_mgr.c 7 | 8 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include 9 | 10 | LOCAL_MODULE:= libfs_mgr 11 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 12 | 13 | include $(BUILD_STATIC_LIBRARY) 14 | 15 | 16 | 17 | include $(CLEAR_VARS) 18 | 19 | LOCAL_SRC_FILES:= fs_mgr_main.c 20 | 21 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/include 22 | 23 | LOCAL_MODULE:= fs_mgr 24 | 25 | LOCAL_MODULE_TAGS := optional 26 | LOCAL_FORCE_STATIC_EXECUTABLE := true 27 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)/sbin 28 | LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED) 29 | 30 | LOCAL_STATIC_LIBRARIES := libfs_mgr libcutils libc 31 | 32 | include $(BUILD_EXECUTABLE) 33 | 34 | -------------------------------------------------------------------------------- /fs_mgr/include/fs_mgr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CORE_FS_MGR_H 18 | #define __CORE_FS_MGR_H 19 | 20 | int fs_mgr_mount_all(char *fstab_file); 21 | int fs_mgr_do_mount(char *fstab_file, char *n_name, char *n_blk_dev, char *tmp_mnt_point); 22 | int fs_mgr_do_tmpfs_mount(char *n_name); 23 | int fs_mgr_unmount_all(char *fstab_file); 24 | int fs_mgr_get_crypt_info(char *fstab_file, char *key_loc, char *real_blk_dev, int size); 25 | 26 | #endif /* __CORE_FS_MGR_H */ 27 | 28 | -------------------------------------------------------------------------------- /gpttool/Android.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(HOST_OS),linux) 2 | 3 | LOCAL_PATH:= $(call my-dir) 4 | include $(CLEAR_VARS) 5 | 6 | LOCAL_SRC_FILES := gpttool.c 7 | LOCAL_STATIC_LIBRARIES := libz 8 | 9 | LOCAL_MODULE := gpttool 10 | 11 | include $(BUILD_HOST_EXECUTABLE) 12 | 13 | endif 14 | -------------------------------------------------------------------------------- /include/corkscrew/demangle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* C++ symbol name demangling. */ 18 | 19 | #ifndef _CORKSCREW_DEMANGLE_H 20 | #define _CORKSCREW_DEMANGLE_H 21 | 22 | #include 23 | #include 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /* 30 | * Demangles a C++ symbol name. 31 | * If name is NULL or if the name cannot be demangled, returns NULL. 32 | * Otherwise, returns a newly allocated string that contains the demangled name. 33 | * 34 | * The caller must free the returned string using free(). 35 | */ 36 | char* demangle_symbol_name(const char* name); 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif // _CORKSCREW_DEMANGLE_H 43 | -------------------------------------------------------------------------------- /include/corkscrew/symbol_table.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _CORKSCREW_SYMBOL_TABLE_H 18 | #define _CORKSCREW_SYMBOL_TABLE_H 19 | 20 | #include 21 | #include 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | typedef struct { 28 | uintptr_t start; 29 | uintptr_t end; 30 | char* name; 31 | } symbol_t; 32 | 33 | typedef struct { 34 | symbol_t* symbols; 35 | size_t num_symbols; 36 | } symbol_table_t; 37 | 38 | /* 39 | * Loads a symbol table from a given file. 40 | * Returns NULL on error. 41 | */ 42 | symbol_table_t* load_symbol_table(const char* filename); 43 | 44 | /* 45 | * Frees a symbol table. 46 | */ 47 | void free_symbol_table(symbol_table_t* table); 48 | 49 | /* 50 | * Finds a symbol associated with an address in the symbol table. 51 | * Returns NULL if not found. 52 | */ 53 | const symbol_t* find_symbol(const symbol_table_t* table, uintptr_t addr); 54 | 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | 59 | #endif // _CORKSCREW_SYMBOL_TABLE_H 60 | -------------------------------------------------------------------------------- /include/cutils/android_reboot.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011, The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CUTILS_ANDROID_REBOOT_H__ 18 | #define __CUTILS_ANDROID_REBOOT_H__ 19 | 20 | __BEGIN_DECLS 21 | 22 | /* Commands */ 23 | #define ANDROID_RB_RESTART 0xDEAD0001 24 | #define ANDROID_RB_POWEROFF 0xDEAD0002 25 | #define ANDROID_RB_RESTART2 0xDEAD0003 26 | 27 | /* Flags */ 28 | #define ANDROID_RB_FLAG_NO_SYNC 0x1 29 | #define ANDROID_RB_FLAG_NO_REMOUNT_RO 0x2 30 | 31 | int android_reboot(int cmd, int flags, char *arg); 32 | 33 | __END_DECLS 34 | 35 | #endif /* __CUTILS_ANDROID_REBOOT_H__ */ 36 | -------------------------------------------------------------------------------- /include/cutils/ashmem.h: -------------------------------------------------------------------------------- 1 | /* cutils/ashmem.h 2 | ** 3 | ** Copyright 2008 The Android Open Source Project 4 | ** 5 | ** This file is dual licensed. It may be redistributed and/or modified 6 | ** under the terms of the Apache 2.0 License OR version 2 of the GNU 7 | ** General Public License. 8 | */ 9 | 10 | #ifndef _CUTILS_ASHMEM_H 11 | #define _CUTILS_ASHMEM_H 12 | 13 | #include 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | int ashmem_create_region(const char *name, size_t size); 20 | int ashmem_set_prot_region(int fd, int prot); 21 | int ashmem_pin_region(int fd, size_t offset, size_t len); 22 | int ashmem_unpin_region(int fd, size_t offset, size_t len); 23 | int ashmem_get_size_region(int fd); 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | 29 | #ifndef __ASHMEMIOC /* in case someone included too */ 30 | 31 | #define ASHMEM_NAME_LEN 256 32 | 33 | #define ASHMEM_NAME_DEF "dev/ashmem" 34 | 35 | /* Return values from ASHMEM_PIN: Was the mapping purged while unpinned? */ 36 | #define ASHMEM_NOT_PURGED 0 37 | #define ASHMEM_WAS_PURGED 1 38 | 39 | /* Return values from ASHMEM_UNPIN: Is the mapping now pinned or unpinned? */ 40 | #define ASHMEM_IS_UNPINNED 0 41 | #define ASHMEM_IS_PINNED 1 42 | 43 | #endif /* ! __ASHMEMIOC */ 44 | 45 | #endif /* _CUTILS_ASHMEM_H */ 46 | -------------------------------------------------------------------------------- /include/cutils/bitops.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CUTILS_BITOPS_H 18 | #define __CUTILS_BITOPS_H 19 | 20 | #include 21 | 22 | __BEGIN_DECLS 23 | 24 | static inline int popcount(unsigned int x) 25 | { 26 | return __builtin_popcount(x); 27 | } 28 | 29 | static inline int popcountl(unsigned long x) 30 | { 31 | return __builtin_popcountl(x); 32 | } 33 | 34 | static inline int popcountll(unsigned long long x) 35 | { 36 | return __builtin_popcountll(x); 37 | } 38 | 39 | __END_DECLS 40 | 41 | #endif /* __CUTILS_BITOPS_H */ 42 | -------------------------------------------------------------------------------- /include/cutils/compiler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef ANDROID_CUTILS_COMPILER_H 18 | #define ANDROID_CUTILS_COMPILER_H 19 | 20 | /* 21 | * helps the compiler's optimizer predicting branches 22 | */ 23 | 24 | #ifdef __cplusplus 25 | # define CC_LIKELY( exp ) (__builtin_expect( !!(exp), true )) 26 | # define CC_UNLIKELY( exp ) (__builtin_expect( !!(exp), false )) 27 | #else 28 | # define CC_LIKELY( exp ) (__builtin_expect( !!(exp), 1 )) 29 | # define CC_UNLIKELY( exp ) (__builtin_expect( !!(exp), 0 )) 30 | #endif 31 | 32 | /** 33 | * exports marked symbols 34 | * 35 | * if used on a C++ class declaration, this macro must be inserted 36 | * after the "class" keyword. For instance: 37 | * 38 | * template 39 | * class ANDROID_API Singleton { } 40 | */ 41 | 42 | #define ANDROID_API __attribute__((visibility("default"))) 43 | 44 | #endif // ANDROID_CUTILS_COMPILER_H 45 | -------------------------------------------------------------------------------- /include/cutils/cpu_info.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CUTILS_CPU_INFO_H 18 | #define __CUTILS_CPU_INFO_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | /* returns a string contiaining an ASCII representation of the CPU serial number, 25 | ** or NULL if cpu info not available. 26 | ** The string is a static variable, so don't call free() on it. 27 | */ 28 | extern const char* get_cpu_serial_number(void); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif /* __CUTILS_CPU_INFO_H */ 35 | -------------------------------------------------------------------------------- /include/cutils/dir_hash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | typedef enum { 18 | SHA_1, 19 | } HashAlgorithm; 20 | 21 | int get_file_hash(HashAlgorithm algorithm, const char *path, 22 | char *output_string, size_t max_output_string); 23 | 24 | int get_recursive_hash_manifest(HashAlgorithm algorithm, 25 | const char *directory_path, 26 | char **output_string); 27 | -------------------------------------------------------------------------------- /include/cutils/event_tag_map.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LIBS_CUTILS_EVENTTAGMAP_H 18 | #define _LIBS_CUTILS_EVENTTAGMAP_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | #define EVENT_TAG_MAP_FILE "/system/etc/event-log-tags" 25 | 26 | struct EventTagMap; 27 | typedef struct EventTagMap EventTagMap; 28 | 29 | /* 30 | * Open the specified file as an event log tag map. 31 | * 32 | * Returns NULL on failure. 33 | */ 34 | EventTagMap* android_openEventTagMap(const char* fileName); 35 | 36 | /* 37 | * Close the map. 38 | */ 39 | void android_closeEventTagMap(EventTagMap* map); 40 | 41 | /* 42 | * Look up a tag by index. Returns the tag string, or NULL if not found. 43 | */ 44 | const char* android_lookupEventTag(const EventTagMap* map, int tag); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | #endif /*_LIBS_CUTILS_EVENTTAGMAP_H*/ 51 | -------------------------------------------------------------------------------- /include/cutils/iosched_policy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CUTILS_IOSCHED_POLICY_H 18 | #define __CUTILS_IOSCHED_POLICY_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | typedef enum { 25 | IoSchedClass_NONE, 26 | IoSchedClass_RT, 27 | IoSchedClass_BE, 28 | IoSchedClass_IDLE, 29 | } IoSchedClass; 30 | 31 | extern int android_set_ioprio(int pid, IoSchedClass clazz, int ioprio); 32 | extern int android_get_ioprio(int pid, IoSchedClass *clazz, int *ioprio); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | 38 | #endif /* __CUTILS_IOSCHED_POLICY_H */ 39 | -------------------------------------------------------------------------------- /include/cutils/jstring.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CUTILS_STRING16_H 18 | #define __CUTILS_STRING16_H 19 | 20 | #include 21 | #include 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | typedef uint16_t char16_t; 28 | 29 | extern char * strndup16to8 (const char16_t* s, size_t n); 30 | extern size_t strnlen16to8 (const char16_t* s, size_t n); 31 | extern char * strncpy16to8 (char *dest, const char16_t*s, size_t n); 32 | 33 | extern char16_t * strdup8to16 (const char* s, size_t *out_len); 34 | extern size_t strlen8to16 (const char* utf8Str); 35 | extern char16_t * strcpy8to16 (char16_t *dest, const char*s, size_t *out_len); 36 | extern char16_t * strcpylen8to16 (char16_t *dest, const char*s, int length, 37 | size_t *out_len); 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif /* __CUTILS_STRING16_H */ 44 | -------------------------------------------------------------------------------- /include/cutils/klog.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _CUTILS_KLOG_H_ 18 | #define _CUTILS_KLOG_H_ 19 | 20 | void klog_init(void); 21 | void klog_set_level(int level); 22 | void klog_close(void); 23 | void klog_write(int level, const char *fmt, ...) 24 | __attribute__ ((format(printf, 2, 3))); 25 | 26 | #define KLOG_ERROR(tag,x...) klog_write(3, "<3>" tag ": " x) 27 | #define KLOG_WARNING(tag,x...) klog_write(4, "<4>" tag ": " x) 28 | #define KLOG_NOTICE(tag,x...) klog_write(5, "<5>" tag ": " x) 29 | #define KLOG_INFO(tag,x...) klog_write(6, "<6>" tag ": " x) 30 | #define KLOG_DEBUG(tag,x...) klog_write(7, "<7>" tag ": " x) 31 | 32 | #define KLOG_DEFAULT_LEVEL 3 /* messages <= this level are logged */ 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /include/cutils/list.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _CUTILS_LIST_H_ 18 | #define _CUTILS_LIST_H_ 19 | 20 | #include 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif /* __cplusplus */ 25 | 26 | struct listnode 27 | { 28 | struct listnode *next; 29 | struct listnode *prev; 30 | }; 31 | 32 | #define node_to_item(node, container, member) \ 33 | (container *) (((char*) (node)) - offsetof(container, member)) 34 | 35 | #define list_declare(name) \ 36 | struct listnode name = { \ 37 | .next = &name, \ 38 | .prev = &name, \ 39 | } 40 | 41 | #define list_for_each(node, list) \ 42 | for (node = (list)->next; node != (list); node = node->next) 43 | 44 | #define list_for_each_reverse(node, list) \ 45 | for (node = (list)->prev; node != (list); node = node->prev) 46 | 47 | void list_init(struct listnode *list); 48 | void list_add_tail(struct listnode *list, struct listnode *item); 49 | void list_remove(struct listnode *item); 50 | 51 | #define list_empty(list) ((list) == (list)->next) 52 | #define list_head(list) ((list)->next) 53 | #define list_tail(list) ((list)->prev) 54 | 55 | #ifdef __cplusplus 56 | }; 57 | #endif /* __cplusplus */ 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /include/cutils/logd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _ANDROID_CUTILS_LOGD_H 18 | #define _ANDROID_CUTILS_LOGD_H 19 | 20 | /* the stable/frozen log-related definitions have been 21 | * moved to this header, which is exposed by the NDK 22 | */ 23 | #include 24 | 25 | /* the rest is only used internally by the system */ 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #ifdef HAVE_PTHREADS 32 | #include 33 | #endif 34 | #include 35 | #include 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | int __android_log_bwrite(int32_t tag, const void *payload, size_t len); 42 | int __android_log_btwrite(int32_t tag, char type, const void *payload, 43 | size_t len); 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | #endif /* _LOGD_H */ 50 | -------------------------------------------------------------------------------- /include/cutils/memory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef ANDROID_CUTILS_MEMORY_H 18 | #define ANDROID_CUTILS_MEMORY_H 19 | 20 | #include 21 | #include 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | /* size is given in bytes and must be multiple of 2 */ 28 | void android_memset16(uint16_t* dst, uint16_t value, size_t size); 29 | 30 | /* size is given in bytes and must be multiple of 4 */ 31 | void android_memset32(uint32_t* dst, uint32_t value, size_t size); 32 | 33 | #if !HAVE_STRLCPY 34 | /* Declaration of strlcpy() for platforms that don't already have it. */ 35 | size_t strlcpy(char *dst, const char *src, size_t size); 36 | #endif 37 | 38 | #ifdef __cplusplus 39 | } // extern "C" 40 | #endif 41 | 42 | #endif // ANDROID_CUTILS_MEMORY_H 43 | -------------------------------------------------------------------------------- /include/cutils/misc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CUTILS_MISC_H 18 | #define __CUTILS_MISC_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | /* Load an entire file into a malloc'd chunk of memory 25 | * that is length_of_file + 1 (null terminator). If 26 | * sz is non-zero, return the size of the file via sz. 27 | * Returns 0 on failure. 28 | */ 29 | extern void *load_file(const char *fn, unsigned *sz); 30 | 31 | /* Connects your process to the system debugger daemon 32 | * so that on a crash it may be logged or interactively 33 | * debugged (depending on system settings). 34 | */ 35 | extern void debuggerd_connect(void); 36 | 37 | 38 | /* This is the range of UIDs (and GIDs) that are reserved 39 | * for assigning to applications. 40 | */ 41 | #define FIRST_APPLICATION_UID 10000 42 | #define LAST_APPLICATION_UID 99999 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif /* __CUTILS_MISC_H */ 49 | -------------------------------------------------------------------------------- /include/cutils/multiuser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CUTILS_MULTIUSER_H 18 | #define __CUTILS_MULTIUSER_H 19 | 20 | #include 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | // NOTE: keep in sync with android.os.UserId 27 | 28 | #define MULTIUSER_APP_PER_USER_RANGE 100000 29 | 30 | typedef uid_t userid_t; 31 | typedef uid_t appid_t; 32 | 33 | extern userid_t multiuser_get_user_id(uid_t uid); 34 | extern appid_t multiuser_get_app_id(uid_t uid); 35 | extern uid_t multiuser_get_uid(userid_t userId, appid_t appId); 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif /* __CUTILS_MULTIUSER_H */ 42 | -------------------------------------------------------------------------------- /include/cutils/open_memstream.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CUTILS_OPEN_MEMSTREAM_H__ 18 | #define __CUTILS_OPEN_MEMSTREAM_H__ 19 | 20 | #include 21 | 22 | #ifndef HAVE_OPEN_MEMSTREAM 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | FILE* open_memstream(char** bufp, size_t* sizep); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif /*!HAVE_OPEN_MEMSTREAM*/ 35 | 36 | #endif /*__CUTILS_OPEN_MEMSTREAM_H__*/ 37 | -------------------------------------------------------------------------------- /include/cutils/partition_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011, The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CUTILS_PARTITION_WIPED_H__ 18 | #define __CUTILS_PARTITION_WIPED_H__ 19 | 20 | __BEGIN_DECLS 21 | 22 | int partition_wiped(char *source); 23 | void erase_footer(const char *dev_path, long long size); 24 | 25 | __END_DECLS 26 | 27 | #endif /* __CUTILS_PARTITION_WIPED_H__ */ 28 | -------------------------------------------------------------------------------- /include/cutils/process_name.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * Gives the current process a name. 19 | */ 20 | 21 | #ifndef __PROCESS_NAME_H 22 | #define __PROCESS_NAME_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /** 29 | * Sets the current process name. 30 | * 31 | * Warning: This leaks a string every time you call it. Use judiciously! 32 | */ 33 | void set_process_name(const char* process_name); 34 | 35 | /** Gets the current process name. */ 36 | const char* get_process_name(void); 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif /* __PROCESS_NAME_H */ 43 | -------------------------------------------------------------------------------- /include/cutils/qsort_r_compat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * Provides a portable version of qsort_r, called qsort_r_compat, which is a 19 | * reentrant variant of qsort that passes a user data pointer to its comparator. 20 | * This implementation follows the BSD parameter convention. 21 | */ 22 | 23 | #ifndef _LIBS_CUTILS_QSORT_R_COMPAT_H 24 | #define _LIBS_CUTILS_QSORT_R_COMPAT_H 25 | 26 | #include 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | void qsort_r_compat(void* base, size_t nel, size_t width, void* thunk, 33 | int (*compar)(void*, const void* , const void* )); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | #endif // _LIBS_CUTILS_QSORT_R_COMPAT_H 40 | -------------------------------------------------------------------------------- /include/cutils/record_stream.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2006 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * A simple utility for reading fixed records out of a stream fd 19 | */ 20 | 21 | #ifndef _CUTILS_RECORD_STREAM_H 22 | #define _CUTILS_RECORD_STREAM_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | 29 | typedef struct RecordStream RecordStream; 30 | 31 | extern RecordStream *record_stream_new(int fd, size_t maxRecordLen); 32 | extern void record_stream_free(RecordStream *p_rs); 33 | 34 | extern int record_stream_get_next (RecordStream *p_rs, void ** p_outRecord, 35 | size_t *p_outRecordLen); 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | 42 | #endif /*_CUTILS_RECORD_STREAM_H*/ 43 | 44 | -------------------------------------------------------------------------------- /include/cutils/uevent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CUTILS_UEVENT_H 18 | #define __CUTILS_UEVENT_H 19 | 20 | #include 21 | #include 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | int uevent_open_socket(int buf_sz, bool passcred); 28 | ssize_t uevent_kernel_multicast_recv(int socket, void *buffer, size_t length); 29 | ssize_t uevent_kernel_multicast_uid_recv(int socket, void *buffer, size_t length, uid_t *uid); 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif /* __CUTILS_UEVENT_H */ 36 | -------------------------------------------------------------------------------- /include/cutils/uio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // 18 | // implementation of sys/uio.h for platforms that don't have it (Win32) 19 | // 20 | #ifndef _LIBS_CUTILS_UIO_H 21 | #define _LIBS_CUTILS_UIO_H 22 | 23 | #ifdef HAVE_SYS_UIO_H 24 | #include 25 | #else 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | #include 32 | 33 | struct iovec { 34 | const void* iov_base; 35 | size_t iov_len; 36 | }; 37 | 38 | extern int readv( int fd, struct iovec* vecs, int count ); 39 | extern int writev( int fd, const struct iovec* vecs, int count ); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif /* !HAVE_SYS_UIO_H */ 46 | 47 | #endif /* _LIBS_UTILS_UIO_H */ 48 | 49 | -------------------------------------------------------------------------------- /include/cutils/zygote.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CUTILS_ZYGOTE_H 18 | #define __CUTILS_ZYGOTE_H 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | int zygote_run_oneshot(int sendStdio, int argc, const char **argv); 25 | int zygote_run(int argc, const char **argv); 26 | int zygote_run_wait(int argc, const char **argv, void (*post_run_func)(int)); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | 32 | #endif /* __CUTILS_ZYGOTE_H */ 33 | -------------------------------------------------------------------------------- /include/ion/ion.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ion.c 3 | * 4 | * Memory Allocator functions for ion 5 | * 6 | * Copyright 2011 Google, Inc 7 | * 8 | * Licensed under the Apache License, Version 2.0 (the "License"); 9 | * you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | #ifndef __SYS_CORE_ION_H 22 | #define __SYS_CORE_ION_H 23 | 24 | #include 25 | 26 | __BEGIN_DECLS 27 | 28 | int ion_open(); 29 | int ion_close(int fd); 30 | int ion_alloc(int fd, size_t len, size_t align, unsigned int heap_mask, 31 | unsigned int flags, struct ion_handle **handle); 32 | int ion_alloc_fd(int fd, size_t len, size_t align, unsigned int heap_mask, 33 | unsigned int flags, int *handle_fd); 34 | int ion_sync_fd(int fd, int handle_fd); 35 | int ion_free(int fd, struct ion_handle *handle); 36 | int ion_map(int fd, struct ion_handle *handle, size_t length, int prot, 37 | int flags, off_t offset, unsigned char **ptr, int *map_fd); 38 | int ion_share(int fd, struct ion_handle *handle, int *share_fd); 39 | int ion_import(int fd, int share_fd, struct ion_handle **handle); 40 | 41 | __END_DECLS 42 | 43 | #endif /* __SYS_CORE_ION_H */ 44 | -------------------------------------------------------------------------------- /include/netutils/dhcp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010, The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _NETUTILS_DHCP_H_ 18 | #define _NETUTILS_DHCP_H_ 19 | 20 | #include 21 | #include 22 | 23 | __BEGIN_DECLS 24 | 25 | extern int do_dhcp(char *iname); 26 | extern int dhcp_do_request(const char *ifname, 27 | char *ipaddr, 28 | char *gateway, 29 | uint32_t *prefixLength, 30 | char *dns1, 31 | char *dns2, 32 | char *server, 33 | uint32_t *lease, 34 | char *vendorInfo); 35 | extern int dhcp_stop(const char *ifname); 36 | extern int dhcp_release_lease(const char *ifname); 37 | extern char *dhcp_get_errmsg(); 38 | 39 | __END_DECLS 40 | 41 | #endif /* _NETUTILS_DHCP_H_ */ 42 | -------------------------------------------------------------------------------- /include/sysutils/FrameworkClient.h: -------------------------------------------------------------------------------- 1 | #ifndef _FRAMEWORK_CLIENT_H 2 | #define _FRAMEWORK_CLIENT_H 3 | 4 | #include "List.h" 5 | 6 | #include 7 | 8 | class FrameworkClient { 9 | int mSocket; 10 | pthread_mutex_t mWriteMutex; 11 | 12 | public: 13 | FrameworkClient(int sock); 14 | virtual ~FrameworkClient() {} 15 | 16 | int sendMsg(const char *msg); 17 | int sendMsg(const char *msg, const char *data); 18 | }; 19 | 20 | typedef android::sysutils::List FrameworkClientCollection; 21 | #endif 22 | -------------------------------------------------------------------------------- /include/sysutils/FrameworkCommand.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef __FRAMEWORK_CMD_HANDLER_H 17 | #define __FRAMEWORK_CMD_HANDLER_H 18 | 19 | #include "List.h" 20 | 21 | class SocketClient; 22 | 23 | class FrameworkCommand { 24 | private: 25 | const char *mCommand; 26 | 27 | public: 28 | 29 | FrameworkCommand(const char *cmd); 30 | virtual ~FrameworkCommand() { } 31 | 32 | virtual int runCommand(SocketClient *c, int argc, char **argv) = 0; 33 | 34 | const char *getCommand() { return mCommand; } 35 | }; 36 | 37 | typedef android::sysutils::List FrameworkCommandCollection; 38 | #endif 39 | -------------------------------------------------------------------------------- /include/sysutils/FrameworkListener.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef _FRAMEWORKSOCKETLISTENER_H 17 | #define _FRAMEWORKSOCKETLISTENER_H 18 | 19 | #include "SocketListener.h" 20 | #include "FrameworkCommand.h" 21 | 22 | class SocketClient; 23 | 24 | class FrameworkListener : public SocketListener { 25 | public: 26 | static const int CMD_ARGS_MAX = 26; 27 | 28 | /* 1 out of errorRate will be dropped */ 29 | int errorRate; 30 | 31 | private: 32 | int mCommandCount; 33 | bool mWithSeq; 34 | FrameworkCommandCollection *mCommands; 35 | 36 | public: 37 | FrameworkListener(const char *socketName); 38 | FrameworkListener(const char *socketName, bool withSeq); 39 | virtual ~FrameworkListener() {} 40 | 41 | protected: 42 | void registerCmd(FrameworkCommand *cmd); 43 | virtual bool onDataAvailable(SocketClient *c); 44 | 45 | private: 46 | void dispatchCommand(SocketClient *c, char *data); 47 | void init(const char *socketName, bool withSeq); 48 | }; 49 | #endif 50 | -------------------------------------------------------------------------------- /include/sysutils/NetlinkEvent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef _NETLINKEVENT_H 17 | #define _NETLINKEVENT_H 18 | 19 | #include 20 | 21 | #define NL_PARAMS_MAX 32 22 | 23 | class NetlinkEvent { 24 | int mSeq; 25 | char *mPath; 26 | int mAction; 27 | char *mSubsystem; 28 | char *mParams[NL_PARAMS_MAX]; 29 | 30 | public: 31 | const static int NlActionUnknown; 32 | const static int NlActionAdd; 33 | const static int NlActionRemove; 34 | const static int NlActionChange; 35 | const static int NlActionLinkDown; 36 | const static int NlActionLinkUp; 37 | 38 | NetlinkEvent(); 39 | virtual ~NetlinkEvent(); 40 | 41 | bool decode(char *buffer, int size, int format = NetlinkListener::NETLINK_FORMAT_ASCII); 42 | const char *findParam(const char *paramName); 43 | 44 | const char *getSubsystem() { return mSubsystem; } 45 | int getAction() { return mAction; } 46 | 47 | void dump(); 48 | 49 | protected: 50 | bool parseBinaryNetlinkMessage(char *buffer, int size); 51 | bool parseAsciiNetlinkMessage(char *buffer, int size); 52 | }; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /include/sysutils/NetlinkListener.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef _NETLINKLISTENER_H 17 | #define _NETLINKLISTENER_H 18 | 19 | #include "SocketListener.h" 20 | 21 | class NetlinkEvent; 22 | 23 | class NetlinkListener : public SocketListener { 24 | char mBuffer[64 * 1024]; 25 | int mFormat; 26 | 27 | public: 28 | static const int NETLINK_FORMAT_ASCII = 0; 29 | static const int NETLINK_FORMAT_BINARY = 1; 30 | 31 | #if 1 32 | /* temporary version until we can get Motorola to update their 33 | * ril.so. Their prebuilt ril.so is using this private class 34 | * so changing the NetlinkListener() constructor breaks their ril. 35 | */ 36 | NetlinkListener(int socket); 37 | NetlinkListener(int socket, int format); 38 | #else 39 | NetlinkListener(int socket, int format = NETLINK_FORMAT_ASCII); 40 | #endif 41 | virtual ~NetlinkListener() {} 42 | 43 | protected: 44 | virtual bool onDataAvailable(SocketClient *cli); 45 | virtual void onEvent(NetlinkEvent *evt) = 0; 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /include/sysutils/ServiceManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _SERVICE_MANAGER_H 18 | #define _SERVICE_MANAGER_H 19 | 20 | class ServiceManager { 21 | public: 22 | ServiceManager(); 23 | virtual ~ServiceManager() {} 24 | 25 | int start(const char *name); 26 | int stop(const char *name); 27 | bool isRunning(const char *name); 28 | }; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /init/Android.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2005 The Android Open Source Project 2 | 3 | LOCAL_PATH:= $(call my-dir) 4 | include $(CLEAR_VARS) 5 | 6 | LOCAL_SRC_FILES:= \ 7 | builtins.c \ 8 | init.c \ 9 | devices.c \ 10 | property_service.c \ 11 | util.c \ 12 | parser.c \ 13 | logo.c \ 14 | keychords.c \ 15 | signal_handler.c \ 16 | init_parser.c \ 17 | ueventd.c \ 18 | ueventd_parser.c \ 19 | watchdogd.c 20 | 21 | ifeq ($(strip $(INIT_BOOTCHART)),true) 22 | LOCAL_SRC_FILES += bootchart.c 23 | LOCAL_CFLAGS += -DBOOTCHART=1 24 | endif 25 | 26 | ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) 27 | LOCAL_CFLAGS += -DALLOW_LOCAL_PROP_OVERRIDE=1 28 | endif 29 | 30 | LOCAL_MODULE:= init 31 | 32 | LOCAL_FORCE_STATIC_EXECUTABLE := true 33 | LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) 34 | LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED) 35 | 36 | LOCAL_STATIC_LIBRARIES := \ 37 | libfs_mgr \ 38 | libcutils \ 39 | libc \ 40 | libselinux 41 | 42 | include $(BUILD_EXECUTABLE) 43 | 44 | # Make a symlink from /sbin/ueventd and /sbin/watchdogd to /init 45 | SYMLINKS := \ 46 | $(TARGET_ROOT_OUT)/sbin/ueventd \ 47 | $(TARGET_ROOT_OUT)/sbin/watchdogd 48 | 49 | $(SYMLINKS): INIT_BINARY := $(LOCAL_MODULE) 50 | $(SYMLINKS): $(LOCAL_INSTALLED_MODULE) $(LOCAL_PATH)/Android.mk 51 | @echo "Symlink: $@ -> ../$(INIT_BINARY)" 52 | @mkdir -p $(dir $@) 53 | @rm -rf $@ 54 | $(hide) ln -sf ../$(INIT_BINARY) $@ 55 | 56 | ALL_DEFAULT_INSTALLED_MODULES += $(SYMLINKS) 57 | 58 | # We need this so that the installed files could be picked up based on the 59 | # local module name 60 | ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \ 61 | $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(SYMLINKS) 62 | -------------------------------------------------------------------------------- /init/MODULE_LICENSE_APACHE2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chainfire/platform_system_core/f3600a1c929744ec5e91c7a1baa0dabaeeab1028/init/MODULE_LICENSE_APACHE2 -------------------------------------------------------------------------------- /init/bootchart.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _BOOTCHART_H 18 | #define _BOOTCHART_H 19 | 20 | #ifndef BOOTCHART 21 | # define BOOTCHART 0 22 | #endif 23 | 24 | #if BOOTCHART 25 | 26 | extern int bootchart_init(void); 27 | extern int bootchart_step(void); 28 | extern void bootchart_finish(void); 29 | 30 | # define BOOTCHART_POLLING_MS 200 /* polling period in ms */ 31 | # define BOOTCHART_DEFAULT_TIME_SEC (2*60) /* default polling time in seconds */ 32 | # define BOOTCHART_MAX_TIME_SEC (10*60) /* max polling time in seconds */ 33 | 34 | #endif /* BOOTCHART */ 35 | 36 | #endif /* _BOOTCHART_H */ 37 | -------------------------------------------------------------------------------- /init/devices.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _INIT_DEVICES_H 18 | #define _INIT_DEVICES_H 19 | 20 | #include 21 | 22 | extern void handle_device_fd(); 23 | extern void device_init(void); 24 | extern int add_dev_perms(const char *name, const char *attr, 25 | mode_t perm, unsigned int uid, 26 | unsigned int gid, unsigned short prefix); 27 | int get_device_fd(); 28 | #endif /* _INIT_DEVICES_H */ 29 | -------------------------------------------------------------------------------- /init/grab-bootchart.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # this script is used to retrieve the bootchart log generated 4 | # by init when compiled with INIT_BOOTCHART=true. 5 | # 6 | # for all details, see //device/system/init/README.BOOTCHART 7 | # 8 | TMPDIR=/tmp/android-bootchart 9 | rm -rf $TMPDIR 10 | mkdir -p $TMPDIR 11 | 12 | LOGROOT=/data/bootchart 13 | TARBALL=bootchart.tgz 14 | 15 | FILES="header proc_stat.log proc_ps.log proc_diskstats.log kernel_pacct" 16 | 17 | for f in $FILES; do 18 | adb pull $LOGROOT/$f $TMPDIR/$f 2>&1 > /dev/null 19 | done 20 | (cd $TMPDIR && tar -czf $TARBALL $FILES) 21 | cp -f $TMPDIR/$TARBALL ./$TARBALL 22 | echo "look at $TARBALL" 23 | -------------------------------------------------------------------------------- /init/init_parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _INIT_INIT_PARSER_H_ 18 | #define _INIT_INIT_PARSER_H_ 19 | 20 | #define INIT_PARSER_MAXARGS 64 21 | 22 | struct action; 23 | 24 | struct action *action_remove_queue_head(void); 25 | void action_add_queue_tail(struct action *act); 26 | void action_for_each_trigger(const char *trigger, 27 | void (*func)(struct action *act)); 28 | int action_queue_empty(void); 29 | void queue_property_triggers(const char *name, const char *value); 30 | void queue_all_property_triggers(); 31 | void queue_builtin_action(int (*func)(int nargs, char **args), char *name); 32 | 33 | int init_parse_config_file(const char *fn); 34 | int expand_props(char *dst, const char *src, int len); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /init/keychords.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _INIT_KEYCHORDS_H_ 18 | #define _INIT_KEYCHORDS_H_ 19 | 20 | struct service; 21 | 22 | void add_service_keycodes(struct service *svc); 23 | void keychord_init(void); 24 | void handle_keychord(void); 25 | int get_keychord_fd(void); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /init/log.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _INIT_LOG_H_ 18 | #define _INIT_LOG_H_ 19 | 20 | #include 21 | 22 | #define ERROR(x...) KLOG_ERROR("init", x) 23 | #define NOTICE(x...) KLOG_NOTICE("init", x) 24 | #define INFO(x...) KLOG_INFO("init", x) 25 | 26 | #define LOG_UEVENTS 0 /* log uevent messages if 1. verbose */ 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /init/parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef PARSER_H_ 18 | #define PARSER_H_ 19 | 20 | #define T_EOF 0 21 | #define T_TEXT 1 22 | #define T_NEWLINE 2 23 | 24 | struct parse_state 25 | { 26 | char *ptr; 27 | char *text; 28 | int line; 29 | int nexttoken; 30 | void *context; 31 | void (*parse_line)(struct parse_state *state, int nargs, char **args); 32 | const char *filename; 33 | void *priv; 34 | }; 35 | 36 | int lookup_keyword(const char *s); 37 | void DUMP(void); 38 | int next_token(struct parse_state *state); 39 | void parse_error(struct parse_state *state, const char *fmt, ...); 40 | 41 | #endif /* PARSER_H_ */ 42 | -------------------------------------------------------------------------------- /init/property_service.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _INIT_PROPERTY_H 18 | #define _INIT_PROPERTY_H 19 | 20 | #include 21 | 22 | extern void handle_property_set_fd(void); 23 | extern void property_init(void); 24 | extern void property_load_boot_defaults(void); 25 | extern void load_persist_props(void); 26 | extern void start_property_service(void); 27 | void get_property_workspace(int *fd, int *sz); 28 | extern const char* property_get(const char *name); 29 | extern int property_set(const char *name, const char *value); 30 | extern int properties_inited(); 31 | int get_property_set_fd(void); 32 | 33 | #endif /* _INIT_PROPERTY_H */ 34 | -------------------------------------------------------------------------------- /init/signal_handler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _INIT_SIGNAL_HANDLER_H_ 18 | #define _INIT_SIGNAL_HANDLER_H_ 19 | 20 | void signal_init(void); 21 | void handle_signal(void); 22 | int get_signal_fd(void); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /init/ueventd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _INIT_UEVENTD_H_ 18 | #define _INIT_UEVENTD_H_ 19 | 20 | int ueventd_main(int argc, char **argv); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /init/ueventd_parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _INIT_UEVENTD_PARSER_H_ 18 | #define _INIT_UEVENTD_PARSER_H_ 19 | 20 | #define UEVENTD_PARSER_MAXARGS 5 21 | 22 | int ueventd_parse_config_file(const char *fn); 23 | void set_device_permission(int nargs, char **args); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /init/util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _INIT_UTIL_H_ 18 | #define _INIT_UTIL_H_ 19 | 20 | #include 21 | #include 22 | 23 | #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) 24 | 25 | static const char *coldboot_done = "/dev/.coldboot_done"; 26 | 27 | int mtd_name_to_number(const char *name); 28 | int create_socket(const char *name, int type, mode_t perm, 29 | uid_t uid, gid_t gid); 30 | void *read_file(const char *fn, unsigned *_sz); 31 | time_t gettime(void); 32 | unsigned int decode_uid(const char *s); 33 | 34 | int mkdir_recursive(const char *pathname, mode_t mode); 35 | void sanitize(char *p); 36 | void make_link(const char *oldpath, const char *newpath); 37 | void remove_link(const char *oldpath, const char *newpath); 38 | int wait_for_file(const char *filename, int timeout); 39 | void open_devnull_stdio(void); 40 | void get_hardware_name(char *hardware, unsigned int *revision); 41 | void import_kernel_cmdline(int in_qemu, void (*import_kernel_nv)(char *name, int in_qemu)); 42 | int make_dir(const char *path, mode_t mode); 43 | int restorecon(const char *pathname); 44 | #endif 45 | -------------------------------------------------------------------------------- /init/watchdogd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _INIT_WATCHDOGD_H_ 18 | #define _INIT_WATCHDOGD_H_ 19 | 20 | int watchdogd_main(int argc, char **argv); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /libcorkscrew/MODULE_LICENSE_APACHE2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chainfire/platform_system_core/f3600a1c929744ec5e91c7a1baa0dabaeeab1028/libcorkscrew/MODULE_LICENSE_APACHE2 -------------------------------------------------------------------------------- /libcorkscrew/arch-mips/ptrace-mips.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #define LOG_TAG "Corkscrew" 18 | //#define LOG_NDEBUG 0 19 | 20 | #include "../ptrace-arch.h" 21 | 22 | #include 23 | 24 | void load_ptrace_map_info_data_arch(pid_t pid, map_info_t* mi, map_info_data_t* data) { 25 | } 26 | 27 | void free_ptrace_map_info_data_arch(map_info_t* mi, map_info_data_t* data) { 28 | } 29 | -------------------------------------------------------------------------------- /libcorkscrew/arch-x86/ptrace-x86.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #define LOG_TAG "Corkscrew" 18 | //#define LOG_NDEBUG 0 19 | 20 | #include "../ptrace-arch.h" 21 | 22 | #include 23 | 24 | void load_ptrace_map_info_data_arch(pid_t pid __attribute__((unused)), 25 | map_info_t* mi __attribute__((unused)), 26 | map_info_data_t* data __attribute__((unused))) { 27 | } 28 | 29 | void free_ptrace_map_info_data_arch(map_info_t* mi __attribute__((unused)), 30 | map_info_data_t* data __attribute__((unused))) { 31 | } 32 | -------------------------------------------------------------------------------- /libcorkscrew/backtrace-arch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* Architecture dependent functions. */ 18 | 19 | #ifndef _CORKSCREW_BACKTRACE_ARCH_H 20 | #define _CORKSCREW_BACKTRACE_ARCH_H 21 | 22 | #include "ptrace-arch.h" 23 | #include 24 | 25 | #include 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Rewind the program counter by one instruction. */ 32 | uintptr_t rewind_pc_arch(const memory_t* memory, uintptr_t pc); 33 | 34 | ssize_t unwind_backtrace_signal_arch(siginfo_t* siginfo, void* sigcontext, 35 | const map_info_t* map_info_list, 36 | backtrace_frame_t* backtrace, size_t ignore_depth, size_t max_depth); 37 | 38 | ssize_t unwind_backtrace_ptrace_arch(pid_t tid, const ptrace_context_t* context, 39 | backtrace_frame_t* backtrace, size_t ignore_depth, size_t max_depth); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif // _CORKSCREW_BACKTRACE_ARCH_H 46 | -------------------------------------------------------------------------------- /libcorkscrew/backtrace-helper.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #define LOG_TAG "Corkscrew" 18 | //#define LOG_NDEBUG 0 19 | 20 | #include "backtrace-helper.h" 21 | 22 | #include 23 | 24 | backtrace_frame_t* add_backtrace_entry(uintptr_t pc, backtrace_frame_t* backtrace, 25 | size_t ignore_depth, size_t max_depth, 26 | size_t* ignored_frames, size_t* returned_frames) { 27 | if (*ignored_frames < ignore_depth) { 28 | *ignored_frames += 1; 29 | return NULL; 30 | } 31 | if (*returned_frames >= max_depth) { 32 | return NULL; 33 | } 34 | backtrace_frame_t* frame = &backtrace[*returned_frames]; 35 | frame->absolute_pc = pc; 36 | frame->stack_top = 0; 37 | frame->stack_size = 0; 38 | *returned_frames += 1; 39 | return frame; 40 | } 41 | -------------------------------------------------------------------------------- /libcorkscrew/backtrace-helper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* Backtrace helper functions. */ 18 | 19 | #ifndef _CORKSCREW_BACKTRACE_HELPER_H 20 | #define _CORKSCREW_BACKTRACE_HELPER_H 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* 31 | * Add a program counter to a backtrace if it will fit. 32 | * Returns the newly added frame, or NULL if none. 33 | */ 34 | backtrace_frame_t* add_backtrace_entry(uintptr_t pc, 35 | backtrace_frame_t* backtrace, 36 | size_t ignore_depth, size_t max_depth, 37 | size_t* ignored_frames, size_t* returned_frames); 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif // _CORKSCREW_BACKTRACE_HELPER_H 44 | -------------------------------------------------------------------------------- /libcorkscrew/demangle.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #define LOG_TAG "Corkscrew" 18 | //#define LOG_NDEBUG 0 19 | 20 | #include 21 | 22 | #include 23 | 24 | extern char *__cxa_demangle (const char *mangled, char *buf, size_t *len, 25 | int *status); 26 | 27 | char* demangle_symbol_name(const char* name) { 28 | // __cxa_demangle handles NULL by returning NULL 29 | return __cxa_demangle(name, 0, 0, 0); 30 | } 31 | -------------------------------------------------------------------------------- /libcorkscrew/ptrace-arch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* Architecture dependent functions. */ 18 | 19 | #ifndef _CORKSCREW_PTRACE_ARCH_H 20 | #define _CORKSCREW_PTRACE_ARCH_H 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Custom extra data we stuff into map_info_t structures as part 31 | * of our ptrace_context_t. */ 32 | typedef struct { 33 | #ifdef __arm__ 34 | uintptr_t exidx_start; 35 | size_t exidx_size; 36 | #endif 37 | symbol_table_t* symbol_table; 38 | } map_info_data_t; 39 | 40 | void load_ptrace_map_info_data_arch(pid_t pid, map_info_t* mi, map_info_data_t* data); 41 | void free_ptrace_map_info_data_arch(map_info_t* mi, map_info_data_t* data); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif // _CORKSCREW_PTRACE_ARCH_H 48 | -------------------------------------------------------------------------------- /libctest/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_MODULE:= libctest 5 | LOCAL_SRC_FILES := ctest.c 6 | 7 | include $(BUILD_SHARED_LIBRARY) 8 | -------------------------------------------------------------------------------- /libcutils/MODULE_LICENSE_APACHE2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chainfire/platform_system_core/f3600a1c929744ec5e91c7a1baa0dabaeeab1028/libcutils/MODULE_LICENSE_APACHE2 -------------------------------------------------------------------------------- /libcutils/arch-x86/android_memset16.S: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /* 17 | * Contributed by: Intel Corporation 18 | */ 19 | 20 | #if defined(USE_SSE2) 21 | 22 | # include "cache_wrapper.S" 23 | # undef __i686 24 | # define USE_AS_ANDROID 25 | # define sse2_memset16_atom android_memset16 26 | # include "sse2-memset16-atom.S" 27 | 28 | #else 29 | 30 | # include "memset16.S" 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /libcutils/arch-x86/android_memset32.S: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /* 17 | * Contributed by: Intel Corporation 18 | */ 19 | 20 | #if defined(USE_SSE2) 21 | 22 | # include "cache_wrapper.S" 23 | # undef __i686 24 | # define USE_AS_ANDROID 25 | # define sse2_memset32_atom android_memset32 26 | # include "sse2-memset32-atom.S" 27 | 28 | #else 29 | 30 | # include "memset32.S" 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /libcutils/arch-x86/cache_wrapper.S: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /* 17 | * Contributed by: Intel Corporation 18 | */ 19 | 20 | /* Values are optimized for Atom */ 21 | #define SHARED_CACHE_SIZE (512*1024) /* Atom L2 Cache */ 22 | #define DATA_CACHE_SIZE (24*1024) /* Atom L1 Data Cache */ 23 | #define SHARED_CACHE_SIZE_HALF (SHARED_CACHE_SIZE / 2) 24 | #define DATA_CACHE_SIZE_HALF (DATA_CACHE_SIZE / 2) 25 | -------------------------------------------------------------------------------- /libcutils/atomic.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #define ANDROID_ATOMIC_INLINE 18 | 19 | #include 20 | -------------------------------------------------------------------------------- /libcutils/dlmalloc_stubs.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "../../../bionic/libc/bionic/dlmalloc.h" 18 | #include "cutils/log.h" 19 | 20 | /* 21 | * Stubs for functions defined in bionic/libc/bionic/dlmalloc.c. These 22 | * are used in host builds, as the host libc will not contain these 23 | * functions. 24 | */ 25 | void dlmalloc_inspect_all(void(*handler)(void*, void *, size_t, void*), 26 | void* arg) 27 | { 28 | ALOGW("Called host unimplemented stub: dlmalloc_inspect_all"); 29 | } 30 | 31 | int dlmalloc_trim(size_t unused) 32 | { 33 | ALOGW("Called host unimplemented stub: dlmalloc_trim"); 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /libcutils/iosched_policy.c: -------------------------------------------------------------------------------- 1 | 2 | /* libs/cutils/iosched_policy.c 3 | ** 4 | ** Copyright 2007, The Android Open Source Project 5 | ** 6 | ** Licensed under the Apache License, Version 2.0 (the "License"); 7 | ** you may not use this file except in compliance with the License. 8 | ** You may obtain a copy of the License at 9 | ** 10 | ** http://www.apache.org/licenses/LICENSE-2.0 11 | ** 12 | ** Unless required by applicable law or agreed to in writing, software 13 | ** distributed under the License is distributed on an "AS IS" BASIS, 14 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | ** See the License for the specific language governing permissions and 16 | ** limitations under the License. 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #ifdef HAVE_SCHED_H 27 | 28 | #include 29 | 30 | extern int ioprio_set(int which, int who, int ioprio); 31 | 32 | enum { 33 | WHO_PROCESS = 1, 34 | WHO_PGRP, 35 | WHO_USER, 36 | }; 37 | 38 | #define CLASS_SHIFT 13 39 | #define IOPRIO_NORM 4 40 | 41 | int android_set_ioprio(int pid, IoSchedClass clazz, int ioprio) { 42 | #ifdef HAVE_ANDROID_OS 43 | if (ioprio_set(WHO_PROCESS, pid, ioprio | (clazz << CLASS_SHIFT))) { 44 | return -1; 45 | } 46 | #endif 47 | return 0; 48 | } 49 | 50 | int android_get_ioprio(int pid, IoSchedClass *clazz, int *ioprio) { 51 | #ifdef HAVE_ANDROID_OS 52 | int rc; 53 | 54 | if ((rc = ioprio_get(WHO_PROCESS, pid)) < 0) { 55 | return -1; 56 | } 57 | 58 | *clazz = (rc >> CLASS_SHIFT); 59 | *ioprio = (rc & 0xff); 60 | #else 61 | *clazz = IoSchedClass_NONE; 62 | *ioprio = 0; 63 | #endif 64 | return 0; 65 | } 66 | 67 | #endif /* HAVE_SCHED_H */ 68 | -------------------------------------------------------------------------------- /libcutils/klog.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #include 27 | 28 | static int klog_fd = -1; 29 | static int klog_level = KLOG_DEFAULT_LEVEL; 30 | 31 | void klog_set_level(int level) { 32 | klog_level = level; 33 | } 34 | 35 | void klog_init(void) 36 | { 37 | static const char *name = "/dev/__kmsg__"; 38 | if (mknod(name, S_IFCHR | 0600, (1 << 8) | 11) == 0) { 39 | klog_fd = open(name, O_WRONLY); 40 | fcntl(klog_fd, F_SETFD, FD_CLOEXEC); 41 | unlink(name); 42 | } 43 | } 44 | 45 | #define LOG_BUF_MAX 512 46 | 47 | void klog_write(int level, const char *fmt, ...) 48 | { 49 | char buf[LOG_BUF_MAX]; 50 | va_list ap; 51 | 52 | if (level > klog_level) return; 53 | if (klog_fd < 0) return; 54 | 55 | va_start(ap, fmt); 56 | vsnprintf(buf, LOG_BUF_MAX, fmt, ap); 57 | buf[LOG_BUF_MAX - 1] = 0; 58 | va_end(ap); 59 | write(klog_fd, buf, strlen(buf)); 60 | } 61 | -------------------------------------------------------------------------------- /libcutils/list.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | void list_init(struct listnode *node) 20 | { 21 | node->next = node; 22 | node->prev = node; 23 | } 24 | 25 | void list_add_tail(struct listnode *head, struct listnode *item) 26 | { 27 | item->next = head; 28 | item->prev = head->prev; 29 | head->prev->next = item; 30 | head->prev = item; 31 | } 32 | 33 | void list_remove(struct listnode *item) 34 | { 35 | item->next->prev = item->prev; 36 | item->prev->next = item->next; 37 | } 38 | -------------------------------------------------------------------------------- /libcutils/load_file.c: -------------------------------------------------------------------------------- 1 | /* libs/cutils/load_file.c 2 | ** 3 | ** Copyright 2006, The Android Open Source Project 4 | ** 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); 6 | ** you may not use this file except in compliance with the License. 7 | ** You may obtain a copy of the License at 8 | ** 9 | ** http://www.apache.org/licenses/LICENSE-2.0 10 | ** 11 | ** Unless required by applicable law or agreed to in writing, software 12 | ** distributed under the License is distributed on an "AS IS" BASIS, 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ** See the License for the specific language governing permissions and 15 | ** limitations under the License. 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | void *load_file(const char *fn, unsigned *_sz) 23 | { 24 | char *data; 25 | int sz; 26 | int fd; 27 | 28 | data = 0; 29 | fd = open(fn, O_RDONLY); 30 | if(fd < 0) return 0; 31 | 32 | sz = lseek(fd, 0, SEEK_END); 33 | if(sz < 0) goto oops; 34 | 35 | if(lseek(fd, 0, SEEK_SET) != 0) goto oops; 36 | 37 | data = (char*) malloc(sz + 1); 38 | if(data == 0) goto oops; 39 | 40 | if(read(fd, data, sz) != sz) goto oops; 41 | close(fd); 42 | data[sz] = 0; 43 | 44 | if(_sz) *_sz = sz; 45 | return data; 46 | 47 | oops: 48 | close(fd); 49 | if(data != 0) free(data); 50 | return 0; 51 | } 52 | -------------------------------------------------------------------------------- /libcutils/loghack.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * This is a temporary hack to enable logging from cutils. 19 | */ 20 | 21 | #ifndef _CUTILS_LOGHACK_H 22 | #define _CUTILS_LOGHACK_H 23 | 24 | #ifdef HAVE_ANDROID_OS 25 | #include 26 | #else 27 | #include 28 | #define ALOG(level, ...) \ 29 | ((void)printf("cutils:" level "/" LOG_TAG ": " __VA_ARGS__)) 30 | #define ALOGV(...) ALOG("V", __VA_ARGS__) 31 | #define ALOGD(...) ALOG("D", __VA_ARGS__) 32 | #define ALOGI(...) ALOG("I", __VA_ARGS__) 33 | #define ALOGW(...) ALOG("W", __VA_ARGS__) 34 | #define ALOGE(...) ALOG("E", __VA_ARGS__) 35 | #define LOG_ALWAYS_FATAL(...) do { ALOGE(__VA_ARGS__); exit(1); } while (0) 36 | #endif 37 | 38 | #endif // _CUTILS_LOGHACK_H 39 | -------------------------------------------------------------------------------- /libcutils/multiuser.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | userid_t multiuser_get_user_id(uid_t uid) { 20 | return uid / MULTIUSER_APP_PER_USER_RANGE; 21 | } 22 | 23 | appid_t multiuser_get_app_id(uid_t uid) { 24 | return uid % MULTIUSER_APP_PER_USER_RANGE; 25 | } 26 | 27 | uid_t multiuser_get_uid(userid_t userId, appid_t appId) { 28 | return userId * MULTIUSER_APP_PER_USER_RANGE + (appId % MULTIUSER_APP_PER_USER_RANGE); 29 | } 30 | -------------------------------------------------------------------------------- /libcutils/native_handle.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #define LOG_TAG "NativeHandle" 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #include 26 | #include 27 | 28 | native_handle_t* native_handle_create(int numFds, int numInts) 29 | { 30 | native_handle_t* h = malloc( 31 | sizeof(native_handle_t) + sizeof(int)*(numFds+numInts)); 32 | 33 | h->version = sizeof(native_handle_t); 34 | h->numFds = numFds; 35 | h->numInts = numInts; 36 | return h; 37 | } 38 | 39 | int native_handle_delete(native_handle_t* h) 40 | { 41 | if (h) { 42 | if (h->version != sizeof(native_handle_t)) 43 | return -EINVAL; 44 | free(h); 45 | } 46 | return 0; 47 | } 48 | 49 | int native_handle_close(const native_handle_t* h) 50 | { 51 | if (h->version != sizeof(native_handle_t)) 52 | return -EINVAL; 53 | 54 | const int numFds = h->numFds; 55 | int i; 56 | for (i=0 ; idata[i]); 58 | } 59 | return 0; 60 | } 61 | -------------------------------------------------------------------------------- /libcutils/partition_utils.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011, The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include /* for BLKGETSIZE */ 23 | #include 24 | 25 | static int only_one_char(char *buf, int len, char c) 26 | { 27 | int i, ret; 28 | 29 | ret = 1; 30 | for (i=0; iANDROID_SOCKET_NAMESPACE_ABSTRACT, 27 | * ANDROID_SOCKET_NAMESPACE_RESERVED, or 28 | * ANDROID_SOCKET_NAMESPACE_FILESYSTEM. Upon success, 29 | * the pointed at sockaddr_un is filled in and the pointed at 30 | * socklen_t is set to indicate the final length. This function 31 | * will fail if the namespace is invalid (not one of the indicated 32 | * constants) or if the name is too long. 33 | * 34 | * @return 0 on success or -1 on failure 35 | */ 36 | int socket_make_sockaddr_un(const char *name, int namespaceId, 37 | struct sockaddr_un *p_addr, socklen_t *alen); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /libcutils/socket_loopback_client.c: -------------------------------------------------------------------------------- 1 | /* libs/cutils/socket_loopback_client.c 2 | ** 3 | ** Copyright 2006, The Android Open Source Project 4 | ** 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); 6 | ** you may not use this file except in compliance with the License. 7 | ** You may obtain a copy of the License at 8 | ** 9 | ** http://www.apache.org/licenses/LICENSE-2.0 10 | ** 11 | ** Unless required by applicable law or agreed to in writing, software 12 | ** distributed under the License is distributed on an "AS IS" BASIS, 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ** See the License for the specific language governing permissions and 15 | ** limitations under the License. 16 | */ 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #ifndef HAVE_WINSOCK 27 | #include 28 | #include 29 | #include 30 | #include 31 | #endif 32 | 33 | /* Connect to port on the loopback IP interface. type is 34 | * SOCK_STREAM or SOCK_DGRAM. 35 | * return is a file descriptor or -1 on error 36 | */ 37 | int socket_loopback_client(int port, int type) 38 | { 39 | struct sockaddr_in addr; 40 | socklen_t alen; 41 | int s; 42 | 43 | memset(&addr, 0, sizeof(addr)); 44 | addr.sin_family = AF_INET; 45 | addr.sin_port = htons(port); 46 | addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); 47 | 48 | s = socket(AF_INET, type, 0); 49 | if(s < 0) return -1; 50 | 51 | if(connect(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) { 52 | close(s); 53 | return -1; 54 | } 55 | 56 | return s; 57 | 58 | } 59 | 60 | -------------------------------------------------------------------------------- /libcutils/sockets.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | #ifdef HAVE_ANDROID_OS 21 | /* For the socket trust (credentials) check */ 22 | #include 23 | #endif 24 | 25 | bool socket_peer_is_trusted(int fd) 26 | { 27 | #ifdef HAVE_ANDROID_OS 28 | struct ucred cr; 29 | socklen_t len = sizeof(cr); 30 | int n = getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cr, &len); 31 | 32 | if (n != 0) { 33 | ALOGE("could not get socket credentials: %s\n", strerror(errno)); 34 | return false; 35 | } 36 | 37 | if ((cr.uid != AID_ROOT) && (cr.uid != AID_SHELL)) { 38 | ALOGE("untrusted userid on other end of socket: userid %d\n", cr.uid); 39 | return false; 40 | } 41 | #endif 42 | 43 | return true; 44 | } 45 | -------------------------------------------------------------------------------- /libdiskconfig/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | commonSources := \ 5 | diskconfig.c \ 6 | diskutils.c \ 7 | write_lst.c \ 8 | config_mbr.c 9 | 10 | include $(CLEAR_VARS) 11 | LOCAL_SRC_FILES := $(commonSources) 12 | LOCAL_MODULE := libdiskconfig 13 | LOCAL_MODULE_TAGS := optional 14 | LOCAL_SYSTEM_SHARED_LIBRARIES := libcutils liblog libc 15 | include $(BUILD_SHARED_LIBRARY) 16 | 17 | ifeq ($(HOST_OS),linux) 18 | include $(CLEAR_VARS) 19 | LOCAL_SRC_FILES := $(commonSources) 20 | LOCAL_MODULE := libdiskconfig_host 21 | LOCAL_MODULE_TAGS := optional 22 | LOCAL_CFLAGS := -O2 -g -W -Wall -Werror -D_LARGEFILE64_SOURCE 23 | include $(BUILD_HOST_STATIC_LIBRARY) 24 | endif # HOST_OS == linux 25 | -------------------------------------------------------------------------------- /libdiskconfig/dump_diskconfig.c: -------------------------------------------------------------------------------- 1 | /* libs/diskconfig/dump_diskconfig.c 2 | * 3 | * Copyright 2008, The Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #define LOG_TAG "dump_diskconfig" 19 | #include 20 | 21 | #include 22 | 23 | #include "diskconfig.h" 24 | 25 | int 26 | main(int argc, char *argv[]) 27 | { 28 | struct disk_info *dinfo; 29 | 30 | if (argc < 2) { 31 | ALOGE("usage: %s ", argv[0]); 32 | return 1; 33 | } 34 | 35 | if (!(dinfo = load_diskconfig(argv[1], NULL))) 36 | return 1; 37 | 38 | dump_disk_config(dinfo); 39 | 40 | return 0; 41 | } 42 | 43 | -------------------------------------------------------------------------------- /libion/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_SRC_FILES := ion.c 5 | LOCAL_MODULE := libion 6 | LOCAL_MODULE_TAGS := optional 7 | LOCAL_SHARED_LIBRARIES := liblog 8 | include $(BUILD_SHARED_LIBRARY) 9 | 10 | include $(CLEAR_VARS) 11 | LOCAL_SRC_FILES := ion.c ion_test.c 12 | LOCAL_MODULE := iontest 13 | LOCAL_MODULE_TAGS := optional tests 14 | LOCAL_SHARED_LIBRARIES := liblog 15 | include $(BUILD_EXECUTABLE) 16 | -------------------------------------------------------------------------------- /liblinenoise/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | # Static library 5 | # ======================================================== 6 | 7 | include $(CLEAR_VARS) 8 | LOCAL_MODULE:= liblinenoise 9 | LOCAL_SRC_FILES := linenoise.c 10 | 11 | 12 | include $(BUILD_STATIC_LIBRARY) 13 | -------------------------------------------------------------------------------- /liblinenoise/MODULE_LICENSE_BSD_LIKE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chainfire/platform_system_core/f3600a1c929744ec5e91c7a1baa0dabaeeab1028/liblinenoise/MODULE_LICENSE_BSD_LIKE -------------------------------------------------------------------------------- /liblinenoise/NOTICE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010, Salvatore Sanfilippo 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 14 | * Neither the name of Redis nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without 16 | specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /libmincrypt/Android.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2008 The Android Open Source Project 2 | # 3 | LOCAL_PATH := $(call my-dir) 4 | include $(CLEAR_VARS) 5 | 6 | LOCAL_MODULE := libmincrypt 7 | LOCAL_SRC_FILES := rsa.c rsa_e_3.c rsa_e_f4.c sha.c 8 | include $(BUILD_STATIC_LIBRARY) 9 | 10 | include $(CLEAR_VARS) 11 | 12 | LOCAL_MODULE := libmincrypt 13 | LOCAL_SRC_FILES := rsa.c rsa_e_3.c rsa_e_f4.c sha.c 14 | include $(BUILD_HOST_STATIC_LIBRARY) 15 | 16 | 17 | # TODO: drop the hyphen once these are checked in 18 | include $(LOCAL_PATH)/tools/Android.mk 19 | -------------------------------------------------------------------------------- /libmincrypt/NOTICE: -------------------------------------------------------------------------------- 1 | Copyright 2008, The Android Open Source Project 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | * Redistributions of source code must retain the above copyright 6 | notice, this list of conditions and the following disclaimer. 7 | * Redistributions in binary form must reproduce the above copyright 8 | notice, this list of conditions and the following disclaimer in the 9 | documentation and/or other materials provided with the distribution. 10 | * Neither the name of Google Inc. nor the names of its contributors may 11 | be used to endorse or promote products derived from this software 12 | without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY Google Inc. ``AS IS'' AND ANY EXPRESS OR 15 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 16 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 17 | EVENT SHALL Google Inc. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 18 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 20 | OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 21 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 22 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 23 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | -------------------------------------------------------------------------------- /libmincrypt/tools/Android.mk: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2008 The Android Open Source Project 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | LOCAL_PATH := $(call my-dir) 16 | include $(CLEAR_VARS) 17 | 18 | LOCAL_MODULE := dumpkey 19 | LOCAL_SRC_FILES := DumpPublicKey.java 20 | LOCAL_JAR_MANIFEST := DumpPublicKey.mf 21 | include $(BUILD_HOST_JAVA_LIBRARY) 22 | -------------------------------------------------------------------------------- /libmincrypt/tools/DumpPublicKey.mf: -------------------------------------------------------------------------------- 1 | Main-Class: com.android.dumpkey.DumpPublicKey 2 | -------------------------------------------------------------------------------- /libnetutils/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_SRC_FILES:= \ 5 | dhcpclient.c \ 6 | dhcpmsg.c \ 7 | dhcp_utils.c \ 8 | ifc_utils.c \ 9 | packet.c 10 | 11 | LOCAL_SHARED_LIBRARIES := \ 12 | libcutils 13 | 14 | LOCAL_MODULE:= libnetutils 15 | 16 | include $(BUILD_SHARED_LIBRARY) 17 | -------------------------------------------------------------------------------- /libnetutils/packet.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2008, The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _WIFI_PACKET_H_ 18 | #define _WIFI_PACKET_H_ 19 | 20 | int open_raw_socket(const char *ifname, uint8_t *hwaddr, int if_index); 21 | int send_packet(int s, int if_index, struct dhcp_msg *msg, int size, 22 | uint32_t saddr, uint32_t daddr, uint32_t sport, uint32_t dport); 23 | int receive_packet(int s, struct dhcp_msg *msg); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /libnl_2/.gitignore: -------------------------------------------------------------------------------- 1 | include/netlink/version.h.in 2 | cscope.* 3 | -------------------------------------------------------------------------------- /libnl_2/Android.mk: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # * Netlink cache not implemented 3 | # * Library is not thread safe 4 | ####################################### 5 | 6 | LOCAL_PATH := $(call my-dir) 7 | 8 | 9 | include $(CLEAR_VARS) 10 | 11 | LOCAL_SRC_FILES := \ 12 | attr.c \ 13 | cache.c \ 14 | genl/genl.c \ 15 | genl/family.c \ 16 | handlers.c \ 17 | msg.c \ 18 | netlink.c \ 19 | object.c \ 20 | socket.c \ 21 | dbg.c 22 | 23 | LOCAL_C_INCLUDES += \ 24 | external/libnl-headers 25 | 26 | # Static Library 27 | LOCAL_MODULE := libnl_2 28 | LOCAL_MODULE_TAGS := optional 29 | include $(BUILD_STATIC_LIBRARY) 30 | 31 | include $(CLEAR_VARS) 32 | LOCAL_SRC_FILES := 33 | LOCAL_WHOLE_STATIC_LIBRARIES:= libnl_2 34 | LOCAL_SHARED_LIBRARIES:= liblog 35 | LOCAL_MODULE := libnl_2 36 | LOCAL_MODULE_TAGS := optional 37 | include $(BUILD_SHARED_LIBRARY) 38 | -------------------------------------------------------------------------------- /libnl_2/cache.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* NOTICE: This is a clean room re-implementation of libnl */ 18 | 19 | #include "netlink/cache.h" 20 | #include "netlink/object.h" 21 | 22 | void nl_cache_free(struct nl_cache *cache) 23 | { 24 | 25 | } 26 | 27 | void nl_cache_clear(struct nl_cache *cache) 28 | { 29 | 30 | } 31 | 32 | void nl_cache_remove(struct nl_object *obj) 33 | { 34 | 35 | } 36 | 37 | 38 | -------------------------------------------------------------------------------- /libnl_2/dbg.c: -------------------------------------------------------------------------------- 1 | #include "netlink/netlink.h" 2 | #include 3 | 4 | void libnl_printf(int level, char *format, ...) 5 | { 6 | va_list ap; 7 | 8 | level = ANDROID_LOG_ERROR; 9 | va_start(ap, format); 10 | __android_log_vprint(level, "libnl_2", format, ap); 11 | va_end(ap); 12 | } 13 | -------------------------------------------------------------------------------- /libnl_2/genl/family.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* NOTICE: This is a clean room re-implementation of libnl */ 18 | 19 | #include "netlink-types.h" 20 | 21 | static struct genl_family *genl_family_find_byname(const char *name) 22 | { 23 | return NULL; 24 | } 25 | 26 | /* Release reference and none outstanding */ 27 | void genl_family_put(struct genl_family *family) 28 | { 29 | family->ce_refcnt--; 30 | if (family->ce_refcnt <= 0) 31 | free(family); 32 | } 33 | 34 | unsigned int genl_family_get_id(struct genl_family *family) 35 | { 36 | const int NO_FAMILY_ID = 0; 37 | 38 | if (!family) 39 | return NO_FAMILY_ID; 40 | else 41 | return family->gf_id; 42 | 43 | } 44 | 45 | -------------------------------------------------------------------------------- /libnl_2/object.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* NOTICE: This is a clean room re-implementation of libnl */ 18 | 19 | #include "netlink-types.h" 20 | 21 | void nl_object_put(struct nl_object *obj) 22 | { 23 | obj->ce_refcnt--; 24 | if (!obj->ce_refcnt) 25 | nl_object_free(obj); 26 | } 27 | 28 | void nl_object_free(struct nl_object *obj) 29 | { 30 | nl_cache_remove(obj); 31 | } 32 | 33 | 34 | -------------------------------------------------------------------------------- /libpixelflinger/MODULE_LICENSE_APACHE2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chainfire/platform_system_core/f3600a1c929744ec5e91c7a1baa0dabaeeab1028/libpixelflinger/MODULE_LICENSE_APACHE2 -------------------------------------------------------------------------------- /libpixelflinger/buffer.h: -------------------------------------------------------------------------------- 1 | /* libs/pixelflinger/buffer.h 2 | ** 3 | ** Copyright 2006, The Android Open Source Project 4 | ** 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); 6 | ** you may not use this file except in compliance with the License. 7 | ** You may obtain a copy of the License at 8 | ** 9 | ** http://www.apache.org/licenses/LICENSE-2.0 10 | ** 11 | ** Unless required by applicable law or agreed to in writing, software 12 | ** distributed under the License is distributed on an "AS IS" BASIS, 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ** See the License for the specific language governing permissions and 15 | ** limitations under the License. 16 | */ 17 | 18 | 19 | #ifndef ANDROID_GGL_TEXTURE_H 20 | #define ANDROID_GGL_TEXTURE_H 21 | 22 | #include 23 | 24 | namespace android { 25 | 26 | void ggl_init_texture(context_t* c); 27 | 28 | void ggl_set_surface(context_t* c, surface_t* dst, const GGLSurface* src); 29 | 30 | void ggl_pick_texture(context_t* c); 31 | void ggl_pick_cb(context_t* c); 32 | 33 | uint32_t ggl_expand(uint32_t v, int sbits, int dbits); 34 | uint32_t ggl_pack_color(context_t* c, int32_t format, 35 | GGLcolor r, GGLcolor g, GGLcolor b, GGLcolor a); 36 | 37 | }; // namespace android 38 | 39 | #endif // ANDROID_GGL_TEXTURE_H 40 | -------------------------------------------------------------------------------- /libpixelflinger/clear.h: -------------------------------------------------------------------------------- 1 | /* libs/pixelflinger/clear.h 2 | ** 3 | ** Copyright 2006, The Android Open Source Project 4 | ** 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); 6 | ** you may not use this file except in compliance with the License. 7 | ** You may obtain a copy of the License at 8 | ** 9 | ** http://www.apache.org/licenses/LICENSE-2.0 10 | ** 11 | ** Unless required by applicable law or agreed to in writing, software 12 | ** distributed under the License is distributed on an "AS IS" BASIS, 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ** See the License for the specific language governing permissions and 15 | ** limitations under the License. 16 | */ 17 | 18 | #ifndef ANDROID_GGL_CLEAR_H 19 | #define ANDROID_GGL_CLEAR_H 20 | 21 | #include 22 | #include 23 | 24 | namespace android { 25 | 26 | void ggl_init_clear(context_t* c); 27 | 28 | }; // namespace android 29 | 30 | #endif // ANDROID_GGL_CLEAR_H 31 | -------------------------------------------------------------------------------- /libpixelflinger/picker.h: -------------------------------------------------------------------------------- 1 | /* libs/pixelflinger/picker.h 2 | ** 3 | ** Copyright 2006, The Android Open Source Project 4 | ** 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); 6 | ** you may not use this file except in compliance with the License. 7 | ** You may obtain a copy of the License at 8 | ** 9 | ** http://www.apache.org/licenses/LICENSE-2.0 10 | ** 11 | ** Unless required by applicable law or agreed to in writing, software 12 | ** distributed under the License is distributed on an "AS IS" BASIS, 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ** See the License for the specific language governing permissions and 15 | ** limitations under the License. 16 | */ 17 | 18 | 19 | #ifndef ANDROID_PICKER_H 20 | #define ANDROID_PICKER_H 21 | 22 | #include 23 | 24 | namespace android { 25 | 26 | void ggl_init_picker(context_t* c); 27 | void ggl_pick(context_t* c); 28 | 29 | }; // namespace android 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /libpixelflinger/raster.h: -------------------------------------------------------------------------------- 1 | /* libs/pixelflinger/raster.h 2 | ** 3 | ** Copyright 2006, The Android Open Source Project 4 | ** 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); 6 | ** you may not use this file except in compliance with the License. 7 | ** You may obtain a copy of the License at 8 | ** 9 | ** http://www.apache.org/licenses/LICENSE-2.0 10 | ** 11 | ** Unless required by applicable law or agreed to in writing, software 12 | ** distributed under the License is distributed on an "AS IS" BASIS, 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ** See the License for the specific language governing permissions and 15 | ** limitations under the License. 16 | */ 17 | 18 | 19 | #ifndef ANDROID_GGL_RASTER_H 20 | #define ANDROID_GGL_RASTER_H 21 | 22 | #include 23 | 24 | namespace android { 25 | 26 | void ggl_init_raster(context_t* c); 27 | 28 | void gglCopyPixels(void* c, GGLint x, GGLint y, GGLsizei width, GGLsizei height, GGLenum type); 29 | void gglRasterPos2d(void* c, GGLint x, GGLint y); 30 | 31 | }; // namespace android 32 | 33 | #endif // ANDROID_GGL_RASTER_H 34 | -------------------------------------------------------------------------------- /libpixelflinger/scanline.h: -------------------------------------------------------------------------------- 1 | /* libs/pixelflinger/scanline.h 2 | ** 3 | ** Copyright 2006, The Android Open Source Project 4 | ** 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); 6 | ** you may not use this file except in compliance with the License. 7 | ** You may obtain a copy of the License at 8 | ** 9 | ** http://www.apache.org/licenses/LICENSE-2.0 10 | ** 11 | ** Unless required by applicable law or agreed to in writing, software 12 | ** distributed under the License is distributed on an "AS IS" BASIS, 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ** See the License for the specific language governing permissions and 15 | ** limitations under the License. 16 | */ 17 | 18 | 19 | #ifndef ANDROID_SCANLINE_H 20 | #define ANDROID_SCANLINE_H 21 | 22 | #include 23 | 24 | namespace android { 25 | 26 | void ggl_init_scanline(context_t* c); 27 | void ggl_uninit_scanline(context_t* c); 28 | void ggl_pick_scanline(context_t* c); 29 | 30 | }; // namespace android 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /libpixelflinger/tests/Android.mk: -------------------------------------------------------------------------------- 1 | include $(all-subdir-makefiles) 2 | -------------------------------------------------------------------------------- /libpixelflinger/tests/codegen/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_SRC_FILES:= \ 5 | codegen.cpp.arm 6 | 7 | LOCAL_SHARED_LIBRARIES := \ 8 | libcutils \ 9 | libpixelflinger 10 | 11 | LOCAL_C_INCLUDES := \ 12 | system/core/libpixelflinger 13 | 14 | LOCAL_MODULE:= test-opengl-codegen 15 | 16 | LOCAL_MODULE_TAGS := tests 17 | 18 | include $(BUILD_EXECUTABLE) 19 | -------------------------------------------------------------------------------- /libpixelflinger/trap.h: -------------------------------------------------------------------------------- 1 | /* libs/pixelflinger/trap.h 2 | ** 3 | ** Copyright 2006, The Android Open Source Project 4 | ** 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); 6 | ** you may not use this file except in compliance with the License. 7 | ** You may obtain a copy of the License at 8 | ** 9 | ** http://www.apache.org/licenses/LICENSE-2.0 10 | ** 11 | ** Unless required by applicable law or agreed to in writing, software 12 | ** distributed under the License is distributed on an "AS IS" BASIS, 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | ** See the License for the specific language governing permissions and 15 | ** limitations under the License. 16 | */ 17 | 18 | 19 | #ifndef ANDROID_TRAP_H 20 | #define ANDROID_TRAP_H 21 | 22 | #include 23 | 24 | namespace android { 25 | 26 | void ggl_init_trap(context_t* c); 27 | void ggl_state_changed(context_t* c, int flags); 28 | 29 | }; // namespace android 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /libsparse/output_file.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _OUTPUT_FILE_H_ 18 | #define _OUTPUT_FILE_H_ 19 | 20 | #include 21 | 22 | struct output_file; 23 | 24 | struct output_file *output_file_open_fd(int fd, unsigned int block_size, int64_t len, 25 | int gz, int sparse, int chunks, int crc); 26 | struct output_file *output_file_open_callback(int (*write)(void *, const void *, int), 27 | void *priv, unsigned int block_size, int64_t len, int gz, int sparse, 28 | int chunks, int crc); 29 | int write_data_chunk(struct output_file *out, unsigned int len, void *data); 30 | int write_fill_chunk(struct output_file *out, unsigned int len, 31 | uint32_t fill_val); 32 | int write_file_chunk(struct output_file *out, unsigned int len, 33 | const char *file, int64_t offset); 34 | int write_fd_chunk(struct output_file *out, unsigned int len, 35 | int fd, int64_t offset); 36 | int write_skip_chunk(struct output_file *out, int64_t len); 37 | void output_file_close(struct output_file *out); 38 | 39 | int read_all(int fd, void *buf, size_t len); 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /libsparse/sparse_crc32.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | uint32_t sparse_crc32(uint32_t crc, const void *buf, size_t size); 20 | 21 | -------------------------------------------------------------------------------- /libsparse/sparse_defs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LIBSPARSE_SPARSE_DEFS_ 18 | #define _LIBSPARSE_SPARSE_DEFS_ 19 | 20 | #include 21 | #include 22 | 23 | #define __le64 u64 24 | #define __le32 u32 25 | #define __le16 u16 26 | 27 | #define __be64 u64 28 | #define __be32 u32 29 | #define __be16 u16 30 | 31 | #define __u64 u64 32 | #define __u32 u32 33 | #define __u16 u16 34 | #define __u8 u8 35 | 36 | typedef unsigned long long u64; 37 | typedef signed long long s64; 38 | typedef unsigned int u32; 39 | typedef unsigned short int u16; 40 | typedef unsigned char u8; 41 | 42 | #define DIV_ROUND_UP(x, y) (((x) + (y) - 1)/(y)) 43 | #define ALIGN(x, y) ((y) * DIV_ROUND_UP((x), (y))) 44 | #define ALIGN_DOWN(x, y) ((y) * ((x) / (y))) 45 | 46 | #define error(fmt, args...) do { fprintf(stderr, "error: %s: " fmt "\n", __func__, ## args); } while (0) 47 | #define error_errno(s, args...) error(s ": %s", ##args, strerror(errno)) 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /libsparse/sparse_err.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | void sparse_default_print(const char *fmt, ...) 24 | { 25 | va_list argp; 26 | 27 | va_start(argp, fmt); 28 | vfprintf(stderr, fmt, argp); 29 | va_end(argp); 30 | } 31 | 32 | void (*sparse_print_error)(const char *fmt, ...) = sparse_default_print; 33 | void (*sparse_print_verbose)(const char *fmt, ...) = sparse_default_print; 34 | -------------------------------------------------------------------------------- /libsparse/sparse_file.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LIBSPARSE_SPARSE_FILE_H_ 18 | #define _LIBSPARSE_SPARSE_FILE_H_ 19 | 20 | #include 21 | 22 | struct sparse_file { 23 | unsigned int block_size; 24 | int64_t len; 25 | bool verbose; 26 | 27 | struct backed_block_list *backed_block_list; 28 | struct output_file *out; 29 | }; 30 | 31 | 32 | #endif /* _LIBSPARSE_SPARSE_FILE_H_ */ 33 | -------------------------------------------------------------------------------- /libsuspend/Android.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2012 The Android Open Source Project 2 | 3 | LOCAL_PATH:= $(call my-dir) 4 | 5 | libsuspend_src_files := \ 6 | autosuspend.c \ 7 | autosuspend_autosleep.c \ 8 | autosuspend_earlysuspend.c \ 9 | autosuspend_wakeup_count.c \ 10 | 11 | libsuspend_libraries := \ 12 | liblog libcutils 13 | 14 | include $(CLEAR_VARS) 15 | 16 | LOCAL_SRC_FILES := $(libsuspend_src_files) 17 | LOCAL_MODULE := libsuspend 18 | LOCAL_MODULE_TAGS := optional 19 | LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include 20 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/include 21 | LOCAL_SHARED_LIBRARIES := $(libsuspend_libraries) 22 | #LOCAL_CFLAGS += -DLOG_NDEBUG=0 23 | include $(BUILD_SHARED_LIBRARY) 24 | -------------------------------------------------------------------------------- /libsuspend/autosuspend_ops.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LIBSUSPEND_AUTOSUSPEND_OPS_H_ 18 | #define _LIBSUSPEND_AUTOSUSPEND_OPS_H_ 19 | 20 | struct autosuspend_ops { 21 | int (*enable)(void); 22 | int (*disable)(void); 23 | }; 24 | 25 | struct autosuspend_ops *autosuspend_autosleep_init(void); 26 | struct autosuspend_ops *autosuspend_earlysuspend_init(void); 27 | struct autosuspend_ops *autosuspend_wakeup_count_init(void); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /libsuspend/include/suspend/autosuspend.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef _LIBSUSPEND_AUTOSUSPEND_H_ 18 | #define _LIBSUSPEND_AUTOSUSPEND_H_ 19 | 20 | #include 21 | 22 | __BEGIN_DECLS 23 | 24 | /* 25 | * autosuspend_enable 26 | * 27 | * Turn on autosuspend in the kernel, allowing it to enter suspend if no 28 | * wakelocks/wakeup_sources are held. 29 | * 30 | * 31 | * 32 | * Returns 0 on success, -1 if autosuspend was not enabled. 33 | */ 34 | int autosuspend_enable(void); 35 | 36 | /* 37 | * autosuspend_disable 38 | * 39 | * Turn off autosuspend in the kernel, preventing suspend and synchronizing 40 | * with any in-progress resume. 41 | * 42 | * Returns 0 on success, -1 if autosuspend was not disabled. 43 | */ 44 | int autosuspend_disable(void); 45 | 46 | __END_DECLS 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /libsync/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_SRC_FILES := sync.c 5 | LOCAL_MODULE := libsync 6 | LOCAL_MODULE_TAGS := optional 7 | LOCAL_SHARED_LIBRARIES := liblog 8 | include $(BUILD_SHARED_LIBRARY) 9 | 10 | include $(CLEAR_VARS) 11 | LOCAL_SRC_FILES := sync.c sync_test.c 12 | LOCAL_MODULE := sync_test 13 | LOCAL_MODULE_TAGS := optional tests 14 | LOCAL_SHARED_LIBRARIES := liblog 15 | include $(BUILD_EXECUTABLE) 16 | -------------------------------------------------------------------------------- /libsysutils/Android.mk: -------------------------------------------------------------------------------- 1 | ifneq ($(BUILD_TINY_ANDROID),true) 2 | 3 | LOCAL_PATH:= $(call my-dir) 4 | 5 | include $(CLEAR_VARS) 6 | 7 | LOCAL_SRC_FILES:= \ 8 | src/SocketListener.cpp \ 9 | src/FrameworkListener.cpp \ 10 | src/NetlinkListener.cpp \ 11 | src/NetlinkEvent.cpp \ 12 | src/FrameworkCommand.cpp \ 13 | src/SocketClient.cpp \ 14 | src/ServiceManager.cpp \ 15 | EventLogTags.logtags 16 | 17 | LOCAL_MODULE:= libsysutils 18 | 19 | LOCAL_C_INCLUDES := $(KERNEL_HEADERS) 20 | 21 | LOCAL_CFLAGS := 22 | 23 | LOCAL_SHARED_LIBRARIES := libcutils 24 | 25 | include $(BUILD_SHARED_LIBRARY) 26 | 27 | endif 28 | -------------------------------------------------------------------------------- /libsysutils/EventLogTags.logtags: -------------------------------------------------------------------------------- 1 | # See system/core/logcat/event.logtags for a description of the format of this file. 2 | 3 | # FrameworkListener dispatchCommand overflow 4 | 78001 dispatchCommand_overflow 5 | 65537 netlink_failure (uid|1) 6 | -------------------------------------------------------------------------------- /libsysutils/src/FrameworkClient.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #define LOG_TAG "FrameworkClient" 7 | #include 8 | 9 | #include 10 | 11 | FrameworkClient::FrameworkClient(int socket) { 12 | mSocket = socket; 13 | pthread_mutex_init(&mWriteMutex, NULL); 14 | } 15 | 16 | int FrameworkClient::sendMsg(const char *msg) { 17 | int ret; 18 | if (mSocket < 0) { 19 | errno = EHOSTUNREACH; 20 | return -1; 21 | } 22 | 23 | pthread_mutex_lock(&mWriteMutex); 24 | ret = TEMP_FAILURE_RETRY(write(mSocket, msg, strlen(msg) +1)); 25 | if (ret < 0) { 26 | SLOGW("Unable to send msg '%s' (%s)", msg, strerror(errno)); 27 | } 28 | pthread_mutex_unlock(&mWriteMutex); 29 | return 0; 30 | } 31 | 32 | int FrameworkClient::sendMsg(const char *msg, const char *data) { 33 | size_t bufflen = strlen(msg) + strlen(data) + 1; 34 | char *buffer = (char *) alloca(bufflen); 35 | if (!buffer) { 36 | errno = -ENOMEM; 37 | return -1; 38 | } 39 | snprintf(buffer, bufflen, "%s%s", msg, data); 40 | return sendMsg(buffer); 41 | } 42 | 43 | -------------------------------------------------------------------------------- /libsysutils/src/FrameworkCommand.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include 17 | 18 | #define LOG_TAG "FrameworkCommand" 19 | 20 | #include 21 | 22 | #include 23 | 24 | FrameworkCommand::FrameworkCommand(const char *cmd) { 25 | mCommand = cmd; 26 | } 27 | 28 | int FrameworkCommand::runCommand(SocketClient *c, int argc, char **argv) { 29 | SLOGW("Command %s has no run handler!", getCommand()); 30 | errno = ENOSYS; 31 | return -1; 32 | } 33 | -------------------------------------------------------------------------------- /libusbhost/Android.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2010 The Android Open Source Project 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | LOCAL_PATH := $(my-dir) 18 | 19 | # Static library for Linux host 20 | # ======================================================== 21 | 22 | ifeq ($(HOST_OS),linux) 23 | 24 | include $(CLEAR_VARS) 25 | 26 | LOCAL_MODULE := libusbhost 27 | LOCAL_SRC_FILES := usbhost.c 28 | 29 | include $(BUILD_HOST_STATIC_LIBRARY) 30 | 31 | endif 32 | 33 | # Shared library for target 34 | # ======================================================== 35 | 36 | include $(CLEAR_VARS) 37 | 38 | LOCAL_MODULE := libusbhost 39 | LOCAL_SRC_FILES := usbhost.c 40 | 41 | LOCAL_CFLAGS := -g -DUSE_LIBLOG 42 | 43 | # needed for logcat 44 | LOCAL_SHARED_LIBRARIES := libcutils 45 | 46 | include $(BUILD_SHARED_LIBRARY) 47 | 48 | # Static library for target 49 | # ======================================================== 50 | 51 | include $(CLEAR_VARS) 52 | 53 | LOCAL_MODULE := libusbhost 54 | LOCAL_SRC_FILES := usbhost.c 55 | 56 | include $(BUILD_STATIC_LIBRARY) 57 | -------------------------------------------------------------------------------- /libzipfile/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | 3 | # build host static library 4 | include $(CLEAR_VARS) 5 | 6 | LOCAL_SRC_FILES:= \ 7 | centraldir.c \ 8 | zipfile.c 9 | 10 | LOCAL_STATIC_LIBRARIES := \ 11 | libunz 12 | 13 | LOCAL_MODULE:= libzipfile 14 | 15 | LOCAL_C_INCLUDES += external/zlib 16 | 17 | include $(BUILD_HOST_STATIC_LIBRARY) 18 | 19 | # build device static library 20 | include $(CLEAR_VARS) 21 | 22 | LOCAL_SRC_FILES:= \ 23 | centraldir.c \ 24 | zipfile.c 25 | 26 | LOCAL_STATIC_LIBRARIES := \ 27 | libunz 28 | 29 | LOCAL_MODULE:= libzipfile 30 | 31 | LOCAL_C_INCLUDES += external/zlib 32 | 33 | include $(BUILD_STATIC_LIBRARY) 34 | 35 | 36 | # build test_zipfile 37 | include $(CLEAR_VARS) 38 | 39 | LOCAL_SRC_FILES:= \ 40 | test_zipfile.c 41 | 42 | LOCAL_STATIC_LIBRARIES := libzipfile libunz 43 | 44 | LOCAL_MODULE := test_zipfile 45 | 46 | LOCAL_C_INCLUDES += external/zlib 47 | 48 | include $(BUILD_HOST_EXECUTABLE) 49 | -------------------------------------------------------------------------------- /libzipfile/MODULE_LICENSE_APACHE2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chainfire/platform_system_core/f3600a1c929744ec5e91c7a1baa0dabaeeab1028/libzipfile/MODULE_LICENSE_APACHE2 -------------------------------------------------------------------------------- /libzipfile/private.h: -------------------------------------------------------------------------------- 1 | #ifndef PRIVATE_H 2 | #define PRIVATE_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | typedef struct Zipentry { 11 | unsigned long fileNameLength; 12 | const unsigned char* fileName; 13 | unsigned short compressionMethod; 14 | unsigned int uncompressedSize; 15 | unsigned int compressedSize; 16 | const unsigned char* data; 17 | 18 | struct Zipentry* next; 19 | } Zipentry; 20 | 21 | typedef struct Zipfile 22 | { 23 | const unsigned char *buf; 24 | ssize_t bufsize; 25 | 26 | // Central directory 27 | unsigned short disknum; //mDiskNumber; 28 | unsigned short diskWithCentralDir; //mDiskWithCentralDir; 29 | unsigned short entryCount; //mNumEntries; 30 | unsigned short totalEntryCount; //mTotalNumEntries; 31 | unsigned int centralDirSize; //mCentralDirSize; 32 | unsigned int centralDirOffest; // offset from first disk //mCentralDirOffset; 33 | unsigned short commentLen; //mCommentLen; 34 | const unsigned char* comment; //mComment; 35 | 36 | Zipentry* entries; 37 | } Zipfile; 38 | 39 | int read_central_dir(Zipfile* file); 40 | 41 | unsigned int read_le_int(const unsigned char* buf); 42 | unsigned int read_le_short(const unsigned char* buf); 43 | 44 | #endif // PRIVATE_H 45 | 46 | -------------------------------------------------------------------------------- /logcat/Android.mk: -------------------------------------------------------------------------------- 1 | # Copyright 2006 The Android Open Source Project 2 | 3 | LOCAL_PATH:= $(call my-dir) 4 | include $(CLEAR_VARS) 5 | 6 | LOCAL_SRC_FILES:= logcat.cpp event.logtags 7 | 8 | LOCAL_SHARED_LIBRARIES := liblog 9 | 10 | LOCAL_MODULE:= logcat 11 | 12 | include $(BUILD_EXECUTABLE) 13 | -------------------------------------------------------------------------------- /logcat/MODULE_LICENSE_APACHE2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chainfire/platform_system_core/f3600a1c929744ec5e91c7a1baa0dabaeeab1028/logcat/MODULE_LICENSE_APACHE2 -------------------------------------------------------------------------------- /logwrapper/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH:= $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_SRC_FILES:= logwrapper.c 5 | LOCAL_MODULE := logwrapper 6 | LOCAL_STATIC_LIBRARIES := liblog 7 | include $(BUILD_EXECUTABLE) 8 | -------------------------------------------------------------------------------- /mkbootimg/Android.mk: -------------------------------------------------------------------------------- 1 | 2 | LOCAL_PATH:= $(call my-dir) 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_SRC_FILES := mkbootimg.c 6 | LOCAL_STATIC_LIBRARIES := libmincrypt 7 | 8 | LOCAL_MODULE := mkbootimg 9 | 10 | include $(BUILD_HOST_EXECUTABLE) 11 | 12 | $(call dist-for-goals,dist_files,$(LOCAL_BUILT_MODULE)) 13 | -------------------------------------------------------------------------------- /netcfg/Android.mk: -------------------------------------------------------------------------------- 1 | ifneq ($(BUILD_TINY_ANDROID),true) 2 | LOCAL_PATH:= $(call my-dir) 3 | 4 | include $(CLEAR_VARS) 5 | LOCAL_SRC_FILES:= netcfg.c 6 | LOCAL_MODULE:= netcfg 7 | 8 | #LOCAL_FORCE_STATIC_EXECUTABLE := true 9 | #LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN) 10 | #LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED) 11 | #LOCAL_STATIC_LIBRARIES := libcutils libc 12 | 13 | LOCAL_SHARED_LIBRARIES := libc libnetutils 14 | 15 | include $(BUILD_EXECUTABLE) 16 | endif 17 | -------------------------------------------------------------------------------- /netcfg/MODULE_LICENSE_APACHE2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Chainfire/platform_system_core/f3600a1c929744ec5e91c7a1baa0dabaeeab1028/netcfg/MODULE_LICENSE_APACHE2 -------------------------------------------------------------------------------- /rootdir/etc/dbus.conf: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | system 7 | 8 | 9 | EXTERNAL 10 | 11 | 15 | unix:path=/dev/socket/dbus 16 | 17 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /rootdir/etc/hosts: -------------------------------------------------------------------------------- 1 | 127.0.0.1 localhost 2 | -------------------------------------------------------------------------------- /rootdir/etc/mountd.conf: -------------------------------------------------------------------------------- 1 | ## mountd configuration file 2 | 3 | ## add a mount entry for each mount point to be managed by mountd 4 | mount { 5 | ## root block device with partition map or raw FAT file system 6 | block_device /dev/block/mmcblk0 7 | 8 | ## mount point for block device 9 | mount_point /sdcard 10 | 11 | ## true if this mount point can be shared via USB mass storage 12 | enable_ums true 13 | 14 | ## path to the UMS driver file for specifying the block device path 15 | ## use this for the mass_storage function driver 16 | driver_store_path /sys/devices/platform/usb_mass_storage/lun0/file 17 | ## use this for android_usb composite gadget driver 18 | ##driver_store_path /sys/devices/platform/msm_hsusb/gadget/lun0/file 19 | } 20 | -------------------------------------------------------------------------------- /rootdir/etc/ueventd.goldfish.rc: -------------------------------------------------------------------------------- 1 | # These settings are specific to running under the Android emulator 2 | /dev/qemu_trace 0666 system system 3 | /dev/qemu_pipe 0666 system system 4 | /dev/ttyS* 0666 system system 5 | /proc 0666 system system 6 | -------------------------------------------------------------------------------- /rootdir/etc/vold.fstab: -------------------------------------------------------------------------------- 1 | ## Vold 2.0 Generic fstab 2 | ## - San Mehat (san@android.com) 3 | ## 4 | 5 | ####################### 6 | ## Regular device mount 7 | ## 8 | ## Format: dev_mount