mirror of
https://github.com/systemd/systemd.git
synced 2024-11-27 12:13:33 +08:00
s390: add personality support
Introduce personality support for Linux on z Systems to run particular services with a 64-bit or 31-bit personality.
This commit is contained in:
parent
2e396de8b2
commit
7517f51ef9
@ -1502,6 +1502,7 @@ EXTRA_DIST += \
|
||||
test/exec-ignoresigpipe-yes.service \
|
||||
test/exec-personality-x86-64.service \
|
||||
test/exec-personality-x86.service \
|
||||
test/exec-personality-s390.service \
|
||||
test/exec-privatedevices-no.service \
|
||||
test/exec-privatedevices-yes.service \
|
||||
test/exec-privatetmp-no.service \
|
||||
|
@ -5261,6 +5261,19 @@ unsigned long personality_from_string(const char *p) {
|
||||
|
||||
if (streq(p, "x86"))
|
||||
return PER_LINUX;
|
||||
|
||||
#elif defined(__s390x__)
|
||||
|
||||
if (streq(p, "s390"))
|
||||
return PER_LINUX32;
|
||||
|
||||
if (streq(p, "s390x"))
|
||||
return PER_LINUX;
|
||||
|
||||
#elif defined(__s390__)
|
||||
|
||||
if (streq(p, "s390"))
|
||||
return PER_LINUX;
|
||||
#endif
|
||||
|
||||
return PERSONALITY_INVALID;
|
||||
@ -5280,6 +5293,20 @@ const char* personality_to_string(unsigned long p) {
|
||||
|
||||
if (p == PER_LINUX)
|
||||
return "x86";
|
||||
|
||||
#elif defined(__s390x__)
|
||||
|
||||
if (p == PER_LINUX)
|
||||
return "s390x";
|
||||
|
||||
if (p == PER_LINUX32)
|
||||
return "s390";
|
||||
|
||||
#elif defined(__s390__)
|
||||
|
||||
if (p == PER_LINUX)
|
||||
return "s390";
|
||||
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
|
@ -77,10 +77,14 @@ static void test_exec_workingdirectory(Manager *m) {
|
||||
}
|
||||
|
||||
static void test_exec_personality(Manager *m) {
|
||||
test(m, "exec-personality-x86.service", 0, CLD_EXITED);
|
||||
|
||||
#if defined(__x86_64__)
|
||||
test(m, "exec-personality-x86-64.service", 0, CLD_EXITED);
|
||||
|
||||
#elif defined(__s390__)
|
||||
test(m, "exec-personality-s390.service", 0, CLD_EXITED);
|
||||
|
||||
#else
|
||||
test(m, "exec-personality-x86.service", 0, CLD_EXITED);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
7
test/exec-personality-s390.service
Normal file
7
test/exec-personality-s390.service
Normal file
@ -0,0 +1,7 @@
|
||||
[Unit]
|
||||
Description=Test for Personality=s390
|
||||
|
||||
[Service]
|
||||
ExecStart=/bin/sh -c 'echo $(uname -m); exit $(test $(uname -m) = "s390")'
|
||||
Type=oneshot
|
||||
Personality=s390
|
Loading…
Reference in New Issue
Block a user