• 函数原型
  • 结构体group

    函数原型

    1. #include <sys/types.h>
    2. #include <grp.h>
    3. struct group *getgrnam(const char *name);
    4. struct group *getgrgid(gid_t gid);
    5. int getgrnam_r(const char *name, struct group *grp,
    6. char *buf, size_t buflen, struct group **result);
    7. int getgrgid_r(gid_t gid, struct group *grp,
    8. char *buf, size_t buflen, struct group **result);

    缩写含义
    getgrnam—->get group name
    getgruid—->get group uid

    结构体group

    定义在头文件grp.h

    1. struct group {
    2. char *gr_name; /* 组名 */
    3. char *gr_passwd; /* 组密码 */
    4. gid_t gr_gid; /* 组ID */
    5. char **gr_mem; /* 组成员 */
    6. };