diff options
| author | Jonathan Bauer | 2015-04-14 17:58:50 +0200 |
|---|---|---|
| committer | Jonathan Bauer | 2015-04-14 17:58:50 +0200 |
| commit | e4c036d247389cfaeb3da8675ce53f53bef90afe (patch) | |
| tree | ae1c87aeb940147cb258c4b540ad920880781ac0 /testModule/systemd_preserve_process_marker.c | |
| parent | static qemu-nbd (diff) | |
| parent | Some tries to fix kernel panic. (diff) | |
| download | systemd-init-e4c036d247389cfaeb3da8675ce53f53bef90afe.tar.gz systemd-init-e4c036d247389cfaeb3da8675ce53f53bef90afe.tar.xz systemd-init-e4c036d247389cfaeb3da8675ce53f53bef90afe.zip | |
Merge branch 'master' of git.openslx.org:openslx-ng/systemd-init
Diffstat (limited to 'testModule/systemd_preserve_process_marker.c')
| -rw-r--r-- | testModule/systemd_preserve_process_marker.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/testModule/systemd_preserve_process_marker.c b/testModule/systemd_preserve_process_marker.c new file mode 100644 index 00000000..172a5546 --- /dev/null +++ b/testModule/systemd_preserve_process_marker.c @@ -0,0 +1,31 @@ +#include <unistd.h> +#include <stdlib.h> +#include <string.h> +#include <stdio.h> + +void print_array(int argc, char *argv[]) { + // Helper function to print given array with given length. + int i = 0; + int j = 0; + for (i = 0; i < argc; i ++) { + j = 0; + while(argv[i][j] != '\0') + printf("%c", argv[i][j++]); + printf(" "); + } + printf("\n"); +} +int main(int argc, char *argv[]) { + int count; + char **copy = malloc(sizeof(char *) * (argc-1)); + for (count = 0; count < argc - 1; count++) + copy[count] = strdup(argv[count + 1]); + // Adding systemd indicator to preserve wrapped process during changing + // root filesystem. We mark wrapper and child process. + copy[0][0] = '@'; + argv[0][0] = '@'; + if (-1 == execvp(argv[1], copy)) { + perror("child process execve failed [%m]"); + return -1; + } +} |
