httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sascha Schumann <sas...@schumann.cx>
Subject Re: [?PATCH?] using getpwnam_r in mod_userdir
Date Fri, 10 Nov 2000 23:31:10 GMT
> Another issue (perhaps not affecting more than one system): it
> assumes that getpwnam() isn't thread-safe.  If getpwnam() is
> thread-safe, we don't need the lock and we don't need to copy.

    If it is thread-safe (i.e. it uses thread-specific storage
    instead of static storage), the vendor should provide
    getpwnam_r. In fact, getpwnam should then only be a wrapper
    around getpwnam_r.

    Are there any known systems which provide a thread-safe
    getpwnam and don't have getpwnam_r?

> How many of these reentrant function issues have come up with PHP?

    Well, quite a lot. We try hard to avoid compatibility layers
    in normal source code, so we use the reentrant interfaces
    everywhere. If the target platform has

    -   old, but reentrant interfaces, we try to support them
        (HPUX time-related functions, Solaris(/AIX?) readdir_r());
        or if it has

    -   only non-reentrant interfaces, we supply wrappers.

    Currently, we cover these functions:

        asctime_r
        ctime_r
        gmtime_r
        localtime_r
        rand_r*
        readdir_r
        strtok_r*

        * completely reimplemented for performance reasons

    That is almost the complete set of _r functions, considering
    the 1995 Amendment to POSIX. The get*_r functions are missing
    though as we currently don't have any need for them.

    - Sascha


Mime
View raw message