summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNaoto Yamaguchi <naoto.yamaguchi@aisin.co.jp>2022-06-05 23:40:12 +0900
committerNaoto Yamaguchi <naoto.yamaguchi@aisin.co.jp>2022-06-08 07:20:41 +0900
commitf20fa3f4f0a2698db38d993e3d0b86be58c41ef2 (patch)
tree5a0f76468cd96fe5f4112e213d81c376db95a7f8
parent53f4fe700dee88cc9840a91f2f297aacf05e08d4 (diff)
The drm-lease-manager create unix domain socket file to provide lease to lease client. In typical case, this file must be create before client boot up. But existing drm-lease-manager couldn't keep that sequence because that support startup ordering only using systemd service dependency. This patch add systemd notify support to realize more strictly ordaining. Bug-AGL: SPEC-4427 Signed-off-by: Naoto Yamaguchi <naoto.yamaguchi@aisin.co.jp> Change-Id: Icaad6c9df0696a48b9534c7586be7949a874f9a5
-rw-r--r--drm-lease-manager/main.c9
-rw-r--r--drm-lease-manager/meson.build3
-rw-r--r--meson.build17
-rw-r--r--meson_options.txt6
4 files changed, 29 insertions, 6 deletions
diff --git a/drm-lease-manager/main.c b/drm-lease-manager/main.c
index b4ad379..5ac3600 100644
--- a/drm-lease-manager/main.c
+++ b/drm-lease-manager/main.c
@@ -13,6 +13,7 @@
* limitations under the License.
*/
+#include "config.h"
#include "lease-config.h"
#include "lease-manager.h"
#include "lease-server.h"
@@ -23,6 +24,10 @@
#include <stdlib.h>
#include <unistd.h>
+#ifdef HAVE_SYSTEMD_DAEMON
+#include <systemd/sd-daemon.h>
+#endif
+
static void usage(const char *progname)
{
printf("Usage: %s [OPTIONS] [<DRM device>]\n\n"
@@ -107,6 +112,10 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
+#ifdef HAVE_SYSTEMD_DAEMON
+ sd_notify(1, "READY=1");
+#endif
+
struct ls_req req;
while (ls_get_request(ls, &req)) {
switch (req.type) {
diff --git a/drm-lease-manager/meson.build b/drm-lease-manager/meson.build
index 4732283..d8c48c7 100644
--- a/drm-lease-manager/meson.build
+++ b/drm-lease-manager/meson.build
@@ -4,7 +4,8 @@ lease_server_files = files('lease-server.c')
lease_config_files = files('lease-config.c')
main = executable('drm-lease-manager',
[ 'main.c', lease_manager_files, lease_server_files, lease_config_files ],
- dependencies: [ drm_dep, dlmcommon_dep, thread_dep, toml_dep ],
+ dependencies: [ drm_dep, dlmcommon_dep, thread_dep, toml_dep, systemd_dep ],
+ include_directories : configuration_inc,
install: true,
)
diff --git a/meson.build b/meson.build
index c2c88a6..1694a0a 100644
--- a/meson.build
+++ b/meson.build
@@ -28,15 +28,17 @@ add_project_arguments(
language: 'c'
)
-configure_file(output: 'config.h',
- configuration: config)
-
-configuration_inc = include_directories('.')
-
drm_dep = dependency('libdrm', version: '>= 2.4.89')
thread_dep = dependency('threads')
toml_dep = dependency('libtoml')
+systemd_dep = dependency('', required: false)
+if get_option('enable-systemd')
+ systemd_dep = dependency('libsystemd', required: false)
+
+ config.set('HAVE_SYSTEMD_DAEMON', '1')
+endif
+
enable_tests = get_option('enable-tests')
if enable_tests
@@ -56,6 +58,11 @@ if enable_tests
endif
endif
+configure_file(output: 'config.h',
+ configuration: config)
+
+configuration_inc = include_directories('.')
+
subdir('common')
subdir('libdlmclient')
subdir('drm-lease-manager')
diff --git a/meson_options.txt b/meson_options.txt
index ee1f8dc..7774174 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -10,6 +10,12 @@ option('enable-tests',
description: 'Build unit tests'
)
+option('enable-systemd',
+ type: 'boolean',
+ value: false,
+ description: 'Systemd notify support'
+)
+
option('runtime_subdir',
type: 'string',
value: 'run/drm-lease-manager',