| ... | @@ -551,67 +551,6 @@ pub fn getcwd(out_buffer: []u8) GetCwdError![]u8 { | ... | @@ -551,67 +551,6 @@ pub fn getcwd(out_buffer: []u8) GetCwdError![]u8 { |
| 551 | } | 551 | } |
| 552 | } | 552 | } |
| 553 | | 553 | |
| 554 | pub const SetEidError = error{ | | |
| 555 | InvalidUserId, | | |
| 556 | PermissionDenied, | | |
| 557 | } || UnexpectedError; | | |
| 558 | | | |
| 559 | pub const SetIdError = error{ResourceLimitReached} || SetEidError; | | |
| 560 | | | |
| 561 | pub fn setuid(uid: uid_t) SetIdError!void { | | |
| 562 | switch (errno(system.setuid(uid))) { | | |
| 563 | .SUCCESS => return, | | |
| 564 | .AGAIN => return error.ResourceLimitReached, | | |
| 565 | .INVAL => return error.InvalidUserId, | | |
| 566 | .PERM => return error.PermissionDenied, | | |
| 567 | else => |err| return unexpectedErrno(err), | | |
| 568 | } | | |
| 569 | } | | |
| 570 | | | |
| 571 | pub fn seteuid(uid: uid_t) SetEidError!void { | | |
| 572 | switch (errno(system.seteuid(uid))) { | | |
| 573 | .SUCCESS => return, | | |
| 574 | .INVAL => return error.InvalidUserId, | | |
| 575 | .PERM => return error.PermissionDenied, | | |
| 576 | else => |err| return unexpectedErrno(err), | | |
| 577 | } | | |
| 578 | } | | |
| 579 | | | |
| 580 | pub fn setgid(gid: gid_t) SetIdError!void { | | |
| 581 | switch (errno(system.setgid(gid))) { | | |
| 582 | .SUCCESS => return, | | |
| 583 | .AGAIN => return error.ResourceLimitReached, | | |
| 584 | .INVAL => return error.InvalidUserId, | | |
| 585 | .PERM => return error.PermissionDenied, | | |
| 586 | else => |err| return unexpectedErrno(err), | | |
| 587 | } | | |
| 588 | } | | |
| 589 | | | |
| 590 | pub fn setegid(uid: uid_t) SetEidError!void { | | |
| 591 | switch (errno(system.setegid(uid))) { | | |
| 592 | .SUCCESS => return, | | |
| 593 | .INVAL => return error.InvalidUserId, | | |
| 594 | .PERM => return error.PermissionDenied, | | |
| 595 | else => |err| return unexpectedErrno(err), | | |
| 596 | } | | |
| 597 | } | | |
| 598 | | | |
| 599 | pub fn getuid() uid_t { | | |
| 600 | return system.getuid(); | | |
| 601 | } | | |
| 602 | | | |
| 603 | pub fn geteuid() uid_t { | | |
| 604 | return system.geteuid(); | | |
| 605 | } | | |
| 606 | | | |
| 607 | pub fn getgid() gid_t { | | |
| 608 | return system.getgid(); | | |
| 609 | } | | |
| 610 | | | |
| 611 | pub fn getegid() gid_t { | | |
| 612 | return system.getegid(); | | |
| 613 | } | | |
| 614 | | | |
| 615 | pub const SocketError = error{ | 554 | pub const SocketError = error{ |
| 616 | /// Permission to create a socket of the specified type and/or | 555 | /// Permission to create a socket of the specified type and/or |
| 617 | /// pro‐tocol is denied. | 556 | /// pro‐tocol is denied. |
| ... | @@ -2800,20 +2739,6 @@ pub fn tcsetpgrp(handle: fd_t, pgrp: pid_t) TermioSetPgrpError!void { | ... | @@ -2800,20 +2739,6 @@ pub fn tcsetpgrp(handle: fd_t, pgrp: pid_t) TermioSetPgrpError!void { |
| 2800 | } | 2739 | } |
| 2801 | } | 2740 | } |
| 2802 | | 2741 | |
| 2803 | pub const SetSidError = error{ | | |
| 2804 | /// The calling process is already a process group leader, or the process group ID of a process other than the calling process matches the process ID of the calling process. | | |
| 2805 | PermissionDenied, | | |
| 2806 | } || UnexpectedError; | | |
| 2807 | | | |
| 2808 | pub fn setsid() SetSidError!pid_t { | | |
| 2809 | const rc = system.setsid(); | | |
| 2810 | switch (errno(rc)) { | | |
| 2811 | .SUCCESS => return @intCast(rc), | | |
| 2812 | .PERM => return error.PermissionDenied, | | |
| 2813 | else => |err| return unexpectedErrno(err), | | |
| 2814 | } | | |
| 2815 | } | | |
| 2816 | | | |
| 2817 | pub fn signalfd(fd: fd_t, mask: *const sigset_t, flags: u32) !fd_t { | 2742 | pub fn signalfd(fd: fd_t, mask: *const sigset_t, flags: u32) !fd_t { |
| 2818 | const rc = system.signalfd(fd, mask, flags); | 2743 | const rc = system.signalfd(fd, mask, flags); |
| 2819 | switch (errno(rc)) { | 2744 | switch (errno(rc)) { |