| 1 | package SPVM::Sys::User; | ||
| 2 | |||
| 3 | 1; | ||
| 4 | |||
| 5 | =head1 Name | ||
| 6 | |||
| 7 | SPVM::Sys::User - User/Group System Calls | ||
| 8 | |||
| 9 | =head1 Description | ||
| 10 | |||
| 11 | Sys::User class in L<SPVM> has methods to call user/group system calls. | ||
| 12 | |||
| 13 | =head1 Usage | ||
| 14 | |||
| 15 | use Sys::User; | ||
| 16 | |||
| 17 | my $effective_user_id = Sys::User->geteuid; | ||
| 18 | |||
| 19 | =head1 Class Methods | ||
| 20 | |||
| 21 | =head2 getuid | ||
| 22 | |||
| 23 | C<static method getuid : int ();> | ||
| 24 | |||
| 25 | Calls the L<getuid|https://linux.die.net/man/2/getuid> function and returns its return value. | ||
| 26 | |||
| 27 | Exceptions: | ||
| 28 | |||
| 29 | In Windows the following exception is thrown. getuid is not supported in this system(defined(_WIN32)). | ||
| 30 | |||
| 31 | =head2 geteuid | ||
| 32 | |||
| 33 | C<static method geteuid : int ();> | ||
| 34 | |||
| 35 | Calls the L<geteuid|https://linux.die.net/man/2/geteuid> function and returns its return value. | ||
| 36 | |||
| 37 | Exceptions: | ||
| 38 | |||
| 39 | In Windows the following exception is thrown. geteuid is not supported in this system(defined(_WIN32)). | ||
| 40 | |||
| 41 | =head2 getgid | ||
| 42 | |||
| 43 | C<static method getgid : int ();> | ||
| 44 | |||
| 45 | Calls the L<getgid|https://linux.die.net/man/2/getgid> function and returns its return value. | ||
| 46 | |||
| 47 | Exceptions: | ||
| 48 | |||
| 49 | In Windows the following exception is thrown. getgid is not supported in this system(defined(_WIN32)). | ||
| 50 | |||
| 51 | =head2 getegid | ||
| 52 | |||
| 53 | C<static method getegid : int ();> | ||
| 54 | |||
| 55 | Calls the L<getegid|https://linux.die.net/man/2/getegid> function and returns its return value. | ||
| 56 | |||
| 57 | Exceptions: | ||
| 58 | |||
| 59 | In Windows the following exception is thrown. getegid is not supported in this system(defined(_WIN32)). | ||
| 60 | |||
| 61 | =head2 setuid | ||
| 62 | |||
| 63 | C<static method setuid : int ($uid : int);> | ||
| 64 | |||
| 65 | Calls the L<setuid|https://linux.die.net/man/2/setuid> function and returns its return value. | ||
| 66 | |||
| 67 | Exceptions: | ||
| 68 | |||
| 69 | If the setuid function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class. | ||
| 70 | |||
| 71 | In Windows the following exception is thrown. setuid is not supported in this system(defined(_WIN32)). | ||
| 72 | |||
| 73 | =head2 seteuid | ||
| 74 | |||
| 75 | C<static method seteuid : int ($euid : int);> | ||
| 76 | |||
| 77 | Calls the L<seteuid|https://linux.die.net/man/2/seteuid> function and returns its return value. | ||
| 78 | |||
| 79 | Exceptions: | ||
| 80 | |||
| 81 | If the seteuid function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class. | ||
| 82 | |||
| 83 | In Windows the following exception is thrown. seteuid is not supported in this system(defined(_WIN32)). | ||
| 84 | |||
| 85 | =head2 setgid | ||
| 86 | |||
| 87 | C<static method setgid : int ($gid : int);> | ||
| 88 | |||
| 89 | Calls the L<setgid|https://linux.die.net/man/2/setgid> function and returns its return value. | ||
| 90 | |||
| 91 | Exceptions: | ||
| 92 | |||
| 93 | If the setgid function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class. | ||
| 94 | |||
| 95 | In Windows the following exception is thrown. setgid is not supported in this system(defined(_WIN32)). | ||
| 96 | |||
| 97 | =head2 setegid | ||
| 98 | |||
| 99 | C<static method setegid : int ($egid : int);> | ||
| 100 | |||
| 101 | Calls the L<setegid|https://linux.die.net/man/2/setegid> function and returns its return value. | ||
| 102 | |||
| 103 | Exceptions: | ||
| 104 | |||
| 105 | If the setegid function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class. | ||
| 106 | |||
| 107 | In Windows the following exception is thrown. setegid is not supported in this system(defined(_WIN32)). | ||
| 108 | |||
| 109 | =head2 setpwent | ||
| 110 | |||
| 111 | C<static method setpwent : void ();> | ||
| 112 | |||
| 113 | Calls the L<setpwent|https://linux.die.net/man/3/setpwent> function and returns its return value. | ||
| 114 | |||
| 115 | Exceptions: | ||
| 116 | |||
| 117 | In Windows the following exception is thrown. setpwent is not supported in this system(defined(_WIN32)). | ||
| 118 | |||
| 119 | =head2 endpwent | ||
| 120 | |||
| 121 | C<static method endpwent : void ();> | ||
| 122 | |||
| 123 | Calls the L<endpwent|https://linux.die.net/man/3/endpwent> function and returns its return value. | ||
| 124 | |||
| 125 | Exceptions: | ||
| 126 | |||
| 127 | In Windows the following exception is thrown. endpwent is not supported in this system(defined(_WIN32)). | ||
| 128 | |||
| 129 | =head2 getpwent | ||
| 130 | |||
| 131 | C<static method getpwent : L<Sys::User::Passwd|SPVM::Sys::User::Passwd> ();> | ||
| 132 | |||
| 133 | Calls the L<getpwent|https://linux.die.net/man/3/getpwent> function. | ||
| 134 | |||
| 135 | And if its return value is NULL, returns undef, otherwise creates a new L<Sys::User::Passwd|SPVM::Sys::User::Passwd> object whose pointer is set to function's return value, and returns it. | ||
| 136 | |||
| 137 | Exceptions: | ||
| 138 | |||
| 139 | If the getpwent function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class. | ||
| 140 | |||
| 141 | In Windows the following exception is thrown. getpwent is not supported in this system(defined(_WIN32)). | ||
| 142 | |||
| 143 | =head2 setgrent | ||
| 144 | |||
| 145 | C<static method setgrent : void ();> | ||
| 146 | |||
| 147 | Calls the L<setgrent|https://linux.die.net/man/3/setgrent> function. | ||
| 148 | |||
| 149 | Exceptions: | ||
| 150 | |||
| 151 | In Windows the following exception is thrown. setgrent is not supported in this system(defined(_WIN32)). | ||
| 152 | |||
| 153 | =head2 endgrent | ||
| 154 | |||
| 155 | C<static method endgrent : void ();> | ||
| 156 | |||
| 157 | Calls the L<endgrent|https://linux.die.net/man/3/endgrent> function. | ||
| 158 | |||
| 159 | Exceptions: | ||
| 160 | |||
| 161 | In Windows the following exception is thrown. endgrent is not supported in this system(defined(_WIN32)). | ||
| 162 | |||
| 163 | =head2 getgrent | ||
| 164 | |||
| 165 | C<static method getgrent : L<Sys::User::Group|SPVM::Sys::User::Group> ();> | ||
| 166 | |||
| 167 | Calls the L<getgrent|https://linux.die.net/man/3/getgrent> function. | ||
| 168 | |||
| 169 | And if its return value is NULL, returns undef, otherwise creates a new L<Sys::User::Group|SPVM::Sys::User::Group> object whose pointer is set to function's return value, and returns it. | ||
| 170 | |||
| 171 | Exceptions: | ||
| 172 | |||
| 173 | If the getgrent function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class. | ||
| 174 | |||
| 175 | In Windows the following exception is thrown. getgrent is not supported in this system(defined(_WIN32)). | ||
| 176 | |||
| 177 | =head2 getgroups | ||
| 178 | |||
| 179 | C<static method getgroups : int ($size : int, $list : int[]);> | ||
| 180 | |||
| 181 | Calls the L<getgroups|https://linux.die.net/man/2/getgroups> function, and returns its return value. | ||
| 182 | |||
| 183 | Exceptions: | ||
| 184 | |||
| 185 | If the getgroups function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class. | ||
| 186 | |||
| 187 | In Windows the following exception is thrown. getgroups is not supported in this system(defined(_WIN32)). | ||
| 188 | |||
| 189 | =head2 setgroups | ||
| 190 | |||
| 191 | C<static method setgroups : void ($groups : int[]);> | ||
| 192 | |||
| 193 | Calls the L<setgroups|https://linux.die.net/man/2/setgroups> function. | ||
| 194 | |||
| 195 | Exceptions: | ||
| 196 | |||
| 197 | If the setgroups function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class. | ||
| 198 | |||
| 199 | In Windows the following exception is thrown. setgroups is not supported in this system(defined(_WIN32)). | ||
| 200 | |||
| 201 | =head2 getpwuid | ||
| 202 | |||
| 203 | C<static method getpwuid : L<Sys::User::Passwd|SPVM::Sys::User::Passwd> ($id : int);> | ||
| 204 | |||
| 205 | Calls the L<getpwuid|https://linux.die.net/man/3/getpwuid> function. | ||
| 206 | |||
| 207 | And if its return value is NULL, returns undef, otherwise creates a new L<Sys::User::Passwd|SPVM::Sys::User::Passwd> object whose pointer is set to function's return value, and returns it. | ||
| 208 | |||
| 209 | Exceptions: | ||
| 210 | |||
| 211 | If the getpwuid function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class. | ||
| 212 | |||
| 213 | In Windows the following exception is thrown. getpwuid is not supported in this system(defined(_WIN32)). | ||
| 214 | |||
| 215 | =head2 getpwnam | ||
| 216 | |||
| 217 | C<static method getpwnam : L<Sys::User::Passwd|SPVM::Sys::User::Passwd> ($name : string);> | ||
| 218 | |||
| 219 | Calls the L<getpwnam|https://linux.die.net/man/3/getpwnam> function. | ||
| 220 | |||
| 221 | And if its return value is NULL, returns undef, otherwise creates a new L<Sys::User::Passwd|SPVM::Sys::User::Passwd> object whose pointer is set to function's return value, and returns it. | ||
| 222 | |||
| 223 | Exceptions: | ||
| 224 | |||
| 225 | If the getpwnam function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class. | ||
| 226 | |||
| 227 | In Windows the following exception is thrown. getpwnam is not supported in this system(defined(_WIN32)). | ||
| 228 | |||
| 229 | =head2 getgrgid | ||
| 230 | |||
| 231 | C<static method getgrgid : L<Sys::User::Group|SPVM::Sys::User::Group> ($id : int);> | ||
| 232 | |||
| 233 | Calls the L<getgrgid|https://linux.die.net/man/3/getgrgid> function. | ||
| 234 | |||
| 235 | And if its return value is NULL, returns undef, otherwise creates a new L<Sys::User::Group|SPVM::Sys::User::Group> object whose pointer is set to function's return value, and returns it. | ||
| 236 | |||
| 237 | Exceptions: | ||
| 238 | |||
| 239 | If the getgrgid function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class. | ||
| 240 | |||
| 241 | In Windows the following exception is thrown. getgrgid is not supported in this system(defined(_WIN32)). | ||
| 242 | |||
| 243 | =head2 getgrnam | ||
| 244 | |||
| 245 | C<static method getgrnam : L<Sys::User::Group|SPVM::Sys::User::Group> ($name : string);> | ||
| 246 | |||
| 247 | Calls the L<getgrnam|https://linux.die.net/man/3/getgrnam> function. | ||
| 248 | |||
| 249 | And if its return value is NULL, returns undef, otherwise creates a new L<Sys::User::Group|SPVM::Sys::User::Group> object whose pointer is set to function's return value, and returns it. | ||
| 250 | |||
| 251 | Exceptions: | ||
| 252 | |||
| 253 | If the getgrnam function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class. | ||
| 254 | |||
| 255 | In Windows the following exception is thrown. getgrnam is not supported in this system(defined(_WIN32)). | ||
| 256 | |||
| 257 | =head1 See Also | ||
| 258 | |||
| 259 | =over 2 | ||
| 260 | |||
| 261 | =item * L<Sys|SPVM::Sys> | ||
| 262 | |||
| 263 | =back | ||
| 264 | |||
| 265 | =head1 Copyright & License | ||
| 266 | |||
| 267 | Copyright (c) 2023 Yuki Kimoto | ||
| 268 | |||
| 269 | MIT License | ||
| 270 |