Loading init/README.md +2 −1 Original line number Diff line number Diff line Loading @@ -644,7 +644,8 @@ provides the `aidl_lazy_test_1` interface. `wait <path> [ <timeout> ]` > Poll for the existence of the given file and return when found, or the timeout has been reached. If timeout is not specified it currently defaults to five seconds. currently defaults to five seconds. The timeout value can be fractional seconds, specified in floating point notation. `wait_for_prop <name> <value>` > Wait for system property _name_ to be _value_. Properties are expanded Loading init/builtins.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ #include <android-base/chrono_utils.h> #include <android-base/file.h> #include <android-base/logging.h> #include <android-base/parsedouble.h> #include <android-base/parseint.h> #include <android-base/properties.h> #include <android-base/stringprintf.h> Loading Loading @@ -1065,11 +1066,12 @@ static Result<void> do_load_system_props(const BuiltinArguments& args) { static Result<void> do_wait(const BuiltinArguments& args) { auto timeout = kCommandRetryTimeout; if (args.size() == 3) { int timeout_int; if (!android::base::ParseInt(args[2], &timeout_int)) { double timeout_double; if (!android::base::ParseDouble(args[2], &timeout_double, 0)) { return Error() << "failed to parse timeout"; } timeout = std::chrono::seconds(timeout_int); timeout = std::chrono::duration_cast<std::chrono::nanoseconds>( std::chrono::duration<double>(timeout_double)); } if (wait_for_file(args[1].c_str(), timeout) != 0) { Loading init/check_builtins.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ #include <sys/time.h> #include <android-base/logging.h> #include <android-base/parsedouble.h> #include <android-base/parseint.h> #include <android-base/strings.h> Loading Loading @@ -205,8 +206,8 @@ Result<void> check_sysclktz(const BuiltinArguments& args) { Result<void> check_wait(const BuiltinArguments& args) { if (args.size() == 3 && !args[2].empty()) { int timeout_int; if (!android::base::ParseInt(args[2], &timeout_int)) { double timeout_double; if (!android::base::ParseDouble(args[2], &timeout_double, 0)) { return Error() << "failed to parse timeout"; } } Loading Loading
init/README.md +2 −1 Original line number Diff line number Diff line Loading @@ -644,7 +644,8 @@ provides the `aidl_lazy_test_1` interface. `wait <path> [ <timeout> ]` > Poll for the existence of the given file and return when found, or the timeout has been reached. If timeout is not specified it currently defaults to five seconds. currently defaults to five seconds. The timeout value can be fractional seconds, specified in floating point notation. `wait_for_prop <name> <value>` > Wait for system property _name_ to be _value_. Properties are expanded Loading
init/builtins.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ #include <android-base/chrono_utils.h> #include <android-base/file.h> #include <android-base/logging.h> #include <android-base/parsedouble.h> #include <android-base/parseint.h> #include <android-base/properties.h> #include <android-base/stringprintf.h> Loading Loading @@ -1065,11 +1066,12 @@ static Result<void> do_load_system_props(const BuiltinArguments& args) { static Result<void> do_wait(const BuiltinArguments& args) { auto timeout = kCommandRetryTimeout; if (args.size() == 3) { int timeout_int; if (!android::base::ParseInt(args[2], &timeout_int)) { double timeout_double; if (!android::base::ParseDouble(args[2], &timeout_double, 0)) { return Error() << "failed to parse timeout"; } timeout = std::chrono::seconds(timeout_int); timeout = std::chrono::duration_cast<std::chrono::nanoseconds>( std::chrono::duration<double>(timeout_double)); } if (wait_for_file(args[1].c_str(), timeout) != 0) { Loading
init/check_builtins.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ #include <sys/time.h> #include <android-base/logging.h> #include <android-base/parsedouble.h> #include <android-base/parseint.h> #include <android-base/strings.h> Loading Loading @@ -205,8 +206,8 @@ Result<void> check_sysclktz(const BuiltinArguments& args) { Result<void> check_wait(const BuiltinArguments& args) { if (args.size() == 3 && !args[2].empty()) { int timeout_int; if (!android::base::ParseInt(args[2], &timeout_int)) { double timeout_double; if (!android::base::ParseDouble(args[2], &timeout_double, 0)) { return Error() << "failed to parse timeout"; } } Loading