Related Re-entrant Functions

A number of functions covered in this chapter so far have re-entrant counterparts on some platforms. For example, the function synopsis for getgrnam_r(3C) under IRIX 6.5 is as follows:

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

int getgrnam_r(const char *name,  /* Group name to search */
    struct group *grent,          /* Used for storage */
    char *buffer,                 /* Used for storage */
    int bufsize,                  /* Size of buffer in bytes */
    struct group **grp);          /* Pointer to return pointer */

To be re-entrant, the caller must supply the function with all of its needs. In the case of getgrnam_r(3C) shown, argument grent and buffer are two storage areas that are provided to the function for its own internal use. The buffer points ...

Get Advanced UNIX Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.