hare

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

getuid.ha (778B)


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