Add getgroups and setgroups (#619)

This commit is contained in:
Gavin Hayes 2022-09-18 05:48:53 -04:00 committed by GitHub
parent 3665232d66
commit 4c40c500b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 280 additions and 29 deletions

View file

@ -17,9 +17,9 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/calls.h"
#include "libc/intrin/strace.internal.h"
#include "libc/calls/syscall-sysv.internal.h"
#include "libc/dce.h"
#include "libc/intrin/strace.internal.h"
#include "libc/macros.internal.h"
#include "libc/nt/accounting.h"
#include "libc/runtime/runtime.h"
@ -50,15 +50,15 @@ static textwindows dontinline uint32_t GetUserNameHash(void) {
* @asyncsignalsafe
* @vforksafe
*/
int getuid(void) {
int rc;
uint32_t getuid(void) {
uint32_t rc;
if (!IsWindows()) {
rc = sys_getuid();
} else {
rc = GetUserNameHash();
}
STRACE("%s() → %d% m", "getuid", rc);
STRACE("%s() → %u% m", "getuid", rc);
return rc;
}
@ -71,13 +71,13 @@ int getuid(void) {
* @asyncsignalsafe
* @vforksafe
*/
int getgid(void) {
int rc;
uint32_t getgid(void) {
uint32_t rc;
if (!IsWindows()) {
rc = sys_getgid();
} else {
rc = GetUserNameHash();
}
STRACE("%s() → %d% m", "getgid", rc);
STRACE("%s() → %u% m", "getgid", rc);
return rc;
}