aboutsummaryrefslogtreecommitdiff
path: root/lib/mlibc/options/glibc/generic/personality.cpp
blob: 3bfd9aaf104d157141f5a5e12fbb08f05a3969c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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;
}