mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 06:48:31 +00:00
Add Cosmopolitan to uname()
This commit is contained in:
parent
ed316491ca
commit
3ffc17c50e
9 changed files with 56 additions and 14 deletions
9
third_party/musl/grp.c
vendored
9
third_party/musl/grp.c
vendored
|
@ -25,11 +25,13 @@
|
|||
│ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. │
|
||||
│ │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/weirdtypes.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/limits.h"
|
||||
#include "libc/thread/thread.h"
|
||||
#include "third_party/musl/passwd.h"
|
||||
|
||||
|
@ -246,3 +248,10 @@ struct group *getgrnam(const char *name) {
|
|||
&g_getgrent->mem, &nmem, &res);
|
||||
return res;
|
||||
}
|
||||
|
||||
int initgroups(const char *user, gid_t gid) {
|
||||
gid_t groups[NGROUPS_MAX];
|
||||
int count = NGROUPS_MAX;
|
||||
if (getgrouplist(user, gid, groups, &count) < 0) return -1;
|
||||
return setgroups(count, groups);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue