/* * call-seq: * Process.uid= integer => numeric * * Sets the (integer) user ID for this process. Not available on all * platforms. */ static VALUE proc_setuid(obj, id) VALUE obj, id; { int uid = NUM2INT(id); check_uid_switch(); #if defined(HAVE_SETRESUID) && !defined(__CHECKER__) if (setresuid(uid, -1, -1) < 0) rb_sys_fail(0); #elif defined HAVE_SETREUID if (setreuid(uid, -1) < 0) rb_sys_fail(0); #elif defined HAVE_SETRUID if (setruid(uid) < 0) rb_sys_fail(0); #elif defined HAVE_SETUID { if (geteuid() == uid) { if (setuid(uid) < 0) rb_sys_fail(0); } else { rb_notimplement(); } } #else rb_notimplement(); #endif return INT2FIX(uid); }