From: Ray Strode Date: Thu, 26 Apr 2018 16:36:31 +0000 (-0400) Subject: utils: add function for running program X-Git-Tag: 0.9.4~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0faf4c82bf69709c9de8a6fa2bc7aa2eedf9510b;p=thirdparty%2Fplymouth.git utils: add function for running program In order to hand off the drm fd to another program we need to be able to run that other program. This commit adds an API for running a program with no arguments, in the background. --- diff --git a/src/libply/ply-utils.c b/src/libply/ply-utils.c index 89e37e93..9d2e6ff6 100644 --- a/src/libply/ply-utils.c +++ b/src/libply/ply-utils.c @@ -1015,4 +1015,16 @@ ply_get_device_scale (uint32_t width, return device_scale; } +bool +ply_run_program_in_background (const char *program) +{ + pid_t pid; + int result; + char argv[2] = { program, NULL }; + + result = posix_spawn (&pid, program, NULL, NULL, argv, NULL); + + return result == 0; +} + /* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */ diff --git a/src/libply/ply-utils.h b/src/libply/ply-utils.h index c46603ee..19c5f90d 100644 --- a/src/libply/ply-utils.h +++ b/src/libply/ply-utils.h @@ -127,6 +127,7 @@ int ply_get_device_scale (uint32_t width, uint32_t height, uint32_t width_mm, uint32_t height_mm); +bool ply_run_program_in_background (const char *program); #endif