]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
utils: add function for running program
authorRay Strode <rstrode@redhat.com>
Thu, 26 Apr 2018 16:36:31 +0000 (12:36 -0400)
committerRay Strode <rstrode@redhat.com>
Thu, 26 Apr 2018 16:36:31 +0000 (12:36 -0400)
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.

src/libply/ply-utils.c
src/libply/ply-utils.h

index 89e37e932b19ef4a3e14fcf2b2966f23b8dd9227..9d2e6ff693ae6982f6c42ec25092fa0edd771f70 100644 (file)
@@ -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: */
index c46603eec6da9c644fba107052c50ce949f77e1a..19c5f90df9bab39242cf9272952399721b02e1e7 100644 (file)
@@ -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