diff options
author | Dan Albert <danalbert@google.com> | 2015-03-16 10:08:46 -0700 |
---|---|---|
committer | Dan Albert <danalbert@google.com> | 2015-03-16 13:48:07 -0700 |
commit | a83ba64a238de57fa2d02c4ea20f4c8ff8ab1464 (patch) | |
tree | 0c4bf967c0cc52ccd6eca52564a1275ab2da33f2 /init | |
parent | 778b9c84b81cba056f0b9a3ba05ecd88331df00a (diff) | |
download | system_core-a83ba64a238de57fa2d02c4ea20f4c8ff8ab1464.zip system_core-a83ba64a238de57fa2d02c4ea20f4c8ff8ab1464.tar.gz system_core-a83ba64a238de57fa2d02c4ea20f4c8ff8ab1464.tar.bz2 |
Revert "Revert "Create libbase.""
This reverts commit a7870d88167f619e758b5bcd15b410d16da7c16b.
(cherry picked from commit c007bc3856a4cf86b8f610eb045f26a9dedc2894)
Diffstat (limited to 'init')
-rw-r--r-- | init/Android.mk | 5 | ||||
-rw-r--r-- | init/bootchart.cpp | 18 | ||||
-rw-r--r-- | init/property_service.cpp | 2 | ||||
-rw-r--r-- | init/util.cpp | 8 |
4 files changed, 16 insertions, 17 deletions
diff --git a/init/Android.mk b/init/Android.mk index ec2861b..5b8094f 100644 --- a/init/Android.mk +++ b/init/Android.mk @@ -27,6 +27,7 @@ LOCAL_SRC_FILES:= \ parser.cpp \ util.cpp \ +LOCAL_STATIC_LIBRARIES := libbase LOCAL_MODULE := libinit include $(BUILD_STATIC_LIBRARY) @@ -55,7 +56,7 @@ LOCAL_STATIC_LIBRARIES := \ libfs_mgr \ liblogwrap \ libcutils \ - libutils \ + libbase \ liblog \ libc \ libselinux \ @@ -80,7 +81,7 @@ LOCAL_SRC_FILES := \ LOCAL_SHARED_LIBRARIES += \ libcutils \ - libutils \ + libbase \ LOCAL_STATIC_LIBRARIES := libinit include $(BUILD_NATIVE_TEST) diff --git a/init/bootchart.cpp b/init/bootchart.cpp index cc31920..530eba8 100644 --- a/init/bootchart.cpp +++ b/init/bootchart.cpp @@ -32,7 +32,7 @@ #include <string> -#include <utils/file.h> +#include <base/file.h> #define LOG_ROOT "/data/bootchart" #define LOG_STAT LOG_ROOT"/proc_stat.log" @@ -59,7 +59,7 @@ static FILE* log_disks; static long long get_uptime_jiffies() { std::string uptime; - if (!android::ReadFileToString("/proc/uptime", &uptime)) { + if (!android::base::ReadFileToString("/proc/uptime", &uptime)) { return 0; } return 100LL * strtod(uptime.c_str(), NULL); @@ -82,7 +82,7 @@ static void log_header() { } std::string kernel_cmdline; - android::ReadFileToString("/proc/cmdline", &kernel_cmdline); + android::base::ReadFileToString("/proc/cmdline", &kernel_cmdline); FILE* out = fopen(LOG_HEADER, "we"); if (out == NULL) { @@ -106,7 +106,7 @@ static void do_log_file(FILE* log, const char* procfile) { do_log_uptime(log); std::string content; - if (android::ReadFileToString(procfile, &content)) { + if (android::base::ReadFileToString(procfile, &content)) { fprintf(log, "%s\n", content.c_str()); } } @@ -127,13 +127,13 @@ static void do_log_procs(FILE* log) { // name from /proc/<pid>/cmdline. snprintf(filename, sizeof(filename), "/proc/%d/cmdline", pid); std::string cmdline; - android::ReadFileToString(filename, &cmdline); + android::base::ReadFileToString(filename, &cmdline); const char* full_name = cmdline.c_str(); // So we stop at the first NUL. // Read process stat line. snprintf(filename, sizeof(filename), "/proc/%d/stat", pid); std::string stat; - if (android::ReadFileToString(filename, &stat)) { + if (android::base::ReadFileToString(filename, &stat)) { if (!cmdline.empty()) { // Substitute the process name with its real name. size_t open = stat.find('('); @@ -155,7 +155,7 @@ static int bootchart_init() { int timeout = 0; std::string start; - android::ReadFileToString(LOG_STARTFILE, &start); + android::base::ReadFileToString(LOG_STARTFILE, &start); if (!start.empty()) { timeout = atoi(start.c_str()); } else { @@ -164,7 +164,7 @@ static int bootchart_init() { // timeout. this is useful when using -wipe-data since the /data // partition is fresh. std::string cmdline; - android::ReadFileToString("/proc/cmdline", &cmdline); + android::base::ReadFileToString("/proc/cmdline", &cmdline); #define KERNEL_OPTION "androidboot.bootchart=" if (strstr(cmdline.c_str(), KERNEL_OPTION) != NULL) { timeout = atoi(cmdline.c_str() + sizeof(KERNEL_OPTION) - 1); @@ -226,7 +226,7 @@ static int bootchart_step() { // Stop if /data/bootchart/stop contains 1. std::string stop; - if (android::ReadFileToString(LOG_STOPFILE, &stop) && stop == "1") { + if (android::base::ReadFileToString(LOG_STOPFILE, &stop) && stop == "1") { return -1; } diff --git a/init/property_service.cpp b/init/property_service.cpp index 05c03d6..ddb8050 100644 --- a/init/property_service.cpp +++ b/init/property_service.cpp @@ -30,8 +30,6 @@ #include <cutils/sockets.h> #include <cutils/multiuser.h> -#include <utils/file.h> - #define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_ #include <sys/_system_properties.h> diff --git a/init/util.cpp b/init/util.cpp index 0726053..8b238d4 100644 --- a/init/util.cpp +++ b/init/util.cpp @@ -32,11 +32,11 @@ #include <sys/socket.h> #include <sys/un.h> +#include <base/file.h> + /* for ANDROID_SOCKET_* */ #include <cutils/sockets.h> -#include <utils/file.h> - #include <private/android_filesystem_config.h> #include "init.h" @@ -168,7 +168,7 @@ bool read_file(const char* path, std::string* content) { return false; } - bool okay = android::ReadFdToString(fd, content); + bool okay = android::base::ReadFdToString(fd, content); TEMP_FAILURE_RETRY(close(fd)); if (okay) { content->append("\n", 1); @@ -181,7 +181,7 @@ int write_file(const char* path, const char* content) { if (fd == -1) { return -errno; } - int result = android::WriteStringToFd(content, fd) ? 0 : -errno; + int result = android::base::WriteStringToFd(content, fd) ? 0 : -errno; TEMP_FAILURE_RETRY(close(fd)); return result; } |