/base/startup/init/interfaces/innerkits/service_control/ |
H A D | service_control.c | 72 static int StopProcess(const char *serviceName) in StopProcess() argument 74 BEGET_ERROR_CHECK(serviceName != NULL, return -1, "Service name is null."); in StopProcess() 75 return SystemSetParameter("ohos.ctl.stop", serviceName); in StopProcess() 78 static int GetCurrentServiceStatus(const char *serviceName, ServiceStatus *status) in GetCurrentServiceStatus() argument 82 "%s.%s", STARTUP_SERVICE_CTL, serviceName) == -1) { in GetCurrentServiceStatus() 91 static int RestartProcess(const char *serviceName, const char *extArgv[], int extArgc) in RestartProcess() argument 93 BEGET_ERROR_CHECK(serviceName != NULL, return -1, "Service name is null."); in RestartProcess() 95 if (GetCurrentServiceStatus(serviceName, &status) != 0) { in RestartProcess() 99 BEGET_LOGE("Process service %s status: %d ", serviceName, status); in RestartProcess() 101 if (StopProcess(serviceName) ! in RestartProcess() 122 ServiceControlWithExtra(const char *serviceName, int action, const char *extArgv[], int extArgc) ServiceControlWithExtra() argument 144 ServiceControl(const char *serviceName, int action) ServiceControl() argument 151 GetProcessInfo(const char *serviceName, char *nameBuffer, char *valueBuffer, ServiceStatus status) GetProcessInfo() argument 165 ServiceWaitForStatus(const char *serviceName, ServiceStatus status, int waitTimeout) ServiceWaitForStatus() argument 176 ServiceSetReady(const char *serviceName) ServiceSetReady() argument 186 StartServiceByTimer(const char *serviceName, uint64_t timeout) StartServiceByTimer() argument 202 StopServiceTimer(const char *serviceName) StopServiceTimer() argument [all...] |
/base/startup/init/test/moduletest/ |
H A D | service_control_test.cpp | 45 std::string serviceName = "media_service"; in HWTEST_F() local 46 auto status = GetServiceStatus(serviceName); in HWTEST_F() 48 int ret = ServiceControl(serviceName.c_str(), STOP); in HWTEST_F() 50 ret = ServiceWaitForStatus(serviceName.c_str(), SERVICE_STOPPED, WAIT_SERVICE_STATUS_TIMEOUT); in HWTEST_F() 53 std::cout << serviceName << " in invalid status " << status << std::endl; in HWTEST_F() 54 std::cout << "Debug " << serviceName << " in unexpected status " << status << std::endl; in HWTEST_F() 59 int ret = ServiceControl(serviceName.c_str(), START); in HWTEST_F() 61 ret = ServiceWaitForStatus(serviceName.c_str(), SERVICE_STARTED, WAIT_SERVICE_STATUS_TIMEOUT); in HWTEST_F() 63 status = GetServiceStatus(serviceName); in HWTEST_F() 64 std::cout << "Debug " << serviceName << " i in HWTEST_F() 70 std::string serviceName = "non_exist_service"; HWTEST_F() local 80 std::string serviceName = "media_service"; HWTEST_F() local 103 std::string serviceName = "non_exist_service"; HWTEST_F() local 114 std::string serviceName = "media_service"; HWTEST_F() local 144 std::string serviceName = "media_service"; HWTEST_F() local 172 std::string serviceName = "media_service"; HWTEST_F() local 204 std::string serviceName = "media_service"; HWTEST_F() local 225 std::string serviceName = "media_service"; HWTEST_F() local 249 std::string serviceName = "media_service"; HWTEST_F() local 261 std::cout << "Wait for service " << serviceName << " status change to start\\n"; HWTEST_F() local 266 std::cout << "Wait for service " << serviceName << " status change to stop\\n"; HWTEST_F() local [all...] |
H A D | service_watcher_moduleTest.cpp | 46 string serviceName = "test.Service"; in HWTEST_F() local 47 int ret = ServiceWatchForStatus(serviceName.c_str(), ServiceStatusChange); in HWTEST_F() 49 auto status = GetServiceStatus(serviceName); in HWTEST_F() 57 string serviceName = "media_service"; in HWTEST_F() local 58 auto status = GetServiceStatus(serviceName); in HWTEST_F() 60 int ret = ServiceControl(serviceName.c_str(), STOP); in HWTEST_F() 63 std::cout << serviceName << " in invalid status " << status << std::endl; in HWTEST_F() 66 int ret = ServiceWatchForStatus(serviceName.c_str(), ServiceStatusChange); in HWTEST_F() 68 status = GetServiceStatus(serviceName); in HWTEST_F() 76 const std::string serviceName in HWTEST_F() local [all...] |
/base/startup/init/interfaces/innerkits/include/ |
H A D | service_control.h | 49 int ServiceControlWithExtra(const char *serviceName, int action, const char *extArgv[], int extArgc); 50 int ServiceControl(const char *serviceName, int action); 51 int ServiceWaitForStatus(const char *serviceName, ServiceStatus status, int waitTimeout); 52 int ServiceSetReady(const char *serviceName); 53 int StartServiceByTimer(const char *serviceName, uint64_t timeout); 54 int StopServiceTimer(const char *serviceName);
|
H A D | fd_holder.h | 24 int *ServiceGetFd(const char *serviceName, size_t *fdCount); 29 int ServiceSaveFdWithPoll(const char *serviceName, int *fds, int fdCount); 34 int ServiceSaveFd(const char *serviceName, int *fds, int fdCount);
|
/base/hiviewdfx/hiview/test/moduletest/common/ |
H A D | hiview_plugin_platform_module_test.cpp | 46 int GetServicePid(const std::string& serviceName)
in GetServicePid() argument 48 std::string cmd = "pidof " + serviceName;
in GetServicePid() 52 printf("the pid of service(%s) is %s \n", serviceName.c_str(), pidStr.c_str());
in GetServicePid() 56 void WaitForServiceReady(const std::string& serviceName)
in WaitForServiceReady() argument 58 int pid = GetServicePid(serviceName);
in WaitForServiceReady() 60 std::string cmd = "start " + serviceName;
in WaitForServiceReady() 64 pid = GetServicePid(serviceName);
in WaitForServiceReady()
|
/base/startup/init/interfaces/innerkits/fd_holder/ |
H A D | fd_holder.c | 47 STATIC int BuildSendData(char *buffer, size_t size, const char *serviceName, bool hold, bool poll) in BuildSendData() argument 49 if (buffer == NULL || size == 0 || serviceName == 0) { in BuildSendData() 67 if (snprintf_s(buffer, size, size - 1, "%s|%s|%s", serviceName, holdString, pollString) == -1) { in BuildSendData() 74 static int ServiceSendFds(const char *serviceName, int *fds, int fdCount, bool doPoll) in ServiceSendFds() argument 86 int ret = BuildSendData(sendBuffer, sizeof(sendBuffer), serviceName, true, doPoll); in ServiceSendFds() 125 int ServiceSaveFd(const char *serviceName, int *fds, int fdCount) in ServiceSaveFd() argument 128 if (serviceName == NULL || fds == NULL || in ServiceSaveFd() 133 return ServiceSendFds(serviceName, fds, fdCount, false); in ServiceSaveFd() 136 int ServiceSaveFdWithPoll(const char *serviceName, int *fds, int fdCount) in ServiceSaveFdWithPoll() argument 139 if (serviceName in ServiceSaveFdWithPoll() 147 ServiceGetFd(const char *serviceName, size_t *outfdCount) ServiceGetFd() argument [all...] |
/base/security/selinux_adapter/framework/policycoreutils/src/ |
H A D | service_checker.cpp | 70 extern "C" int HdfGetServiceCheck(const char *callingSid, const char *serviceName) in HdfGetServiceCheck() argument 72 if (callingSid == nullptr || serviceName == nullptr) { in HdfGetServiceCheck() 75 return ServiceChecker::GetInstance().GetServiceCheck(callingSid, serviceName); in HdfGetServiceCheck() 78 extern "C" int HdfAddServiceCheck(const char *callingSid, const char *serviceName) in HdfAddServiceCheck() argument 80 if (callingSid == nullptr || serviceName == nullptr) { in HdfAddServiceCheck() 83 return ServiceChecker::GetInstance().AddServiceCheck(callingSid, serviceName); in HdfAddServiceCheck() 146 contextBuff.serviceName = name; in DecodeString() 157 static int CheckServiceNameValid(const std::string &serviceName) in CheckServiceNameValid() argument 159 if (serviceName.empty() || serviceName[ in CheckServiceNameValid() 204 GetServiceContext(const std::string &serviceName, std::string &context) GetServiceContext() argument 242 CheckPerm(const std::string &srcContext, const std::string &serviceName, std::string action) CheckPerm() argument 280 GetServiceCheck(const std::string &callingSid, const std::string &serviceName) GetServiceCheck() argument 294 AddServiceCheck(const std::string &callingSid, const std::string &serviceName) AddServiceCheck() argument [all...] |
/base/security/selinux_adapter/framework/tools/service_check/ |
H A D | test.cpp | 38 std::string serviceName; member 47 std::cout << " -n (--serviceName) serviceName. [eg: service_check -n service_name]" in PrintUsage() 78 input.serviceName = optarg; in SetOptions() 119 static void TestAddService(bool isHdf, const std::string &serviceName) in TestAddService() argument 125 if (!serviceName.empty()) { in TestAddService() 126 std::cout << GetErrStr(isHdf ? HdfAddServiceCheck(sid.c_str(), serviceName.c_str()) in TestAddService() 127 : g_service->AddServiceCheck(sid, serviceName)) in TestAddService() 139 static void TestGetService(bool isHdf, const std::string &serviceName) in TestGetService() argument 145 if (!serviceName in TestGetService() 159 TestGetRemoteService(bool isHdf, const std::string &serviceName) TestGetRemoteService() argument [all...] |
/base/security/selinux_adapter/interfaces/policycoreutils/include/ |
H A D | service_checker.h | 24 std::string serviceName = ""; member 34 int GetServiceCheck(const std::string &callingSid, const std::string &serviceName); 38 int AddServiceCheck(const std::string &callingSid, const std::string &serviceName); 44 int CheckPerm(const std::string &callingSid, const std::string &serviceName, std::string action); 45 int GetServiceContext(const std::string &serviceName, std::string &context);
|
H A D | hdf_service_checker.h | 25 int HdfGetServiceCheck(const char *callingSid, const char *serviceName);
26 int HdfAddServiceCheck(const char *callingSid, const char *serviceName);
|
/base/startup/init/services/modules/selinux/ |
H A D | selinux_static.c | 33 PLUGIN_CHECK(fieldStr != NULL, return, "No secon item in %s", serviceParseCtx->serviceName); in ServiceParseSelinuxHook() 34 PLUGIN_LOGV("Cfg %s for %s", fieldStr, serviceParseCtx->serviceName); in ServiceParseSelinuxHook() 35 DelServiceExtData(serviceParseCtx->serviceName, HOOK_ID_SELINUX); in ServiceParseSelinuxHook() 36 AddServiceExtData(serviceParseCtx->serviceName, HOOK_ID_SELINUX, fieldStr, strlen(fieldStr) + 1); in ServiceParseSelinuxHook()
|
/base/useriam/user_auth_framework/test/unittest/executors/ |
H A D | driver_manager_unit_test.cpp | 61 std::string serviceName = "mockDriver"; in HWTEST_F() local 67 hdiName2Config.emplace(serviceName, config); in HWTEST_F() 69 EXPECT_EQ(DriverManager::GetInstance().GetDriverByServiceName(serviceName), nullptr); in HWTEST_F() 72 DriverManager::GetInstance().GetDriverByServiceName(serviceName); in HWTEST_F() 81 std::string serviceName = "mockDriver"; in HWTEST_F() local 87 hdiName2Config.emplace(serviceName, config); in HWTEST_F()
|
/base/startup/init/services/begetctl/ |
H A D | sandbox.cpp | 169 static void RunCmd(const std::string &serviceName, const std::string &namespaceName, const std::string &processName, in RunCmd() argument 172 bool isNamespaceOnly = !namespaceName.empty() && processName.empty() && serviceName.empty() && pid.empty(); in RunCmd() 173 bool isNamespaceAndProcess = !namespaceName.empty() && !processName.empty() && serviceName.empty() && pid.empty(); in RunCmd() 174 bool isProcessOnly = namespaceName.empty() && !processName.empty() && serviceName.empty() && pid.empty(); in RunCmd() 175 bool isServiceOnly = namespaceName.empty() && processName.empty() && !serviceName.empty() && pid.empty(); in RunCmd() 176 bool isPidOnly = namespaceName.empty() && processName.empty() && serviceName.empty() && !pid.empty(); in RunCmd() 188 std::cout << "enter sandbox service name " << serviceName << std::endl; in RunCmd() 189 CmdClientInit(INIT_CONTROL_FD_SOCKET_PATH, ACTION_SANDBOX, serviceName.c_str(), nullptr); in RunCmd() 201 std::string serviceName {}; in main_cmd() 210 serviceName in main_cmd() [all...] |
/base/startup/init/interfaces/innerkits/service_watcher/ |
H A D | service_watcher.c | 50 int ServiceWatchForStatus(const char *serviceName, ServiceStatusChangePtr changeCallback) in ServiceWatchForStatus() argument 52 BEGET_ERROR_CHECK(serviceName != NULL, return EC_INVALID, "Service watch failed, service is null."); in ServiceWatchForStatus() 56 BEGET_LOGI("Watcher service %s status", serviceName); in ServiceWatchForStatus() 58 "%s.%s", STARTUP_SERVICE_CTL, serviceName) == -1) { in ServiceWatchForStatus() 64 BEGET_LOGE("Failed to watcher service %s ret %d.", serviceName, ret); in ServiceWatchForStatus()
|
/base/startup/init/services/init/standard/ |
H A D | init_signal_handler.c | 38 const char *serviceName = (service == NULL) ? "Unknown" : service->name;
in HandleSigChild() local 42 INIT_LOGW("Child process %s(pid %d) exit with signal : %d", serviceName, sigPID, WTERMSIG(procStat));
in HandleSigChild() 44 INIT_LOGW("Child process %s(pid %d) exit with code : %d", serviceName, sigPID, WEXITSTATUS(procStat));
in HandleSigChild() 52 serviceName, sigPID, siginfo->ssi_uid, procStat);
in HandleSigChild()
|
H A D | fd_holder_service.c | 58 static void SendErrorInfo(int sock, const char *errInfo, const char *serviceName) in SendErrorInfo() argument 87 INIT_LOGE("Failed to send err info to service \' %s \', err = %d", serviceName, errno); in SendErrorInfo() 139 char *serviceName = msg[0]; in HandlerFdHolder() local 143 Service *service = GetServiceByName(serviceName); in HandlerFdHolder() 145 SendErrorInfo(sock, "Invalid service", serviceName); in HandlerFdHolder() 154 INIT_LOGI("Service \' %s \' request init to %s fds", serviceName, action); in HandlerFdHolder()
|
/base/startup/init/services/modules/init_hook/ |
H A D | init_hook.h | 47 ServiceExtData *AddServiceExtData(const char *serviceName, uint32_t id, void *data, uint32_t dataLen);
48 void DelServiceExtData(const char *serviceName, uint32_t id);
49 ServiceExtData *GetServiceExtData(const char *serviceName, uint32_t id);
|
H A D | init_hook.c | 43 ServiceExtData *AddServiceExtData(const char *serviceName, uint32_t id, void *data, uint32_t dataLen)
in AddServiceExtData() argument 45 Service *service = GetServiceByName(serviceName);
in AddServiceExtData() 46 PLUGIN_CHECK(service != NULL, return NULL, "Can not find service for %s", serviceName);
in AddServiceExtData() 69 void DelServiceExtData(const char *serviceName, uint32_t id)
in DelServiceExtData() argument 71 Service *service = GetServiceByName(serviceName);
in DelServiceExtData() 72 PLUGIN_CHECK(service != NULL, return, "Can not find service for %s", serviceName);
in DelServiceExtData() 81 ServiceExtData *GetServiceExtData(const char *serviceName, uint32_t id)
in GetServiceExtData() argument 83 Service *service = GetServiceByName(serviceName);
in GetServiceExtData() 84 PLUGIN_CHECK (service != NULL, return NULL, "Can not find service for %s", serviceName);
in GetServiceExtData()
|
/base/startup/init/test/unittest/service_watcher/ |
H A D | service_watcher_unittest.cpp | 57 string serviceName = "test.Service"; in HWTEST_F() local 58 int ret = ServiceWatchForStatus(serviceName.c_str(), ServiceStatusChange); in HWTEST_F() 60 auto status = GetServiceStatus(serviceName); in HWTEST_F()
|
/base/useriam/user_auth_framework/frameworks/native/executors/src/ |
H A D | driver_manager.cpp | 107 auto driver = DriverManager::GetInstance().GetDriverByServiceName(status.serviceName); in SubscribeHdiDriverStatus() 112 IAM_LOGI("service %{public}s receive status %{public}d", status.serviceName.c_str(), status.status); in SubscribeHdiDriverStatus() 115 IAM_LOGI("service %{public}s status change to start", status.serviceName.c_str()); in SubscribeHdiDriverStatus() 119 UserIam::UserAuth::ReportSystemFault(Common::GetNowTimeString(), status.serviceName); in SubscribeHdiDriverStatus() 120 IAM_LOGI("service %{public}s status change to stop", status.serviceName.c_str()); in SubscribeHdiDriverStatus() 124 IAM_LOGI("service %{public}s status ignored", status.serviceName.c_str()); in SubscribeHdiDriverStatus() 230 std::shared_ptr<Driver> DriverManager::GetDriverByServiceName(const std::string &serviceName) in GetDriverByServiceName() argument 234 auto driverIter = serviceName2Driver_.find(serviceName); in GetDriverByServiceName()
|
/base/startup/init/services/modules/bootevent/ |
H A D | bootevent.c | 102 static void SetServiceBooteventHookMgr(const char *serviceName, const char *paramName, int state)
in SetServiceBooteventHookMgr() argument 106 context.serviceName = serviceName;
in SetServiceBooteventHookMgr() 114 static int AddServiceBootEvent(const char *serviceName, const char *paramName)
in AddServiceBootEvent() argument 127 extData = AddServiceExtData(serviceName, i, NULL, sizeof(BOOT_EVENT_PARAM_ITEM));
in AddServiceBootEvent() 138 DelServiceExtData(serviceName, extData->dataId);
in AddServiceBootEvent() 142 SetServiceBooteventHookMgr(serviceName, paramName, 1);
in AddServiceBootEvent() 374 ctx.serviceName = serviceParseCtx->serviceName;
in ServiceParseBootEventHook() 378 if (AddServiceBootEvent(serviceParseCtx->serviceName,
in ServiceParseBootEventHook() [all...] |
/base/hiviewdfx/faultloggerd/test/moduletest/ |
H A D | faultloggerd_module_test.cpp | 29 void WaitForServiceReady(const std::string& serviceName) in WaitForServiceReady() argument 31 int pid = GetProcessPid(serviceName); in WaitForServiceReady() 33 std::string cmd = "start " + serviceName; in WaitForServiceReady() 37 pid = GetProcessPid(serviceName); in WaitForServiceReady()
|
/base/startup/init/interfaces/innerkits/init_module_engine/include/ |
H A D | bootstage.h | 116 const char *serviceName; /* Service name */ member 132 const char *serviceName; /* Service name */ member 140 const char *serviceName; /* Service name */ member 149 const char *serviceName; /* Service name */ member
|
/base/startup/appspawn/test/unittest/devicedebug_test/ |
H A D | devicedebug_stub.c | 43 int AppSpawnClientInitStub(const char *serviceName, AppSpawnClientHandle *handle) in AppSpawnClientInitStub() argument 45 (void)serviceName; in AppSpawnClientInitStub()
|