• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef PLUGIN_BOOT_EVENT_H
16 #define PLUGIN_BOOT_EVENT_H
17 #include <sys/types.h>
18 #include "init_module_engine.h"
19 #include "list.h"
20 
21 #ifdef __cplusplus
22 #if __cplusplus
23 extern "C" {
24 #endif
25 #endif
26 
27 #define BOOTEVENT_TYPE_CMD      1
28 #define BOOTEVENT_TYPE_JOB      2
29 #define BOOTEVENT_TYPE_SERVICE  3
30 
31 #define BOOT_EVENT_PARA_PREFIX      "bootevent."
32 #define BOOT_EVENT_PARA_PREFIX_LEN  10
33 #define BOOT_EVENT_TIMESTAMP_MAX_LEN  50
34 #define BOOT_EVENT_FILEPATH_MAX_LEN  60
35 #define BOOT_EVENT_FINISH  2
36 #define MSECTONSEC 1000000
37 #define SECTONSEC  1000000000
38 #define USTONSEC  1000
39 #define SAVEINITBOOTEVENTMSEC  100000
40 #define BOOTEVENT_OUTPUT_PATH "/data/service/el0/startup/init/"
41 
42 enum {
43     BOOTEVENT_FORK,
44     BOOTEVENT_READY,
45     BOOTEVENT_MAX
46 };
47 
48 typedef struct tagBOOT_EVENT_PARAM_ITEM {
49     ListNode    node;
50     char  *paramName;
51     int pid;
52     struct timespec timestamp[BOOTEVENT_MAX];
53     int flags;
54 } BOOT_EVENT_PARAM_ITEM;
55 
56 int GetBootEventEnable(void);
57 ListNode *GetBootEventList(void);
58 
59 #ifdef __cplusplus
60 #if __cplusplus
61 }
62 #endif
63 #endif
64 #endif /* PLUGIN_BOOT_EVENT_H */
65