httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@gmail.com>
Subject Re: APR OS400 sources
Date Mon, 14 Mar 2005 19:00:59 GMT
On Mon, 14 Mar 2005 19:35:52 +0100 (GMT-1), Damir Dezeljin
<programing@mbss.org> wrote:

> I'm wondering if APR OS400 port sources are publicaly available? Does
> anyone know anything about this? What about apache sources?

I have no idea of the OS/400 patches and/or full sources they use are
publically available.

> I'm asking it because I'm developing an application on OS400. I'm using
> APR as a portability library, however from time to time I need to use OS
> API. Having APR sources will be really helpful ;) E.g. I need to get a
> thread ID for my logging module implementation (the logging module will
> not using APR).
> 
> On e.g. Linux it is enough to call getpid(). Unfortunately this call
> returns the same process ID for all threads on OS400. Any idea?

you're relying on a Linux wart which has been fixed in recent Linux ;)

> 
> Anyway ... is it posible to use apr_os_thread_current() for this purpose?
> << I was unable to use it as I didn't find the declaration of the
> apr_os_thread_t structure.
> Will apr functions for 'decoding' threads IDs represent a big performance
> hit in my application?

Here's what Apache's mod_log_config does for logging the thread id:

static const char *log_pid_tid(request_rec *r, char *a)
{
    if (*a == '\0' || !strcmp(a, "pid")) {
        return apr_psprintf(r->pool, "%" APR_PID_T_FMT, getpid());
    }
    else if (!strcmp(a, "tid")) {
#if APR_HAS_THREADS
        apr_os_thread_t tid = apr_os_thread_current();
#else
        int tid = 0; /* APR will format "0" anyway but an arg is needed */
#endif
        return apr_psprintf(r->pool, "%pT", &tid);
    }
    /* bogus format */
    return a;
}

Mime
View raw message