• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2022 The ChromiumOS Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 //! Generic implementation of product specific functions that are called on child process
6 //! initialization.
7 
8 use std::path::PathBuf;
9 
10 use base::Tube;
11 use serde::Deserialize;
12 use serde::Serialize;
13 
14 use crate::log_file_from_path;
15 use crate::CommonChildStartupArgs;
16 
17 #[derive(Serialize, Deserialize)]
18 pub struct ProductAttributes {}
19 
20 impl CommonChildStartupArgs {
new( syslog_path: Option<PathBuf>, #[cfg(feature = "crash-report")] _crash_attrs: crash_report::CrashReportAttributes, metrics_tube: Option<Tube>, ) -> anyhow::Result<Self>21     pub fn new(
22         syslog_path: Option<PathBuf>,
23         #[cfg(feature = "crash-report")] _crash_attrs: crash_report::CrashReportAttributes,
24         metrics_tube: Option<Tube>,
25     ) -> anyhow::Result<Self> {
26         Ok(Self {
27             product_attrs: ProductAttributes {},
28             metrics_tube,
29             syslog_file: log_file_from_path(syslog_path)?,
30         })
31     }
32 }
33 
init_child_crash_reporting(_attrs: &ProductAttributes)34 pub(crate) fn init_child_crash_reporting(_attrs: &ProductAttributes) {
35     // Do nothing. Crash reporting is implemented by a specific product.
36 }
37 
product_child_setup(_attrs: &ProductAttributes) -> anyhow::Result<()>38 pub(crate) fn product_child_setup(_attrs: &ProductAttributes) -> anyhow::Result<()> {
39     Ok(())
40 }
41