[component_manager] More extensible framework for builtin components

component_manager has a builtin runner which is used for running
"builtin components", i.e. components whose source code lives in
component manager itself. elf_runner is one (and the only) builtin
component today.

For microfuchsia, we would like to run shutdown-shim and devfs in
component manager as builtin components as well. It turns out though
that the current implementation of builtin runner is a bit inflexible
for expanding to more components.

To this end, this change is a refactor which does the following:

- Introduces a [BuiltinProgram] type that represents the state of a builtin
  program. As one of its arguments, [BuiltinProgram] contains a
  [BuiltinProgramFn], which is a callback that runs the builtin
  component's code.
- Make the ABI for builtin components more similar to non-builtins.
  Builtin components accept a subset of procargs, including namespace,
  out dir, lifecycle channel, etc. This will facilitate porting
  non-builtin components to builtins.
- [BuiltinProgram] has a universal [Controller] implementation which
  integrates with the Lifecycle control channel.
- Refactor elf_runner to use [BuiltinProgram]. elf_runner now uses the
  Lifecycle control channel instead of its own Controller implementation.
- builtin_runner now supports dependency injection for tests. Unit tests can
  bring along their own builtin components.

Fixed: 372527480
Change-Id: Ic8a24d2cd9d7da05c8305572539fb932f054689f
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1134697
Commit-Queue: Gary Bressler <geb@google.com>
Reviewed-by: Claire Gonyeo <cgonyeo@google.com>
3 files changed
tree: 80cd1e584d736bf8929d49127c3b6481c53bec28
  1. boards/
  2. build/
  3. bundles/
  4. docs/
  5. examples/
  6. infra/
  7. products/
  8. scripts/
  9. sdk/
  10. src/
  11. third_party/
  12. tools/
  13. zircon/
  14. .clang-format
  15. .clang-tidy
  16. .editorconfig
  17. .git-blame-ignore-revs
  18. .gitattributes
  19. .gitignore
  20. .gitmodules
  21. .gn
  22. .ignore
  23. analysis_options.yaml
  24. AUTHORS
  25. BUILD.gn
  26. CODE_OF_CONDUCT.md
  27. CONTRIBUTING.md
  28. fuchsia.code-workspace
  29. LICENSE
  30. OWNERS
  31. PATENTS
  32. pyproject.toml
  33. pyrightconfig.json
  34. README.md
  35. rustfmt.toml
  36. shac.star
  37. shac.textproto
README.md

Fuchsia

What is Fuchsia?

Fuchsia is an open source, general purpose operating system supporting modern 64-bit Intel and ARM processors.

We expect everyone interacting with our project to respect our code of conduct.

Read more about Fuchsia's principles.

How can I build and run Fuchsia?

See Getting Started.

Where can I learn more about Fuchsia?

See fuchsia.dev.