/base/startup/init/services/utils/ |
D | init_hashmap.c | 32 INIT_ERROR_CHECK(handle != NULL, return -1, "Invalid hash handle"); in OH_HashMapCreate() 33 INIT_ERROR_CHECK(info != NULL && info->maxBucket > 0, return -1, "Invalid hash info"); in OH_HashMapCreate() 34 … INIT_ERROR_CHECK(info->keyHash != NULL && info->nodeHash != NULL, return -1, "Invalid hash key"); in OH_HashMapCreate() 35 …INIT_ERROR_CHECK(info->nodeCompare != NULL && info->keyCompare != NULL, return -1, "Invalid hash c… in OH_HashMapCreate() 37 INIT_ERROR_CHECK(tab != NULL, return -1, "Failed to create hash tab"); in OH_HashMapCreate() 78 INIT_ERROR_CHECK(handle != NULL, return -1, "Invalid hash handle"); in OH_HashMapAdd() 79 INIT_ERROR_CHECK(node != NULL && node->next == NULL, return -1, "Invalid param"); in OH_HashMapAdd() 84 …INIT_ERROR_CHECK(hashCode < tab->maxBucket, return -1, "Invalid hashcode %d %d", tab->maxBucket, h… in OH_HashMapAdd() 99 INIT_ERROR_CHECK(handle != NULL && key != NULL, return, "Invalid hash handle key:%s", key); in OH_HashMapRemove() 104 …INIT_ERROR_CHECK(hashCode < tab->maxBucket, return, "Invalid hashcode %d %d", tab->maxBucket, hash… in OH_HashMapRemove() [all …]
|
D | init_utils.c | 192 INIT_ERROR_CHECK(fd >= 0, return NULL, "Failed to read file %s errno:%d", fileName, errno); in ReadFileData() 194 INIT_ERROR_CHECK(buffer != NULL, close(fd); in ReadFileData() 197 INIT_ERROR_CHECK((readLen > 0) && (readLen < (MAX_SMALL_BUFFER - 1)), close(fd); in ReadFileData() 252 …INIT_ERROR_CHECK(name != NULL && buffer != NULL && value != NULL, return -1, "Failed get parameter… in GetProcCmdlineValue() 342 INIT_ERROR_CHECK(items != NULL, return NULL, "No enough memory to store items"); in SplitStringExt() 351 INIT_ERROR_CHECK(expand != NULL, FreeStringVector(items, count); in SplitStringExt() 374 INIT_ERROR_CHECK(maxSecond <= WAIT_MAX_SECOND, maxSecond = WAIT_MAX_SECOND, in WaitForFile() 417 …INIT_ERROR_CHECK(errno == ENOENT, return NULL, "Failed to resolve %s real path err=%d", source, er… in GetRealPath() 430 INIT_ERROR_CHECK(!(rc < 0 && errno != EEXIST), return rc, in MakeDir() 525 INIT_ERROR_CHECK(pDir != NULL, return -1, "Read dir :%s failed.%d", dirPath, errno); in ReadFileInDir() [all …]
|
/base/startup/init/services/init/ |
D | init_service_file.c | 39 …INIT_ERROR_CHECK(strncpy_s(path, strlen(file->fileName) + 1, file->fileName, strlen(file->fileName… in CreateFile() 48 INIT_ERROR_CHECK(fd >= 0, return -1, "Failed open %s, err=%d ", path, errno); in CreateFile() 58 INIT_ERROR_CHECK(pathName != NULL, return -1, "Invalid fileName"); in SetFileEnv() 60 INIT_ERROR_CHECK(snprintf_s(pubName, sizeof(pubName), sizeof(pubName) - 1, in SetFileEnv() 62 … INIT_ERROR_CHECK(StringReplaceChr(pubName, '/', '_') >= 0, return -1, "Failed StringReplaceChr"); in SetFileEnv() 64 INIT_ERROR_CHECK(snprintf_s(val, sizeof(val), sizeof(val) - 1, "%d", fd) >= 0, return -1, in SetFileEnv() 67 INIT_ERROR_CHECK(ret >= 0, return -1, "Failed setenv err=%d ", errno); in SetFileEnv()
|
D | init_service_manager.c | 97 INIT_ERROR_CHECK(service != NULL, return NULL, "Failed to malloc for service"); in AddService() 207 INIT_ERROR_CHECK(argJson != NULL, return SERVICE_FAILURE, "Invalid argJson"); in GetServiceArgs() 212 INIT_ERROR_CHECK(ret, return SERVICE_FAILURE, "Invalid type"); in GetServiceArgs() 214 …INIT_ERROR_CHECK((count > 0) && (count < maxCount), return SERVICE_FAILURE, "Array size = %d is wr… in GetServiceArgs() 219 INIT_ERROR_CHECK(args->argv != NULL, return SERVICE_FAILURE, "Failed to malloc for argv"); in GetServiceArgs() 232 INIT_ERROR_CHECK(curParam != NULL, return SERVICE_FAILURE, "Invalid arg %d", i); in GetServiceArgs() 233 …INIT_ERROR_CHECK(strlen(curParam) <= MAX_ONE_ARG_LEN, return SERVICE_FAILURE, "Arg %s is tool long… in GetServiceArgs() 235 …INIT_ERROR_CHECK(args->argv[i] != NULL, return SERVICE_FAILURE, "Failed to duplicate argument %s",… in GetServiceArgs() 245 INIT_ERROR_CHECK(str != NULL, return SERVICE_FAILURE, "Invalid str"); in GetUid() 261 … INIT_ERROR_CHECK(str != NULL, return SERVICE_FAILURE, "Failed to get gid for %s", curServ->name); in GetGid() [all …]
|
D | init_common_service.c | 141 INIT_ERROR_CHECK(setgid(service->servPerm.uID) == 0, return SERVICE_FAILURE, in ServiceCheck() 145 INIT_ERROR_CHECK(setgid(service->servPerm.gIDArray[0]) == 0, return SERVICE_FAILURE, in ServiceCheck() 149 …INIT_ERROR_CHECK(setgroups(service->servPerm.gIDCnt - 1, (const gid_t *)&service->servPerm.gIDArra… in ServiceCheck() 161 INIT_ERROR_CHECK(ServiceCheck(service) == SERVICE_SUCCESS, return SERVICE_FAILURE, in SetPerms() 165 INIT_ERROR_CHECK(SetSystemSeccompPolicy(service) == SERVICE_SUCCESS, return SERVICE_FAILURE, in SetPerms() 193 INIT_ERROR_CHECK(capset(&capHeader, capData) == 0, return SERVICE_FAILURE, in SetPerms() 199 … INIT_ERROR_CHECK(SetAmbientCapability(service->servPerm.caps[i]) == 0, return SERVICE_FAILURE, in SetPerms() 242 INIT_ERROR_CHECK(service != NULL, return, "Service null"); in CloseServiceFds() 265 INIT_ERROR_CHECK(service != NULL, return, "Publish hold fds with invalid service"); in PublishHoldFds() 275 …INIT_ERROR_CHECK(!(snprintf_s((char *)fdBuffer + pos, sizeof(fdBuffer) - pos, sizeof(fdBuffer) - 1, in PublishHoldFds() [all …]
|
D | init_config.c | 40 INIT_ERROR_CHECK(root != NULL, return, "Root is null"); in ParseInitCfgContents() 56 INIT_ERROR_CHECK(fileBuf != NULL, return -1, "Failed to read file content %s", configFile); in ParseInitCfg() 59 INIT_ERROR_CHECK(fileRoot != NULL, free(fileBuf); in ParseInitCfg() 71 INIT_ERROR_CHECK(tmpParamValue != NULL, return, "Failed to alloc memory for param"); in ParseAllImports()
|
D | init_common_cmds.c | 72 INIT_ERROR_CHECK(ret == 0, free(arg); in AddOneArg() 79 INIT_ERROR_CHECK(ctx != NULL, return NULL, "Failed to get cmd args "); in BuildStringFromCmdArg() 81 INIT_ERROR_CHECK(options != NULL, return NULL, "Failed to get memory "); in BuildStringFromCmdArg() 109 INIT_ERROR_CHECK(ctx != NULL, return NULL, "Failed to malloc memory for arg"); in GetCmdArg() 156 INIT_ERROR_CHECK(cmd != NULL, return, "Invalid cmd."); in ExecCmd() 171 INIT_ERROR_CHECK(fd >= 0, return, "Failed to set %s errno: %d", procFile, errno); in SetProcName() 175 INIT_ERROR_CHECK(n == (ssize_t)size, close(fd); in SetProcName() 194 INIT_ERROR_CHECK(errno == 0, return, "cannot convert sleep time in command \" sleep \""); in DoSleep() 212 INIT_ERROR_CHECK(errno == 0, in DoWait() 306 INIT_ERROR_CHECK(file != NULL, return -1, "SetOwner invalid file."); in SetOwner() [all …]
|
D | init_capability.c | 92 INIT_ERROR_CHECK(service != NULL, return SERVICE_FAILURE, "service is null ptr."); in InitServiceCaps() 93 INIT_ERROR_CHECK(curArrItem != NULL, return SERVICE_FAILURE, "json is null ptr."); in InitServiceCaps() 99 INIT_ERROR_CHECK(capsCnt <= MAX_CAPS_CNT_FOR_ONE_SERVICE, return SERVICE_FAILURE, in InitServiceCaps() 107 INIT_ERROR_CHECK(service->servPerm.caps != NULL, return SERVICE_FAILURE, in InitServiceCaps()
|
D | init_group_manager.c | 70 INIT_ERROR_CHECK(fileBuf != NULL, return -1, "Failed to read file content %s", groupCfg); in InitParseGroupCfg_() 72 INIT_ERROR_CHECK(fileRoot != NULL, free(fileBuf); in InitParseGroupCfg_() 211 INIT_ERROR_CHECK(realPath != NULL, return -1, in InitParseGroupCfg() 229 INIT_ERROR_CHECK(type <= NODE_TYPE_MAX, return NULL, "Invalid type"); in AddGroupNode() 230 INIT_ERROR_CHECK(name != NULL, return NULL, "Invalid name"); in AddGroupNode() 238 INIT_ERROR_CHECK(groupNode != NULL, return NULL, "Failed to alloc for group %s", name); in AddGroupNode() 240 INIT_ERROR_CHECK(ret == 0, free(groupNode); in AddGroupNode() 266 INIT_ERROR_CHECK(type <= NODE_TYPE_MAX, return NULL, "Invalid type"); in GetNextGroupNode()
|
D | init_service_socket.c | 43 INIT_ERROR_CHECK(ret >= 0, return -1, "Failed to format addr %s", name); in GetSocketAddr() 65 INIT_ERROR_CHECK(ret == 0, return -1, "Failed to format addr %s", sockopt->name); in SetSocketAddr() 126 INIT_ERROR_CHECK(sockopt != NULL, return SERVICE_FAILURE, "Invalid socket options"); in CreateSocket() 135 INIT_ERROR_CHECK(sockopt->sockFd >= 0, return -1, "socket fail %d ", errno); in CreateSocket() 150 INIT_ERROR_CHECK(name != NULL, return SERVICE_FAILURE, "Invalid name"); in SetSocketEnv() 157 INIT_ERROR_CHECK(ret >= 0, return -1, "setenv fail %d ", errno); in SetSocketEnv()
|
/base/startup/init/services/init/standard/ |
D | init_service.c | 49 INIT_ERROR_CHECK(ret > 0, return, "Failed to format service name %s.", service->name); in NotifyServiceChange() 52 INIT_ERROR_CHECK(ret > 0, return, "Failed to format service status %s.", service->name); in NotifyServiceChange() 58 INIT_ERROR_CHECK(ret > 0, return, "Failed to format service pid name %s.", service->name); in NotifyServiceChange() 61 INIT_ERROR_CHECK(ret > 0, return, "Failed to format service pid %s.", service->name); in NotifyServiceChange() 75 INIT_ERROR_CHECK(service != NULL, return SERVICE_FAILURE, "Set service attr failed! null ptr."); in SetImportantValue() 88 INIT_ERROR_CHECK(service != NULL && service->pathArgs.count > 0, in ServiceExec() 91 INIT_ERROR_CHECK(setpriority(PRIO_PROCESS, 0, service->importance) == 0, _exit(0x7f), in ServiceExec() 107 INIT_ERROR_CHECK(service != NULL, return SERVICE_FAILURE, "service is null"); in SetAccessToken() 167 INIT_ERROR_CHECK(execPath != NULL, return, "Service path is null."); in SetServiceEnterSandbox()
|
D | init_cmdexecutor.c | 31 INIT_ERROR_CHECK(cmdName != NULL, return -1, "Invalid input param"); in AddCmdExecutor_() 37 INIT_ERROR_CHECK(groupNode != NULL, return -1, "Failed to create group node"); in AddCmdExecutor_() 42 INIT_ERROR_CHECK(cmd != NULL, return -1, "Failed to create cmd condition"); in AddCmdExecutor_() 53 INIT_ERROR_CHECK(cmdExec != NULL, return -1, "Failed to create cmd listener"); in AddCmdExecutor_() 73 INIT_ERROR_CHECK(cmdName != NULL, return, "Invalid input param"); in RemoveCmdExecutor() 75 INIT_ERROR_CHECK(groupNode != NULL && groupNode->data.cmd != NULL, in RemoveCmdExecutor() 120 INIT_ERROR_CHECK(name != NULL, return, "Invalid cmd for %s", cmdContent); in PluginExecCmdByName() 131 INIT_ERROR_CHECK(name != NULL, return -1, "Invalid cmd "); in PluginExecCmd() 215 INIT_ERROR_CHECK(groupNode != NULL && groupNode->data.cmd != NULL, in PluginGetCmdIndex()
|
D | init_mount.c | 28 INIT_ERROR_CHECK(fstab != NULL, return -1, "fstab is NULL"); in MountRequriedPartitions() 43 INIT_ERROR_CHECK(access(fstabFile, F_OK) == 0, return NULL, "Failed get fstab.required"); in LoadRequiredFstab()
|
D | init_cmds.c | 70 INIT_ERROR_CHECK(ret == EOK, return -1, "Failed to copy start %s", start); in GetParamValue() 74 INIT_ERROR_CHECK(ret == 0, return -1, "Failed to copy first value %s", symValue); in GetParamValue() 87 INIT_ERROR_CHECK(ret == EOK, return -1, "Invalid param name %s", symValue); in GetParamValue() 94 INIT_ERROR_CHECK(ret == 0, return -1, "Failed to get param %s", tmpName); in GetParamValue() 109 INIT_ERROR_CHECK(!(pid < 0), return -1, "Fork new process to format failed: %d", errno); in SyncExecCommand() 127 …INIT_ERROR_CHECK(strncpy_s(interface.ifr_name, IFNAMSIZ - 1, ctx->argv[0], strlen(ctx->argv[0])) =… in DoIfup() 132 INIT_ERROR_CHECK(fd >= 0, return, "DoIfup failed to create socket, err = %d", errno); in DoIfup() 152 … INIT_ERROR_CHECK(fileName != NULL, return, "Can not find file name from param %s", ctx->argv[0]); in DoInsmod() 155 …INIT_ERROR_CHECK(realPath != NULL, return, "Can not get real file name from param %s", ctx->argv[0… in DoInsmod() 210 INIT_ERROR_CHECK(ctx != NULL && ctx->argv[0] != NULL, return, "DoSyncExec: invalid arguments"); in DoSyncExec() [all …]
|
D | switch_root.c | 151 INIT_ERROR_CHECK(stat("/", &oldRootStat) == 0, return -1, "Failed to get old root \"/\" stat"); in SwitchRoot() 153 INIT_ERROR_CHECK(oldRoot != NULL, return -1, "Failed to open root dir \"/\""); in SwitchRoot()
|
D | init.c | 147 INIT_ERROR_CHECK(devices != NULL, return NULL, "Failed calloc err=%d", errno); in GetRequiredDevices() 154 INIT_ERROR_CHECK(devices[i] != NULL, FreeStringVector(devices, num); return NULL, in GetRequiredDevices() 166 INIT_ERROR_CHECK(requiredDevices != NULL && num > 0, return -1, "Failed parameters"); in StartUeventd()
|
/base/startup/init/interfaces/innerkits/init_module_engine/ |
D | init_modulemgr.c | 66 INIT_ERROR_CHECK(argv != NULL && argc >= 1, return -1, "Invalid install parameter"); in ModuleMgrCmdInstall() 72 INIT_ERROR_CHECK(ret == 0, return ret, "Install module %s fail errno %d", argv[0], ret); in ModuleMgrCmdInstall() 78 INIT_ERROR_CHECK(argv != NULL && argc >= 1, return -1, "Invalid install parameter"); in ModuleMgrCmdUninstall()
|
/base/startup/init/services/init/lite/ |
D | init_service.c | 58 INIT_ERROR_CHECK(service != NULL, return SERVICE_FAILURE, "Set service attr failed! null ptr."); in SetImportantValue() 67 INIT_ERROR_CHECK(service != NULL && service->pathArgs.count > 0, in ServiceExec()
|
D | init_cmds.c | 59 INIT_ERROR_CHECK(path != NULL, return false, "Invalid path for cfg"); in CheckValidCfg() 82 INIT_ERROR_CHECK(realPath != NULL, return, "Failed to get realpath %s", ctx->argv[0]); in DoLoadCfg()
|
/base/startup/init/ueventd/ |
D | ueventd_read_cfg.c | 89 INIT_ERROR_CHECK(errno == 0, config->mode = DEVMODE, in ParseDeviceConfig() 129 INIT_ERROR_CHECK(errno == 0, config->mode = DEVMODE, in ParseSysfsConfig() 141 INIT_ERROR_CHECK(!INVALIDSTRING(p), return -1, "Invalid argument"); in ParseFirmwareConfig() 145 INIT_ERROR_CHECK(stat(p, &st) == 0, return -1, "Invalid firmware file: %s, err = %d", p, errno); in ParseFirmwareConfig() 146 INIT_ERROR_CHECK(S_ISDIR(st.st_mode), return -1, "Expect directory in firmware config"); in ParseFirmwareConfig() 239 INIT_ERROR_CHECK(fd >= 0, return, "Read from %s failed", file); in ParseUeventdConfigFile()
|
D | ueventd.c | 201 INIT_ERROR_CHECK(devices != NULL && num > 0, return, "Fault parameters"); in HandleUeventRequired()
|
/base/startup/init/test/exec_test/ |
D | client.c | 45 INIT_ERROR_CHECK(ret >= 0, return -1, "Failed to format addr"); in main()
|
/base/startup/init/services/log/ |
D | init_log.h | 83 #define INIT_ERROR_CHECK(ret, statement, format, ...) \ macro
|
/base/startup/init/test/unittest/param/ |
D | trigger_unittest.cpp | 87 … INIT_ERROR_CHECK(fileBuf != nullptr, return -1, "Failed to read file content %s", configFile); in ParseInitCfg() 89 … INIT_ERROR_CHECK(fileRoot != nullptr, return -1, "Failed to parse json file %s", configFile); in ParseInitCfg()
|