I would like to know if user is root, without minding if that user is using a fakeroot-like tool or not.
I tried the functions
printf("%d %d %s\n", getuid(), geteuid(), getlogin());
% fakeroot ./busybox rm
1000 1000 julien
0 0 root
nneonneo got the reason right, but here's the solution: Fakeroot-ng. It uses
ptrace and system call interception, rather than
LD_PRELOAD and library call interception, which makes it compatible with static linking, much more robust, and even able to handle calls made from inside libc (which otherwise would not be hookable).