separate systemd service for gen_rm_msgq and rsc_mgr_server to apply a different setting.
gen_rm_msgq:
Run as User::App::Shared to make message queue sharable with clients
Change rsc_mgr_ready path (/run -> /tmp) because of User::App:Shared
rsc_mgr_server:
Set user/group as multimedia_fw/multimedia_fw
Set process label as System
Add rscmgr-service.conf for dbus conf
Change-Id: I6c11fdd4f563ac3a3ea258879cdcc8b7f41e5ec6
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<node>
- <interface name="com.samsung.rmservice">
- <annotation name= "com.Samsung.Exportable" value= "true"/>
- <method name="TestCall">
- <arg type="i" name="in_data" direction="in"/>
- <arg type="i" name="out_data" direction="out"/>
- </method>
- <method name="NotifyAllocation">
- <arg type="i" name="cid" direction="in"/>
- <arg type="i" name="pid" direction="in"/>
- <arg type="ai" name="alloc_list" direction="in"/>
- <arg type="i" name="ret" direction="out"/>
- <arg type="ai" name="ret_list" direction="out"/>
- </method>
- <method name="NotifyConsumerTobeReturned">
- <arg type="i" name="cid" direction="in"/>
- <arg type="i" name="pid" direction="in"/>
- <arg type="ai" name="alloc_list" direction="in"/>
- <arg type="i" name="ret" direction="out"/>
- <arg type="ai" name="cid_list" direction="out"/>
- <arg type="ai" name="pid_list" direction="out"/>
- <arg type="ai" name="conflict_rsc_num_list" direction="out"/>
- <arg type="ai" name="devices" direction="out"/>
- <arg type="ai" name="num_of_rsc" direction="out"/>
- </method>
- <method name="NotifyDeallocation">
- <arg type="i" name="cid" direction="in"/>
- <arg type="ai" name="dealloc_list" direction="in"/>
- <arg type="i" name="ret_val" direction="out"/>
- </method>
- <method name="NotifyDeallocationByCid">
- <arg type="i" name="cid" direction="in"/>
- <arg type="i" name="ret_val" direction="out"/>
- </method>
- <method name="NotifyDeallocationByPid">
- <arg type="i" name="pid" direction="in"/>
- <arg type="i" name="ret_val" direction="out"/>
- </method>
- <method name="NotifyCallback">
- <arg type="ai" name="list" direction="in"/>
- <arg type="i" name="ret_val" direction="out"/>
- </method>
- </interface>
-</node>
--- /dev/null
+[Unit]
+Description=Generate RM Message Queue
+DefaultDependencies=no
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/gen_rm_msgq
+
+[Install]
+WantedBy=rscmgr-service.service
--- /dev/null
+<!DOCTYPE busconfig PUBLIC
+ "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+
+ <policy user="multimedia_fw">
+ <allow own="rscmgr.resource"/>
+ <allow send_destination="rscmgr.resource"/>
+ </policy>
+
+ <policy group="users">
+ <allow send_destination="rscmgr.resource"/>
+ </policy>
+
+ <policy context="default">
+ <deny own="rscmgr.resource"/>
+ <allow send_destination="rscmgr.resource"/>
+ </policy>
+
+</busconfig>
[Unit]
-Description=service for resource manager
-DefaultDependencies=no
+Description=Resource Manager Service
+Requires=rscmgr-msgq.service
+After=rscmgr-msgq.service
[Service]
Type=simple
+User=multimedia_fw
+Group=multimedia_fw
SmackProcessLabel=System
Environment=LD_USE_LOAD_BIAS=1
-ExecStartPre=/usr/bin/gen_rm_msgq
ExecStart=/usr/bin/rscmgr-service
Restart=always
MemoryMax=10M
Name: rscmgr-service
Summary: Daemon for resource manager
Version: 0.1
-Release: 7
+Release: 8
Group: Multimedia/Libraries
License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
Source1: rscmgr-service.service
-Source2: rscmgr-service-asan.conf
+Source2: rscmgr-msgq.service
+Source3: rscmgr-service-asan.conf
+Source4: rscmgr-service.conf
BuildRequires: cmake >= 2.8.12
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(resource-information)
BuildRequires: pkgconfig(capi-system-info)
BuildRequires: pkgconfig(aul)
+BuildRequires: pkgconfig(dbus-1)
BuildRequires: python
BuildRequires: python-xml
BuildRequires: pkgconfig(libtzplatform-config)
BuildRequires: pkgconfig(syspopup)
BuildRequires: pkgconfig(syspopup-caller)
BuildRequires: pkgconfig(wayland-client)
+Requires: security-config
%description
This package provides service for vconf key usage
%make_install
mkdir -p %{buildroot}%{_unitdir}/basic.target.wants
mkdir -p %{buildroot}%{_sbindir}
-install -m 0644 %SOURCE1 %{buildroot}%{_unitdir}/rscmgr-service.service
-%install_service basic.target.wants rscmgr-service.service
-ln -sf ../rscmgr-service.service %{buildroot}%{_unitdir}/basic.target.wants/
+mkdir -p %{buildroot}%{_sysconfdir}/dbus-1/system.d
+cp %SOURCE4 %{buildroot}%{_sysconfdir}/dbus-1/system.d
+
+install -m 0644 %SOURCE2 %{buildroot}%{_unitdir}/rscmgr-msgq.service
+%install_service basic.target.wants rscmgr-msgq.service
+ln -sf ../rscmgr-msgq.service %{buildroot}%{_unitdir}/basic.target.wants/
+
+install -m 0644 %SOURCE1 %{buildroot}%{_unitdir}/%{name}.service
+%install_service basic.target.wants %{name}.service
+ln -sf ../rscmgr-msgq.service %{buildroot}%{_unitdir}/basic.target.wants/
+
%if "%{asan}" == "1"
-mkdir -p %{buildroot}%{_unitdir}/rscmgr-service.service.d
-install -m 644 %SOURCE2 %{buildroot}%{_unitdir}/rscmgr-service.service.d/rscmgr-service-asan.conf
+mkdir -p %{buildroot}%{_unitdir}/%{name}.service.d
+install -m 644 %SOURCE3 %{buildroot}%{_unitdir}/%{name}.service.d/%{name}-asan.conf
%endif
+cp %SOURCE4 %{buildroot}%{_sysconfdir}/dbus-1/system.d
%clean
rm -rf %{buildroot}
-%post
-
-%{TZ_SYS_BIN}/chsmack -e "System::Run" %{TZ_SYS_BIN}/gen_rm_msgq
-
%files
%manifest rscmgr-service.manifest
%license LICENSE.APLv2
-%defattr(-,root,root,-)
-%{TZ_SYS_BIN}/rscmgr-service
%{TZ_SYS_BIN}/gen_rm_msgq
-%{_unitdir}/rscmgr-service.service
-%{_unitdir}/basic.target.wants/rscmgr-service.service
+%{TZ_SYS_BIN}/%{name}
+%{_unitdir}/rscmgr-msgq.service
+%{_unitdir}/basic.target.wants/rscmgr-msgq.service
+%{_unitdir}/%{name}.service
+%{_unitdir}/basic.target.wants/%{name}.service
%if "%{asan}" == "1"
-%{_unitdir}/rscmgr-service.service.d/rscmgr-service-asan.conf
+%{_unitdir}/%{name}.service.d/${name}-asan.conf
%endif
+%{_sysconfdir}/dbus-1/system.d/%{name}.conf
%files devel
-%defattr(-,root,root,-)
<request>
<domain name="_"/>
</request>
+ <assign>
+ <filesystem path="/usr/bin/gen_rm_msgq" exec_label="User::App::Shared" />
+ </assign>
</manifest>
while (msgsnd(msgq_id, (void*) response, sizeof(rms_msg_response) - sizeof(long), 0) == -1) {
SERVER_ERR("failed to send response message (%d), retry(%d) - type(%d)/cid(%d)", errno, retry, response->type, response->handle);
- if (errno == EIDRM) { // errno 43 : identifier removed
+ if (errno == EIDRM) { /* errno 43 : identifier removed */
SERVER_ERR("msgid removed from system");
if (recover() != RMS_OK)
return RMS_ERROR;
}
}
- if (retry >= 5) { //timeout
+ if (retry >= 5) { /* timeout */
return RMS_ERROR;
}
- usleep(20*1000); // 20ms
+ usleep(20 * 1000); /* 20ms */
retry++;
}
SERVER_INFO("msgq_tx (%d), msgq_rx(%d)", msgq_tx, msgq_rx);
FILE *fp = NULL;
- const char *flag_path = "/run/rsc_mgr_ready";
+ const char *flag_path = "/tmp/rsc_mgr_ready";
fp = fopen(flag_path,"w");