httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Igor Kovalenko" <Igor.Kovale...@motorola.com>
Subject [PATCH] support for QNX6 platform (aka QNX/Neutrino aka QNX RTP)
Date Thu, 08 Nov 2001 08:43:18 GMT
Here goes patch against released 1.3.22. It adds complete support for QNX6,
including DSO. I have actually built PHP shared module using APXS and it
worked. Serialized accept is done using POSIX mutexes.

- igor

diff -u -r apache_1.3.22.patched/src/Configure apache_1.3.22/src/Configure

--- apache_1.3.22.patched/src/Configure Thu Oct 18 00:21:27 2001

+++ apache_1.3.22/src/Configure Mon Oct 8 14:59:36 2001

@@ -554,11 +554,6 @@

CFLAGS="$CFLAGS -DQNX -mf -3"

LIBS="$LIBS -N128k -lsocket -lunix"

DEF_WANTHSREGEX=yes

- ;;

- *-*-qnx6)

- OS='NTO'

- CFLAGS="$CFLAGS -DNTO"

- LIBS="$LIBS -lm -lsocket"

;;

*-isc4*)

OS='ISC 4'

@@ -1081,14 +1076,6 @@

LDFLAGS_SHLIB='-b -a archive'

LDFLAGS_MOD_SHLIB=$LDFLAGS_SHLIB

;;

- *-*-qnx6*)

- LD_SHLIB="gcc"

- CFLAGS_SHLIB="-fPIC"

- LDFLAGS_SHLIB="-shared"

- LDFLAGS_MOD_SHLIB=$LDFLAGS_SHLIB

- LDFLAGS_SHLIB_EXPORT="-Wl,-E"

- SHLIB_SUFFIX_DEPTH=0

- ;;

*-linux1)

CFLAGS_SHLIB="-fpic"

LDFLAGS_SHLIB="-Bshareable"

diff -u -r apache_1.3.22.patched/src/helpers/GuessOS
apache_1.3.22/src/helpers/GuessOS

--- apache_1.3.22.patched/src/helpers/GuessOS Thu Oct 18 00:30:28 2001

+++ apache_1.3.22/src/helpers/GuessOS Mon Oct 8 09:49:33 2001

@@ -181,22 +181,12 @@

echo "${MACHINE}-tandem-oss"; exit 0;

;;


- *nto:* | QNX:*)

- if test "${MACHINE}" = "x86pc" || test "${MACHINE}" = "PCI" ; then

- MACHINE="pc"

+ QNX:*)

+ if [ "$VERSION" -gt 422 ]; then

+ echo "${MACHINE}-qssl-qnx32"

+ else

+ echo "${MACHINE}-qssl-qnx"

fi

- case $RELEASE in

- [0-9]*)

- echo "${MACHINE}-qssl-qnx6"

- ;;

- [A-Z]*)

- if [ "$VERSION" -gt 422 ]; then

- echo "${MACHINE}-qssl-qnx32"

- else

- echo "${MACHINE}-qssl-qnx"

- fi

- ;;

- esac

exit 0

;;


diff -u -r apache_1.3.22.patched/src/include/ap_config.h
apache_1.3.22/src/include/ap_config.h

--- apache_1.3.22.patched/src/include/ap_config.h Sun Oct 21 00:15:14 2001

+++ apache_1.3.22/src/include/ap_config.h Mon Oct 8 09:49:33 2001

@@ -745,36 +745,6 @@

#define NET_SIZE_T socklen_t

#endif


-#elif defined(NTO)

-

-#define HAVE_MMAP 1

-#define HAVE_GMTOFF 1

-#define HAVE_SYSLOG 1

-

-#define USE_MMAP_SCOREBOARD

-#define USE_MMAP_FILES 1

-#define USE_PTHREAD_SERIALIZED_ACCEPT

-

-#undef MAP_TMPFILE

-#undef NO_TIMES

-

-/* needs prototypes for execXX */

-#define NEED_PROCESS_H

-

-/*

- Careful here.

- Things have changed a lot between 6.0 and 6.1

- We'll assume 6.1+ is default

-*/

-/* loader does not support #! before 6.1 */

-/* #define NEED_HASHBANG_EMUL */

-/* kernel does not implement getrlimit/setrlimit before 6.1 */

-/* #undef HAVE_SYS_RESOURCE_H */

-/* tiny stack does not implement SO_LINGER */

-/* #undef USE_SO_LINGER */

-/* lingering close is broken with tiny TCP stack */

-/* #define NO_LINGCLOSE */

-

#elif defined(QNX)

#ifndef crypt

char *crypt(const char *pw, const char *salt);

@@ -1186,7 +1156,7 @@

#undef NSIG

#endif

#include <errno.h>

-#if !defined(QNX) && !defined(NTO) && !defined(CONVEXOS11) &&
!defined(NEXT) && !defined(TPF) && !defined(NETWARE) && !defined(MPE)

+#if !defined(QNX) && !defined(CONVEXOS11) && !defined(NEXT) &&
!defined(TPF) && !defined(NETWARE) && !defined(MPE)

#include <memory.h>

#endif


diff -u -r apache_1.3.22.patched/src/include/httpd.h
apache_1.3.22/src/include/httpd.h

--- apache_1.3.22.patched/src/include/httpd.h Thu Oct 18 01:06:10 2001

+++ apache_1.3.22/src/include/httpd.h Mon Oct 8 21:56:05 2001

@@ -1189,7 +1189,7 @@

* also not using a scoreboard file

*/

#if !defined (MULTITHREAD) && \

- (defined (USE_MMAP_SCOREBOARD) || defined (USE_SHMGET_SCOREBOARD) ||
defined(USE_POSIX_SCOREBOARD))

+ (defined (USE_MMAP_SCOREBOARD) || defined (USE_SHMGET_SCOREBOARD))

#define OPTIMIZE_TIMEOUTS

#endif


diff -u -r apache_1.3.22.patched/src/main/http_core.c
apache_1.3.22/src/main/http_core.c

--- apache_1.3.22.patched/src/main/http_core.c Sun Nov 4 05:27:38 2001

+++ apache_1.3.22/src/main/http_core.c Tue Sep 4 12:15:15 2001

@@ -3666,18 +3666,8 @@

&& (!r->header_only || (d->content_md5 & 1))) {

/* we need to protect ourselves in case we die while we've got the

* file mmapped */

-#ifdef NTO

- /*

- MAP_NOSYNCFILE is required for mmap() on regular files,

- MAP_ELF is just a workaround for a bug in 6.1 (fails on MAP_PRIVATE)

- It appears to give some 10% performance boost nevertheless

- */

- mm = mmap(NULL, r->finfo.st_size, PROT_READ,

- MAP_PRIVATE|MAP_NOSYNCFILE|MAP_ELF, fileno(f), 0);

-#else

mm = mmap(NULL, r->finfo.st_size, PROT_READ, MAP_PRIVATE,

fileno(f), 0);

-#endif

if (mm == (caddr_t)-1) {

ap_log_rerror(APLOG_MARK, APLOG_CRIT, r,

"default_handler: mmap failed: %s", r->filename);

diff -u -r apache_1.3.22.patched/src/main/http_main.c
apache_1.3.22/src/main/http_main.c

--- apache_1.3.22.patched/src/main/http_main.c Thu Oct 18 01:44:45 2001

+++ apache_1.3.22/src/main/http_main.c Fri Oct 5 20:21:11 2001

@@ -611,8 +611,6 @@

* on Solaris. Note that pthread mutexes are *NOT* released when a task

* dies ... the task has to free it itself. So we block signals and

* try to be nice about releasing the mutex.

- *

- * --- This works on QNX6 as well, even faster perhaps ---

*/


#include <pthread.h>

@@ -647,15 +645,6 @@

static void accept_mutex_init_pthread(pool *p)

{

pthread_mutexattr_t mattr;

-

-#ifdef MAP_ANON

- accept_mutex = (pthread_mutex_t *) mmap((caddr_t) 0,
sizeof(*accept_mutex),

- PROT_READ | PROT_WRITE, MAP_ANON|MAP_SHARED, NOFD, 0);

- if (accept_mutex == (void *) (caddr_t) - 1) {

- perror("mmap");

- exit(APEXIT_INIT);

- }

-#else

int fd;


fd = open("/dev/zero", O_RDWR);

@@ -670,7 +659,6 @@

exit(APEXIT_INIT);

}

close(fd);

-#endif

if ((errno = pthread_mutexattr_init(&mattr))) {

perror("pthread_mutexattr_init");

exit(APEXIT_INIT);

@@ -2054,13 +2042,30 @@

/*

* POSIX 1003.4 style

*

- * This code is only used by QNX4 probably, and from version 4.25

- * QNX4 can actually use USE_MMAP_SCOREBOARD. So this is only still

- * useful if you're stuck with one of earlier versions. Otherwise

- * just define USE_MMAP_SCOREBOARD in QNX section of Configure.

+ * Note 1:

+ * As of version 4.23A, shared memory in QNX must reside under /dev/shmem,

+ * where no subdirectories allowed.

*

- * Oct 18, 2001,

- * Igor Kovalenko -- ikovalenko@sourceforge.net

+ * POSIX shm_open() and shm_unlink() will take care about this issue,

+ * but to avoid confusion, I suggest to redefine scoreboard file name

+ * in httpd.conf to cut "logs/" from it. With default setup actual name

+ * will be "/dev/shmem/logs.apache_status".

+ *

+ * If something went wrong and Apache did not unlinked this object upon

+ * exit, you can remove it manually, using "rm -f" command.

+ *

+ * Note 2:

+ * <sys/mman.h> in QNX defines MAP_ANON, but current implementation

+ * does NOT support BSD style anonymous mapping. So, the order of

+ * conditional compilation is important:

+ * this #ifdef section must be ABOVE the next one (BSD style).

+ *

+ * I tested this stuff and it works fine for me, but if it provides

+ * trouble for you, just comment out USE_MMAP_SCOREBOARD in QNX section

+ * of ap_config.h

+ *

+ * June 5, 1997,

+ * Igor N. Kovalenko -- infoh@mail.wplus.net

*/


static void cleanup_shared_mem(void *d)

diff -u -r apache_1.3.22.patched/src/modules/standard/mod_mime_magic.c
apache_1.3.22/src/modules/standard/mod_mime_magic.c

--- apache_1.3.22.patched/src/modules/standard/mod_mime_magic.c Thu Oct 18
02:11:56 2001

+++ apache_1.3.22/src/modules/standard/mod_mime_magic.c Wed Oct 3 23:55:01
2001

@@ -255,7 +255,7 @@

static int match(request_rec *, unsigned char *, int);

static int mget(request_rec *, union VALUETYPE *, unsigned char *,

struct magic *, int);

-static int ap_mcheck(request_rec *, union VALUETYPE *, struct magic *);

+static int mcheck(request_rec *, union VALUETYPE *, struct magic *);

static void mprint(request_rec *, union VALUETYPE *, struct magic *);


static int uncompress(request_rec *, int,

@@ -1600,7 +1600,7 @@


/* check if main entry matches */

if (!mget(r, &p, s, m, nbytes) ||

- !ap_mcheck(r, &p, m)) {

+ !mcheck(r, &p, m)) {

struct magic *m_cont;


/*

@@ -1671,7 +1671,7 @@

cont_level = m->cont_level;

}

if (mget(r, &p, s, m, nbytes) &&

- ap_mcheck(r, &p, m)) {

+ mcheck(r, &p, m)) {

/*

* This continuation matched. Print its message, with a

* blank before it if the previous item printed and this

@@ -1845,7 +1845,7 @@

return 1;

}


-static int ap_mcheck(request_rec *r, union VALUETYPE *p, struct magic *m)

+static int mcheck(request_rec *r, union VALUETYPE *p, struct magic *m)

{

register unsigned long l = m->value.l;

register unsigned long v;

@@ -1898,7 +1898,7 @@

default:

/* bogosity, pretend that it just wasn't a match */

ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, r,

- MODNAME ": invalid type %d in ap_mcheck().", m->type);

+ MODNAME ": invalid type %d in mcheck().", m->type);

return 0;

}


@@ -1983,7 +1983,7 @@

/* bogosity, pretend it didn't match */

matched = 0;

ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, r,

- MODNAME ": ap_mcheck: can't happen: invalid relation %d.",

+ MODNAME ": mcheck: can't happen: invalid relation %d.",

m->reln);

break;

}

diff -u -r apache_1.3.22.patched/src/support/htdigest.c
apache_1.3.22/src/support/htdigest.c

--- apache_1.3.22.patched/src/support/htdigest.c Thu Oct 18 01:46:57 2001

+++ apache_1.3.22/src/support/htdigest.c Wed Jul 25 09:08:04 2001

@@ -73,7 +73,7 @@

#endif

#include "ap.h"

#include "ap_md5.h"

-#if defined(MPE) || defined(QNX) || defined(NTO) || defined(WIN32) ||
defined(__TANDEM) || defined(OS390) || defined(BEOS) || defined(BONE)

+#if defined(MPE) || defined(QNX) || defined(WIN32) || defined(__TANDEM) ||
defined(OS390) || defined(BEOS) || defined(BONE)

#include <signal.h>

#else

#include <sys/signal.h>

diff -u -r apache_1.3.22.patched/src/support/suexec.c
apache_1.3.22/src/support/suexec.c

--- apache_1.3.22.patched/src/support/suexec.c Thu Oct 18 01:54:14 2001

+++ apache_1.3.22/src/support/suexec.c Thu Mar 8 12:11:43 2001

@@ -95,11 +95,11 @@


/*

***********************************************************************

- * There is no initgroups() in QNX4 (but there is in QNX6)

- * On QNX4 compile with cc -osuexec -3 -O -mf -DQNX suexec.c

+ * There is no initgroups() in QNX, so I believe this is safe :-)

+ * Use cc -osuexec -3 -O -mf -DQNX suexec.c to compile.

*

- * Oct 18, 2001.

- * Igor Kovalenko -- ikovalenko@sourceforge.net

+ * May 17, 1997.

+ * Igor N. Kovalenko -- infoh@mail.wplus.net

***********************************************************************

*/



Mime
View raw message