hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

getuid.ha (759B)


      1 // License: MPL-2.0
      2 // (c) 2021 Drew DeVault <sir@cmpwn.com>
      3 use rt;
      4 
      5 // Returns the current process user ID.
      6 export fn getuid() uint = {
      7 	let uid = 0u, euid = 0u, suid = 0u;
      8 	rt::getresuid(&uid, &euid, &suid) as void;
      9 	return uid;
     10 };
     11 
     12 // Returns the current process effective user ID.
     13 export fn geteuid() uint = {
     14 	let uid = 0u, euid = 0u, suid = 0u;
     15 	rt::getresuid(&uid, &euid, &suid) as void;
     16 	return euid;
     17 };
     18 
     19 // Returns the current process group ID.
     20 export fn getgid() uint = {
     21 	let gid = 0u, egid = 0u, sgid = 0u;
     22 	rt::getresgid(&gid, &egid, &sgid) as void;
     23 	return gid;
     24 };
     25 
     26 // Returns the current process effective group ID.
     27 export fn getegid() uint = {
     28 	let gid = 0u, egid = 0u, sgid = 0u;
     29 	rt::getresgid(&gid, &egid, &sgid) as void;
     30 	return egid;
     31 };