zig/lib/std/os
Meili C 0f17cbfc6a fix: allow std.linux.getgroups to accept null
looking at `man getgroups` and `info getgroups` this is given as an
example:

  ```c
       // Here's how to use ‘getgroups’ to read all the supplementary group
       // IDs:

            gid_t *
            read_all_groups (void)
            {
              int ngroups = getgroups (0, NULL);
              gid_t *groups
                = (gid_t *) xmalloc (ngroups * sizeof (gid_t));
              int val = getgroups (ngroups, groups);
              if (val < 0)
                {
                  free (groups);
                  return NULL;
                }
              return groups;
            }
  ```

getgroups(0, NULL) is used to get the count of groups so that the
correct count can be used to allocate a list of gid_t. This small changes makes this
possible.

equivalent example in Zig after the change:

  ```zig
    // get the group count
    const ngroups: usize = std.os.linux.getgroups(0, null);
    if (ngroups <= 0) {
        return error.GetGroupsError;
    }

    std.debug.print("number of groups: {d}\n", .{ngroups});
    const groups_gids: []u32 = try alloc.alloc(u32, ngroups);

    // populate an array of gid_t
    _ = std.os.linux.getgroups(ngroups, @ptrCast(groups_gids));
  ```
2024-12-22 21:48:47 +01:00
..
linux std.os.linux: Add unwinding protection in clone() implementations. 2024-12-11 00:10:17 +01:00
plan9 extract std.posix from std.os 2024-03-19 11:45:09 -07:00
uefi uefi: erroneous alignment check in pool_allocator 2024-09-24 13:30:53 -07:00
windows std.os.windows: Deprecate WINAPI in favor of CallingConvention.winapi. 2024-11-02 10:44:18 +01:00
emscripten.zig std: update std.builtin.Type fields to follow naming conventions 2024-08-28 08:39:59 +01:00
linux.zig fix: allow std.linux.getgroups to accept null 2024-12-22 21:48:47 +01:00
plan9.zig std: fix typos (#20560) 2024-07-09 14:25:42 -07:00
uefi.zig std.os.uefi: Fix calling convention build error 2024-10-25 10:45:55 +02:00
wasi.zig Copy in WASI rights_t documentation 2024-10-06 09:44:52 +01:00
windows.zig std.os.windows: Map PIPE_NOT_AVAILABLE from OpenFile() to error.NoDevice (#21938) 2024-11-27 22:33:29 +01:00