If setarch is running as 32bit userspace on a 64bit kernel we should use
the kernel personality.
'setarch',
setarch_sources,
include_directories : includes,
+ link_with : [lib_common],
install_dir : usrbin_exec_dir,
install : true)
exes += exe
MANPAGES += sys-utils/setarch.8
dist_noinst_DATA += sys-utils/setarch.8.adoc
setarch_SOURCES = sys-utils/setarch.c
+setarch_LDADD = $(LDADD) libcommon.la
SETARCH_LINKS = uname26 linux32 linux64
#include "nls.h"
#include "c.h"
#include "closestream.h"
+#include "sysfs.h"
#ifndef HAVE_PERSONALITY
# include <syscall.h>
if (!strcmp(un.machine, transitions[i].target_arch))
break;
if (transitions[i].perval < 0) {
- unsigned long wrdsz = CHAR_BIT * sizeof(void *);
+ int wrdsz = sysfs_get_address_bits(NULL);
+ if (wrdsz < 0)
+ wrdsz = CHAR_BIT * sizeof(void *);
if (wrdsz == 32 || wrdsz == 64) {
/* fill up the place holder */
transitions[i].perval = wrdsz == 32 ? PER_LINUX32 : PER_LINUX;