Skip to content
Snippets Groups Projects
Commit 6b6daafa authored by Esben Haabendal's avatar Esben Haabendal
Browse files

openharmony-standard: Run hiview as systemd service


This service doesn't seem to be needed for ACTS compliance, and consumes a lot
of CPU time when activated during some ACTS tests.

Signed-off-by: default avatarEsben Haabendal <esben@geanix.com>
parent 35ebbb3c
No related branches found
No related tags found
1 merge request!109Systemd service integration and stability improvements
[Unit]
Description=OpenHarmony hiview service (SA: 1201 1202)
Wants=param.service
After=param.service
Requires=samgr.service
After=samgr.service
Wants=hilogd.service
After=hilogd.service
[Service]
Type=notify
ExecStartPre=!install -o system -g system -m 0755 -d /run/openharmony/hiview
User=system
Group=system
SupplementaryGroups=log
LimitNICE=40
ExecStart=/usr/bin/hiview
#[Install]
#WantedBy=multi-user.target
diff --git a/interfaces/native/innerkits/hisysevent.cpp b/interfaces/native/innerkits/hisysevent.cpp
index 473e84241605..2309158193fe 100644
--- a/interfaces/native/innerkits/hisysevent.cpp
+++ b/interfaces/native/innerkits/hisysevent.cpp
@@ -49,11 +49,7 @@ static constexpr unsigned int MAX_PARAM_NUMBER = 128;
static constexpr unsigned int MAX_STRING_LENGTH = 256 * 1024;
static constexpr unsigned int MAX_JSON_SIZE = 384 * 1024;
-#ifdef USE_MUSL
-static constexpr char SOCKET_FILE_DIR[] = "/dev/unix/socket/hisysevent";
-#else
-static constexpr char SOCKET_FILE_DIR[] = "/dev/socket/hisysevent";
-#endif
+static constexpr char SOCKET_FILE_DIR[] = "/run/openharmony/hiview/hisysevent";
static constexpr HiLogLabel LABEL = { LOG_CORE, 0xD002D08, "HISYSEVENT" };
diff --git a/adapter/service/idl/BUILD.gn b/adapter/service/idl/BUILD.gn
index 1120463e2264..320a8809472c 100644
--- a/adapter/service/idl/BUILD.gn
+++ b/adapter/service/idl/BUILD.gn
@@ -43,6 +43,7 @@ ohos_source_set("hiview_service_impl") {
"$hiview_base:hiviewbase",
"//utils/native/base:utils",
]
+ libs = [ "systemd"]
external_deps = [
"hilog_native:libhilog",
diff --git a/adapter/service/idl/src/hiview_service_ability.cpp b/adapter/service/idl/src/hiview_service_ability.cpp
index 757c0dbfd575..a2f1cc58845e 100644
--- a/adapter/service/idl/src/hiview_service_ability.cpp
+++ b/adapter/service/idl/src/hiview_service_ability.cpp
@@ -18,6 +18,8 @@
#include <cstdio>
#include <unistd.h>
+#include <systemd/sd-daemon.h>
+
#include "system_ability_definition.h"
#include "iservice_registry.h"
#include "ipc_skeleton.h"
@@ -89,6 +91,7 @@ void HiviewServiceAbility::StartServiceAbility(int sleepS)
if (ret == false) {
HIVIEW_LOGE("AddDeathRecipient == false");
}
+ sd_notify(0, "READY=1");
}
void HiviewServiceAbility::StartService(HiviewService *service)
diff --git a/core/event_server.cpp b/core/event_server.cpp
index 438b01ed59ea..081ecdcd9936 100644
--- a/core/event_server.cpp
+++ b/core/event_server.cpp
@@ -34,11 +34,7 @@ extern "C" {
#include "logger.h"
#include "socket_util.h"
-#ifdef USE_MUSL
-#define SOCKET_FILE_DIR "/dev/unix/socket/hisysevent"
-#else
-#define SOCKET_FILE_DIR "/dev/socket/hisysevent"
-#endif
+#define SOCKET_FILE_DIR "/run/openharmony/hiview/hisysevent"
namespace OHOS {
namespace HiviewDFX {
......@@ -87,6 +87,10 @@ SRC_URI += "file://base_hiviewdfx_hiview-libfaultlogger-static.patch;patchdir=${
SRC_URI += "file://faultloggerd-socket-path.patch;patchdir=${S}/base/hiviewdfx/faultloggerd"
SRC_URI += "file://faultloggerd-sd-notify.patch;patchdir=${S}/base/hiviewdfx/faultloggerd"
SRC_URI += "file://hiview-sd-notify.patch;patchdir=${S}/base/hiviewdfx/hiview"
SRC_URI += "file://hiview-socket-path.patch;patchdir=${S}/base/hiviewdfx/hiview"
SRC_URI += "file://hisysevent-socket-path.patch;patchdir=${S}/base/hiviewdfx/hisysevent"
# Patch to allow /system/profile and /system/usr to be symlinks to /usr/lib/openharmony
SRC_URI += "file://foundation_distributedschedule_safwk-slash-system-symlink.patch;patchdir=${S}/foundation/distributedschedule/safwk"
......@@ -1672,11 +1676,20 @@ RDEPENDS:${PN} += "${PN}-thirdparty-ejdb"
# //base/hiviewdfx/hiview
PACKAGES =+ "${PN}-hiview"
SYSTEMD_PACKAGES += "${PN}-hiview"
SYSTEMD_SERVICE:${PN}-hiview = "hiview.service"
SRC_URI += "file://hiview.service"
do_install:append() {
install -d ${D}/${systemd_unitdir}/system
install -m 644 -t ${D}${systemd_unitdir}/system/ \
${WORKDIR}/hiview.service
rm -f ${D}${sysconfdir}/openharmony/init/hiview.cfg
}
FILES:${PN}-hiview = " \
${bindir}/hiview \
${libdir}/libhiviewbase*${SOLIBS} \
"
RDEPENDS:${PN}-hiview += "musl libcxx"
RDEPENDS:${PN}-hiview += "musl libcxx libsystemd"
RDEPENDS:${PN}-hiview += " \
${PN}-libutils \
${PN}-hilog \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment