tree-wide: make personality codepaths unconditional

Now that we have the infra to make personality handling unconitional remove the ifndefs everywhere. Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 3857c4eb
...@@ -48,10 +48,6 @@ ...@@ -48,10 +48,6 @@
#include "terminal.h" #include "terminal.h"
#include "utils.h" #include "utils.h"
#if HAVE_SYS_PERSONALITY_H
#include <sys/personality.h>
#endif
lxc_log_define(attach, lxc); lxc_log_define(attach, lxc);
/* Define default options if no options are supplied by the user. */ /* Define default options if no options are supplied by the user. */
...@@ -1147,7 +1143,6 @@ __noreturn static void do_attach(struct attach_payload *ap) ...@@ -1147,7 +1143,6 @@ __noreturn static void do_attach(struct attach_payload *ap)
} }
/* Now perform additional attachments. */ /* Now perform additional attachments. */
#if HAVE_SYS_PERSONALITY_H
if (options->attach_flags & LXC_ATTACH_SET_PERSONALITY) { if (options->attach_flags & LXC_ATTACH_SET_PERSONALITY) {
long new_personality; long new_personality;
...@@ -1164,7 +1159,6 @@ __noreturn static void do_attach(struct attach_payload *ap) ...@@ -1164,7 +1159,6 @@ __noreturn static void do_attach(struct attach_payload *ap)
TRACE("Set new personality"); TRACE("Set new personality");
} }
} }
#endif
if (options->attach_flags & LXC_ATTACH_DROP_CAPABILITIES) { if (options->attach_flags & LXC_ATTACH_DROP_CAPABILITIES) {
ret = drop_capabilities(ctx); ret = drop_capabilities(ctx);
......
...@@ -80,10 +80,6 @@ ...@@ -80,10 +80,6 @@
#include <sys/capability.h> #include <sys/capability.h>
#endif #endif
#if HAVE_SYS_PERSONALITY_H
#include <sys/personality.h>
#endif
#ifndef HAVE_STRLCAT #ifndef HAVE_STRLCAT
#include "include/strlcat.h" #include "include/strlcat.h"
#endif #endif
...@@ -1732,11 +1728,10 @@ static int lxc_setup_devpts_child(struct lxc_handler *handler) ...@@ -1732,11 +1728,10 @@ static int lxc_setup_devpts_child(struct lxc_handler *handler)
return 0; return 0;
} }
static int setup_personality(int persona) static int setup_personality(signed long persona)
{ {
int ret; int ret;
#if HAVE_SYS_PERSONALITY_H
if (persona == -1) if (persona == -1)
return 0; return 0;
...@@ -1744,8 +1739,7 @@ static int setup_personality(int persona) ...@@ -1744,8 +1739,7 @@ static int setup_personality(int persona)
if (ret < 0) if (ret < 0)
return log_error_errno(-1, errno, "Failed to set personality to \"0x%x\"", persona); return log_error_errno(-1, errno, "Failed to set personality to \"0x%x\"", persona);
INFO("Set personality to \"0x%x\"", persona); INFO("Set personality to \"0lx%lx\"", persona);
#endif
return 0; return 0;
} }
......
...@@ -39,10 +39,6 @@ ...@@ -39,10 +39,6 @@
#include "storage/storage.h" #include "storage/storage.h"
#include "utils.h" #include "utils.h"
#if HAVE_SYS_PERSONALITY_H
#include <sys/personality.h>
#endif
#ifndef HAVE_STRLCPY #ifndef HAVE_STRLCPY
#include "include/strlcpy.h" #include "include/strlcpy.h"
#endif #endif
...@@ -3215,7 +3211,6 @@ void lxc_config_define_free(struct lxc_list *defines) ...@@ -3215,7 +3211,6 @@ void lxc_config_define_free(struct lxc_list *defines)
signed long lxc_config_parse_arch(const char *arch) signed long lxc_config_parse_arch(const char *arch)
{ {
#if HAVE_SYS_PERSONALITY_H
static struct per_name { static struct per_name {
char *name; char *name;
unsigned long per; unsigned long per;
...@@ -3252,7 +3247,6 @@ signed long lxc_config_parse_arch(const char *arch) ...@@ -3252,7 +3247,6 @@ signed long lxc_config_parse_arch(const char *arch)
for (int i = 0; i < len; i++) for (int i = 0; i < len; i++)
if (strequal(pername[i].name, arch)) if (strequal(pername[i].name, arch))
return pername[i].per; return pername[i].per;
#endif
return LXC_ARCH_UNCHANGED; return LXC_ARCH_UNCHANGED;
} }
...@@ -3735,7 +3729,6 @@ static int get_config_personality(const char *key, char *retv, int inlen, ...@@ -3735,7 +3729,6 @@ static int get_config_personality(const char *key, char *retv, int inlen,
else else
memset(retv, 0, inlen); memset(retv, 0, inlen);
#if HAVE_SYS_PERSONALITY_H
int len = 0; int len = 0;
switch (c->personality) { switch (c->personality) {
...@@ -3748,7 +3741,6 @@ static int get_config_personality(const char *key, char *retv, int inlen, ...@@ -3748,7 +3741,6 @@ static int get_config_personality(const char *key, char *retv, int inlen,
default: default:
break; break;
} }
#endif
return fulllen; return fulllen;
} }
......
...@@ -31,6 +31,10 @@ ...@@ -31,6 +31,10 @@
#include <linux/openat2.h> #include <linux/openat2.h>
#endif #endif
#if HAVE_SYS_PERSONALITY_H
#include <sys/personality.h>
#endif
typedef int32_t key_serial_t; typedef int32_t key_serial_t;
#if !HAVE_KEYCTL #if !HAVE_KEYCTL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment