aboutsummaryrefslogtreecommitdiff
path: root/lib/mlibc/options/glibc/generic/personality.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mlibc/options/glibc/generic/personality.cpp')
-rw-r--r--lib/mlibc/options/glibc/generic/personality.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/mlibc/options/glibc/generic/personality.cpp b/lib/mlibc/options/glibc/generic/personality.cpp
new file mode 100644
index 0000000..3bfd9aa
--- /dev/null
+++ b/lib/mlibc/options/glibc/generic/personality.cpp
@@ -0,0 +1,15 @@
+#include <bits/ensure.h>
+#include <errno.h>
+#include <mlibc/glibc-sysdeps.hpp>
+#include <sys/personality.h>
+
+int personality(unsigned long persona) {
+ int out = 0;
+ auto sysdep = MLIBC_CHECK_OR_ENOSYS(mlibc::sys_personality, -1);
+
+ if(int e = sysdep(persona, &out); e) {
+ errno = e;
+ return -1;
+ }
+ return out;
+}