-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lvhi: add workaround for systemd issue on 5.4
Details on issue 603. Signed-off-by: Kornilios Kourtis <[email protected]>
- Loading branch information
Showing
5 changed files
with
126 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
CC=gcc | ||
CFLAGS=-Wall -O2 | ||
|
||
.PHONY: all | ||
all: systemd-pidfd-fix.so | ||
|
||
systemd-pidfd-fix.so: systemd-pidfd-fix.c | ||
$(CC) $(CFLAGS) -ldl -fPIC -shared -o $@ $< | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -f systemd-pidfd-fix.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#define _GNU_SOURCE | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <errno.h> | ||
#include <spawn.h> | ||
#include <sys/utsname.h> | ||
#include <dlfcn.h> | ||
#include <ctype.h> | ||
|
||
int pidfd_spawn(int *restrict pidfd, | ||
const char *restrict file, | ||
const posix_spawn_file_actions_t *restrict facts, | ||
const posix_spawnattr_t *restrict attrp, | ||
char *const argv[restrict], | ||
char *const envp[restrict]); | ||
|
||
int pidfd_spawn (int *restrict pidfd, | ||
const char *restrict file, | ||
const posix_spawn_file_actions_t *restrict facts, | ||
const posix_spawnattr_t *restrict attrp, | ||
char *const argv[restrict], | ||
char *const envp[restrict]) | ||
{ | ||
struct utsname buff; | ||
if (uname(&buff) == 0) { | ||
long ver[16]; | ||
int i = 0; | ||
char *p = buff.release; | ||
while (*p) { | ||
if (isdigit(*p)) { | ||
ver[i] = strtol(p, &p, 10); | ||
i++; | ||
} else { | ||
p++; | ||
} | ||
} | ||
printf("%ld.%ld.%ld\n", ver[0], ver[1], ver[2]); | ||
if (ver[0] <= 5 && ver[0] < 7) { | ||
return ENOSYS; | ||
} | ||
} | ||
|
||
typeof(pidfd_spawn) *f = dlsym(RTLD_NEXT, "pidfd_spawn"); | ||
if (!f) { | ||
return EINVAL; | ||
} | ||
|
||
return f(pidfd, file, facts, attrp, argv, envp); | ||
} |