httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Igor Kovalenko" <Igor.Kovale...@motorola.com>
Subject Re: QNX 6.1a mod/peer review
Date Wed, 07 Aug 2002 19:24:51 GMT
Was that applied or not? Does not seem to be in 2.0.39...

As for the content of patch, it appears to do 2 things: replace mmmap() of
/dev/zero with mmap() of a regular file (which is not the best idea) and
handle retuns of pthread_xxx() funcs differently (they return errno value
rather than set errno on QNX6). This all applies to
USE_PROC_PTHREAD_SERIALIZE code.

However, USE_PROC_PTHREAD_SERIALIZE is not defined on QNX6. The
USE_PTHREAD_SERIALIZE is defined, but useless since apache has no code for
it beyond handling -V option. USE_POSIXSEM_SERIALIZE is defined too and
SINGLE_LISTEN_UNSERIALIZED_ACCEPT is also defined.

Which means (as far as i can tell) USE_POSIXSEM_SERIALIZE will be used if
more than one Listen is present. That code looks somewhat strange to me too.
Is there a reason why named POSIX semaphores are used? Named ones add lot of
unnecessary trouble (there are even comments inline about joy of using them)
and on QNX they are also whole lot slower. Why not put unnamed ones into
anon shared memory? Is this code used by any other platform which does have
named POSIX sems but does not have anon shared memory? The time_sem.c does
not have code to test POSIXSEM_SERIALIZE performance. I did test FLOCK/FCNTL
and PTHREAD though and PTHREAD is 5-6 times faster on QNX6 (single CPU, 50
children, 10000 iterations).

So here is what needs to be done I think:

1. define USE_PROC_PTHREAD_SERIALIZE for QNX6
2. patch USE_PROC_PTHREAD_SERIALIZE to use mmap(MAP_ANON) is available and
fallback to mmap(/dev/zero) otherwise; also patch it to use QNX6 equivalent
of pthread_mutex_setconsistent_np().
3. patch for handling of pthread_xxx() returns.
4. handle scoreboard code to use mmap() in similar way to (2)
5. remove QNX6 from list of systems which don't have initgroups().

Are there upfront objections to such patch before I bother doing it? There
were objections when I tried to do (2) for apache1.3 - it was said to be
non-QNX-specific. My arguments (that it actually should be non-QNX-specific)
were never answered and patch was summarily ignored.

Regards,
-- igor

----- Original Message -----
From: "Davide Berti" <dberti777@yahoo.com>
To: <dev@httpd.apache.org>
Sent: Thursday, May 23, 2002 12:28 PM
Subject: QNX 6.1a mod/peer review


> Hello all
>
> httpd-2.0.36, QNX 6.1 RTOS
>
> I have made a modification to apache to get it to run
> on qnx.  It kept hanging.  I traced it down and made
> some changes to get it to run.  I wanted to proof
> these changes with the apache community and get some
> feedback as to the longterm consequences/ side effects
> of these changes.  I am attaching a diff of the
> changes that I made.
>
> I also noticed that SSL doesn't seem to work unless
> the -X flag is passed to httpd, any ideas.
>
> Thanks
> /Davide
>
> --- httpd-2.0.36/srclib/apr/locks/unix/proc_mutex.c
> Mon Apr  8 23:56:56 2002
> +++ ../httpd-2.0.36/srclib/apr/locks/unix/proc_mutex.c
> Wed May  8 16:04:51 2002
> @@ -318,7 +318,9 @@
>          if (munmap((caddr_t)mutex->pthread_interproc,
> sizeof(pthread_mutex_t))){
>              return errno;
>          }
> -    }
> +    if(shm_unlink("/datapoints")) // DB
> +            return errno;
> + }
>      return APR_SUCCESS;
>  }
>
> @@ -329,11 +331,15 @@
>      int fd;
>      pthread_mutexattr_t mattr;
>
> -    fd = open("/dev/zero", O_RDWR);
> -    if (fd < 0) {
> -        return errno;
> -    }
> +    fd=shm_open("/datapoints",O_RDWR|O_CREAT,0777);
> file://DB
> + if (fd < 0)
> + return errno;
>
> + if(ftruncate(fd,sizeof(pthread_mutex_t))==-1)  file://DB
> + return errno;
> +
> +
> +
>      new_mutex->pthread_interproc = (pthread_mutex_t
> *)mmap(
>                                         (caddr_t) 0,
>
> sizeof(pthread_mutex_t),
> @@ -363,10 +369,11 @@
>
> PTHREAD_MUTEX_ROBUST_NP))) {
>  #ifdef PTHREAD_SETS_ERRNO
>          rv = errno;
> -#endif
> +#endif // DB
>          proc_mutex_proc_pthread_cleanup(new_mutex);
>          return rv;
>      }
> +#endif
>      if ((rv = pthread_mutexattr_setprotocol(&mattr,
> PTHREAD_PRIO_INHERIT))) {
>  #ifdef PTHREAD_SETS_ERRNO
>          rv = errno;
> @@ -374,9 +381,15 @@
>          proc_mutex_proc_pthread_cleanup(new_mutex);
>          return rv;
>      }
> +    if ((rv =
> pthread_mutex_destroy(new_mutex->pthread_interproc)))
> { // DB
> +#ifdef PTHREAD_SETS_ERRNO
> +        rv = errno;
>  #endif
> +        proc_mutex_proc_pthread_cleanup(new_mutex);
> +        return rv;
> +    }
>
> -    if ((rv =
> pthread_mutex_init(new_mutex->pthread_interproc,
> &mattr))) {
> + if ((rv =
> pthread_mutex_init(new_mutex->pthread_interproc,
> &mattr))) {
>  #ifdef PTHREAD_SETS_ERRNO
>          rv = errno;
>  #endif
>
> __________________________________________________
> Do You Yahoo!?
> LAUNCH - Your Yahoo! Music Experience
> http://launch.yahoo.com
>


Mime
View raw message