clone: correct signedness of flags
Retrieve long values from the external term format

Getting an integer value from erl_interface is tricky: the macros are
undocumented and the behaviour is not what you'd expect. A small value is
sent from the Erlang side as an integer. An unsigned integer is a value
exceeding a signed int. A long long is a value exceeding an unsigned
int, etc.

Test that the value is an integer and is one of the expected types. In
the case of setrlimit, if the executable is compiled with support for
large files, the value of cur/max are stored in 8 bytes.

If a long long is passed into cur/max using 32-bits, it should be
truncated.