# Module `posix.grp`

Group Database Operations.

Query the system group database.

### See also:

posix.pwd

## Functions

endgrent () | Release group database resources.
getgrent () | Fetch next group.
getgrgid (gid) | Fetch group with given group id.
getgrnam (name) | Fetch named group.
setgrent () | Rewind next getgrent back to start of database.

## Tables

PosixGroup | Group record.

## Functions

endgrent ()
  Release group database resources.

  ### See also:

  - endgrent(3)
  - getgrent
getgrent ()
  Fetch next group.

  ### Returns:

  PosixGroup next group record

  ### See also:

  - getgrent(3)
  - endgrent

  ### Usage:

      local grp = require "posix.grp"
      t = grp.getgrent ()
      while t ~= nil do
        process (t)
        t = grp.getgrent ()
      end
      grp.endgrent ()

getgrgid (gid)
  Fetch group with given group id.

  ### Parameters:

  - gid int group id

  ### Returns:

  PosixGroup group record for gid, if successful

  ### Or

  1. nil
  2. string error message
  3. int errnum

  ### See also:

  getgrgid(3)

  ### Usage:

      local grp = require "posix.grp"
      t = grp.getgrgid (0)

getgrnam (name)
  Fetch named group.

  ### Parameters:

  - name string group name

  ### Returns:

  PosixGroup group record for name, if successful

  ### Or

  1. nil
  2. string error message
  3. int errnum

  ### See also:

  getgrnam(3)

  ### Usage:

      local grp = require "posix.grp"
      t = grp.getgrnam "wheel"

setgrent ()
  Rewind next getgrent back to start of database.

  ### See also:

  - setgrent(3)
  - getgrent

## Tables

PosixGroup
  Group record.

  ### Fields:

  - gr_mem list a list of group members
  - gr_name string name of group
  - gr_gid int unique group id

generated by LDoc 1.5.0 Last updated 2023-06-16 20:19:12