* Copyright (C) 2025 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef APPSPAWN_ERROR_H
#define APPSPAWN_ERROR_H
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
#define OHOS_SUBSYS_STARTUP_ID 39
#define OHOS_SUBSYSTEM_BIT_NUM 21
#define OHOS_MODULE_BIT_NUM 16
#define OHOS_SUBMODULE_BIT_NUM 12
#define DECLARE_APPSPAWN_ERRORCODE_BASE(module) \
((uint32_t)(((module) & 0x0f) << OHOS_MODULE_BIT_NUM) | (OHOS_SUBSYS_STARTUP_ID << OHOS_SUBSYSTEM_BIT_NUM))
#define DECLARE_APPSPAWN_ERRORCODE_SUBMODULE_BASE(module, submodule) \
((uint32_t)(DECLARE_APPSPAWN_ERRORCODE_BASE(module) | (((submodule) & 0x0f) << OHOS_SUBMODULE_BIT_NUM)))
#define DECLARE_APPSPAWN_ERRORCODE(module, submodule, error) \
((uint32_t)(DECLARE_APPSPAWN_ERRORCODE_SUBMODULE_BASE((module), (submodule)) | ((error) & 0x0fff)))
* APPSPAWN_UTILS: 0x04E00000 ~ 0x04E0FFFF appspawn公共调试日志错误码范围
* APPSPAWN_SPAWNER: 0x04E10000 ~ 0x04E1FFFF 孵化器调试日志错误码范围
* APPSPAWN_SANDBOX: 0x04E20000 ~ 0x04E2FFFF 沙箱调试日志错误码范围
* APPSPAWN_HNP: 0x04E30000 ~ 0x04E3FFFF hnp调试日志错误码范围
* APPSPAWN_DEVICE_DEBUG: 0x04E40000 ~ 0x04E4FFFF devicedebug调试日志错误码范围
*/
typedef enum {
APPSPAWN_UTILS = 0,
APPSPAWN_SPAWNER,
APPSPAWN_SANDBOX,
APPSPAWN_HNP,
APPSPAWN_DEVICE_DEBUG,
} AppSpawnErrorCodeModuleType;
typedef enum {
APPSPAWN_UTILS_COMMON = 0,
APPSPAWN_UTILS_ARCH,
APPSPAWN_SUB_MODULE_UTILS_COUNT
} AppSpawnSubModuleUtils;
typedef enum {
APPSPAWN_SPAWNER_COMMON = 0,
APPSPAWN_SUB_MODULE_SPAWNER_COUNT
} AppSpawnSubModuleSpawner;
typedef enum {
APPSPAWN_SANDBOX_COMMON = 0,
APPSPAWN_SUB_MODULE_SANDBOX_COUNT
} AppSpawnSubModuleSandbox;
typedef enum {
APPSPAWN_HNP_COMMON = 0,
APPSPAWN_SUB_MODULE_HNP_COUNT
} AppSpawnSubModuleHnp;
typedef enum {
APPSPAWN_DEVICEDEBUG_COMMON = 0,
APPSPAWN_SUB_MODULE_DEVICEDEBUG_COUNT
} AppSpawnSubModuleDeviceDebug;
typedef enum {
APPSPAWN_ERROR_MSG_TO_LONG = DECLARE_APPSPAWN_ERRORCODE(APPSPAWN_SPAWNER, APPSPAWN_UTILS_COMMON, 0x0000),
APPSPAWN_ERROR_MSG_INVALID,
} SpawnerErrorCode;
typedef enum {
SANDBOX_ERROR_ARGS_INVALID = DECLARE_APPSPAWN_ERRORCODE(APPSPAWN_SANDBOX, APPSPAWN_SANDBOX_COMMON, 0x0000),
SANDBOX_ERROR_MSG_INVALID,
} SandboxErrorCode;
#ifdef __cplusplus
}
#endif
#endif