Skip to content

Latest commit

 

History

History
28 lines (24 loc) · 685 Bytes

getgrgid.md

File metadata and controls

28 lines (24 loc) · 685 Bytes

##函数原型

#include <sys/types.h>
#include <grp.h>

struct group *getgrnam(const char *name);
struct group *getgrgid(gid_t gid);
int getgrnam_r(const char *name, struct group *grp,
         char *buf, size_t buflen, struct group **result);

int getgrgid_r(gid_t gid, struct group *grp,
         char *buf, size_t buflen, struct group **result);

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

##结构体group 定义在头文件grp.h

struct group {
       char   *gr_name;       /* 组名 */
       char   *gr_passwd;     /* 组密码 */
       gid_t   gr_gid;        /* 组ID */
       char  **gr_mem;        /* 组成员 */
};