libgslutil  1.2.3
Functions
User and group ID lookups

Functions

uid_t gsl_lookup_uid (const char *name)
 Look up uid by name. More...
 
gid_t gsl_lookup_gid (const char *name)
 Look up gid by name. More...
 

Detailed Description

Fast, caching lookup functions for user and group IDs. These actually scan the system database once and store the results into a hash table so they can be retrieved at O(1) when required. On a simple system with a flat file store containing a few entries this pays off after 2–3 lookups.

Initialisation of the user and/or group hash table is automatic when the corresponding lookup function is first called.

Note
No mechanism currently exists to re-scan /etc/passwd or /etc/group after first use but one would be trivial to add if this feature was deemed to be necessary.

Function Documentation

◆ gsl_lookup_uid()

uid_t gsl_lookup_uid ( const char *  name)

Look up uid by name.

Parameters
nameUser name to look up.
Returns
uid
Return values

◆ gsl_lookup_gid()

gid_t gsl_lookup_gid ( const char *  name)

Look up gid by name.

Parameters
nameGroup name to look up.
Returns
gid
Return values