Queries the current group id or, if gid is given, sets it. Setting the group id may require root permission.