GetBuiltinFunctionMap()1 const BuiltinFunctionMap& GetBuiltinFunctionMap() {
2 constexpr std::size_t kMax = std::numeric_limits<std::size_t>::max();
3 // clang-format off
4 static const BuiltinFunctionMap builtin_functions = {
5 {"bootchart", {1, 1, {false, check_stub}}},
6 {"chmod", {2, 2, {true, check_stub}}},
7 {"chown", {2, 3, {true, check_chown}}},
8 {"class_reset", {1, 1, {false, check_stub}}},
9 {"class_restart", {1, 2, {false, check_stub}}},
10 {"class_start", {1, 1, {false, check_stub}}},
11 {"class_stop", {1, 1, {false, check_stub}}},
12 {"copy", {2, 2, {true, check_stub}}},
13 {"copy_per_line", {2, 2, {true, check_stub}}},
14 {"domainname", {1, 1, {true, check_stub}}},
15 {"enable", {1, 1, {false, check_stub}}},
16 {"exec", {1, kMax, {false, check_exec}}},
17 {"exec_background", {1, kMax, {false, check_exec_background}}},
18 {"exec_start", {1, 1, {false, check_stub}}},
19 {"export", {2, 2, {false, check_stub}}},
20 {"hostname", {1, 1, {true, check_stub}}},
21 {"ifup", {1, 1, {true, check_stub}}},
22 {"init_user0", {0, 0, {false, check_stub}}},
23 {"insmod", {1, kMax, {true, check_stub}}},
24 {"installkey", {1, 1, {false, check_stub}}},
25 {"interface_restart", {1, 1, {false, check_interface_restart}}},
26 {"interface_start", {1, 1, {false, check_interface_start}}},
27 {"interface_stop", {1, 1, {false, check_interface_stop}}},
28 {"load_exports", {1, 1, {false, check_stub}}},
29 {"load_persist_props", {0, 0, {false, check_stub}}},
30 {"load_system_props", {0, 0, {false, check_load_system_props}}},
31 {"loglevel", {1, 1, {false, check_loglevel}}},
32 {"mark_post_data", {0, 0, {false, check_stub}}},
33 {"mkdir", {1, 6, {true, check_mkdir}}},
34 // TODO: Do mount operations in vendor_init.
35 // mount_all is currently too complex to run in vendor_init as it queues action triggers,
36 // imports rc scripts, etc. It should be simplified and run in vendor_init context.
37 // mount and umount are run in the same context as mount_all for symmetry.
38 {"mount_all", {0, kMax, {false, check_mount_all}}},
39 {"mount", {3, kMax, {false, check_stub}}},
40 {"perform_apex_config", {0, 1, {false, check_stub}}},
41 {"umount", {1, 1, {false, check_stub}}},
42 {"umount_all", {0, 1, {false, check_umount_all}}},
43 {"update_linker_config", {0, 0, {false, check_stub}}},
44 {"readahead", {1, 2, {true, check_stub}}},
45 {"restart", {1, 2, {false, check_stub}}},
46 {"restorecon", {1, kMax, {true, check_restorecon}}},
47 {"restorecon_recursive", {1, kMax, {true, check_restorecon_recursive}}},
48 {"rm", {1, 1, {true, check_stub}}},
49 {"rmdir", {1, 1, {true, check_stub}}},
50 {"setprop", {2, 2, {true, check_setprop}}},
51 {"setrlimit", {3, 3, {false, check_setrlimit}}},
52 {"start", {1, 1, {false, check_stub}}},
53 {"stop", {1, 1, {false, check_stub}}},
54 {"swapon_all", {0, 1, {false, check_swapon_all}}},
55 {"swapoff", {1, 1, {false, check_stub}}},
56 {"enter_default_mount_ns", {0, 0, {false, check_stub}}},
57 {"symlink", {2, 2, {true, check_stub}}},
58 {"sysclktz", {1, 1, {false, check_sysclktz}}},
59 {"trigger", {1, 1, {false, check_stub}}},
60 {"verity_update_state", {0, 0, {false, check_stub}}},
61 {"wait", {1, 2, {true, check_wait}}},
62 {"wait_for_prop", {2, 2, {false, check_wait_for_prop}}},
63 {"write", {2, 2, {true, check_stub}}},
64 };
65 // clang-format on
66 return builtin_functions;
67 }
68