code:suser - ikarishinjieva/unixV6-code-analyze-chs GitHub Wiki

Source

  • 判断当前用户是否有超级用户权限,参看权限管理
  • 若有超级用户权限,返回1
  • 若不是超级用户,则抛出 EPERM 错误代码,返回0

6806

6807 /*

6808  * Test if the current user is the

6809  * super user.

6810  */

6811 suser()

6812 {

6813

6814     if(u.u_uid == 0)

6815           return(1);

6816     u.u_error = EPERM;

6817     return(0);

6818 }

6819 /* ------------------------- */

Caller

⚠️ **GitHub.com Fallback** ⚠️