From 1a13db5b2675759316a8529873c5d29831a9ba32 Mon Sep 17 00:00:00 2001 From: William Roberts Date: Fri, 8 Apr 2016 13:44:19 -0700 Subject: [PATCH] move android_ids into bionic Generate the android_ids array and include into the build. Test: The bionic is built and that core AIDs work as expected with commands like chown, mkdir and init services and builtins. Bug: 27999086 Change-Id: Ib575bf85326c91801c5674db475dcb9cf44c00dc Signed-off-by: William Roberts --- libc/Android.bp | 8 ++++++++ libc/bionic/grp_pwd.cpp | 3 +++ libc/fs_config_generator.py | 1 + tests/Android.bp | 2 ++ tests/grp_pwd_test.cpp | 3 +++ 5 files changed, 17 insertions(+) create mode 120000 libc/fs_config_generator.py diff --git a/libc/Android.bp b/libc/Android.bp index 094ad5cf6..66bbc715e 100644 --- a/libc/Android.bp +++ b/libc/Android.bp @@ -1194,6 +1194,13 @@ cc_library_static { name: "libc_bionic", } +genrule { + name: "generated_android_ids", + out: [ "generated_android_ids.h" ], + tool_files: [ "fs_config_generator.py" ], + cmd: "$(location fs_config_generator.py) aidarray system/core/include/private/android_filesystem_config.h > $(out)", +} + // ======================================================== // libc_bionic_ndk.a- The portions of libc_bionic that can // be safely used in libc_ndk.a (no troublesome global data @@ -1382,6 +1389,7 @@ cc_library_static { local_include_dirs: ["stdio"], include_dirs: ["bionic/libstdc++/include"], name: "libc_bionic_ndk", + generated_headers: ["generated_android_ids"], } // ======================================================== diff --git a/libc/bionic/grp_pwd.cpp b/libc/bionic/grp_pwd.cpp index 332b2b8f4..b6b579686 100644 --- a/libc/bionic/grp_pwd.cpp +++ b/libc/bionic/grp_pwd.cpp @@ -43,6 +43,9 @@ #include "private/libc_logging.h" #include "private/ThreadLocalBuffer.h" +// Generated android_ids array +#include "generated_android_ids.h" + // POSIX seems to envisage an implementation where the functions are // implemented by brute-force searching with getpwent(3), and the // functions are implemented similarly with getgrent(3). This means that it's diff --git a/libc/fs_config_generator.py b/libc/fs_config_generator.py new file mode 120000 index 000000000..aafb7dc35 --- /dev/null +++ b/libc/fs_config_generator.py @@ -0,0 +1 @@ +../../build/tools/fs_config/fs_config_generator.py \ No newline at end of file diff --git a/tests/Android.bp b/tests/Android.bp index a9d302ae0..0868f6e84 100644 --- a/tests/Android.bp +++ b/tests/Android.bp @@ -155,6 +155,8 @@ cc_test_library { shared: { enabled: false, }, + + generated_headers: ["generated_android_ids"], } // ----------------------------------------------------------------------------- diff --git a/tests/grp_pwd_test.cpp b/tests/grp_pwd_test.cpp index a68478071..a2c31d1ac 100644 --- a/tests/grp_pwd_test.cpp +++ b/tests/grp_pwd_test.cpp @@ -30,6 +30,9 @@ #include +// Generated android_ids array +#include "generated_android_ids.h" + enum uid_type_t { TYPE_SYSTEM, TYPE_APP -- 2.11.0