[RFC] struct grp related additions to libutil

Sean C. Farley scf at FreeBSD.org
Thu Mar 13 03:39:01 UTC 2008


I have written four functions related to struct grp processing that I
would like to add to libutil.  They are modeled in part after similar
calls in libutil/pw_util.c.  The calls are:
1. int gr_equal(const struct group *gr1, const struct group *gr2)
    Compares the values of two group structures.  It does a thorough, yet
    unoptimized comparison of all the members regardless of order.

2. char *gr_make(const struct group *gr)
    Creates a string (as would exist within /etc/group) from a group
    structure.

3. struct group *gr_dup(const struct group *gr)
    Duplicate a group structure.  Returned valued is a contiguous block
    of memory.

4. struct group *gr_scan(const char *line)
    Creates a group structure from a string (as produced by gr_make()).


Questions:
1. What requirements are there for making additions/changes to libutil?
2. Will there be any issues with having gr_equal() return a bool?
    Currently, it is returning an int.

I made patches with regression tests for both HEAD[1] and RELENG_7[2].

Sean
   1. http://www.farley.org/freebsd/tmp/gr_util/libutil-grp-HEAD.patch
   2. http://www.farley.org/freebsd/tmp/gr_util/libutil-grp-RELENG_7.patch
-- 
scf at FreeBSD.org


More information about the freebsd-arch mailing list