aix does not allow resetting real uid once the euid is changed to non-root

The issue is aix does not seem to allow updating real uid once effective uid is updated to non-root (or lesser privilidged user).

This is reproducible on AIX using simple script as follows: (note same works on ubuntu)

bash-4.2# ruby -r etc -e '
> fork do
> Process.euid = Etc.getpwnam("capdev1").uid
> Process.uid = Etc.getpwnam("capdev1").uid
> end'
-e:4:in `uid=': Not owner (Errno::EPERM)
from -e:4:in `block in <main>'
from -e:2:in `fork'
from -e:2:in `<main>'

Fix is to first update the uid followed by euid instead of the other way round. This works fine on aix as well as ubuntu, need to validate other platforms like centos, solaris.

validating this on other platforms - in-progress