randy 96/12/27 16:04:58
Modified: src CHANGES conf.h http_core.c http_main.c http_protocol.c mod_fastcgi.c util.c Log: OS/2 changes to support MMAP style scoreboard file and UNIX style #! tokens for better script portability. Submitted by: Garey Smiley Revision Changes Path 1.103 +3 -0 apache/src/CHANGES Index: CHANGES =================================================================== RCS file: /export/home/cvs/apache/src/CHANGES,v retrieving revision 1.102 retrieving revision 1.103 diff -C3 -r1.102 -r1.103 *** CHANGES 1996/12/27 23:39:40 1.102 --- CHANGES 1996/12/28 00:04:48 1.103 *************** *** 1,5 **** --- 1,8 ---- Changes with Apache 1.2b4: + *) OS/2 changes to support an MMAP style scoreboard file and UNIX + style magic #! token for better script portability. [Garey Smiley] + *) Fix bug in suexec wrapper introduced in b3 that would cause failed execution for ~userdir CGI. [Jason Dour] 1.62 +6 -1 apache/src/conf.h Index: conf.h =================================================================== RCS file: /export/home/cvs/apache/src/conf.h,v retrieving revision 1.61 retrieving revision 1.62 diff -C3 -r1.61 -r1.62 *** conf.h 1996/12/20 16:27:17 1.61 --- conf.h 1996/12/28 00:04:49 1.62 *************** *** 398,404 **** /* Add some drive name support */ #define chdir _chdir2 #include <sys/time.h> ! #define MAXSOCKETS 200 /* Unknown system - Edit these to match */ --- 398,406 ---- /* Add some drive name support */ #define chdir _chdir2 #include <sys/time.h> ! #define MAXSOCKETS 4096 ! #define ARG_MAX _POSIX_ARG_MAX ! #define HAVE_MMAP /* Unknown system - Edit these to match */ *************** *** 480,486 **** --- 482,491 ---- #endif #endif #ifdef HAVE_MMAP + #ifndef __EMX__ + /* This file is not needed for OS/2 */ #include <sys/mman.h> + #endif #endif #if !defined(MAP_ANON) && defined(MAP_ANONYMOUS) #define MAP_ANON MAP_ANONYMOUS 1.54 +4 -0 apache/src/http_core.c Index: http_core.c =================================================================== RCS file: /export/home/cvs/apache/src/http_core.c,v retrieving revision 1.53 retrieving revision 1.54 diff -C3 -r1.53 -r1.54 *** http_core.c 1996/12/17 20:30:46 1.53 --- http_core.c 1996/12/28 00:04:49 1.54 *************** *** 605,610 **** --- 605,614 ---- if (cmd->limited != -1) return "Can't have <Directory> within <Limit>"; cmd->path = getword_conf (cmd->pool, &arg); + #ifdef __EMX__ + /* Fix OS/2 HPFS filename case problem. */ + cmd->path = strlwr(cmd->path); + #endif cmd->override = OR_ALL|ACCESS_CONF; if (!strcmp(cmd->path, "~")) { 1.98 +93 -1 apache/src/http_main.c Index: http_main.c =================================================================== RCS file: /export/home/cvs/apache/src/http_main.c,v retrieving revision 1.97 retrieving revision 1.98 diff -C3 -r1.97 -r1.98 *** http_main.c 1996/12/24 19:17:50 1.97 --- http_main.c 1996/12/28 00:04:50 1.98 *************** *** 109,114 **** --- 109,127 ---- #include "explain.h" + #ifdef __EMX__ + /* Add MMAP style functionality to OS/2 */ + #ifdef HAVE_MMAP + #define INCL_DOSMEMMGR + #include <os2.h> + #include <umalloc.h> + #include <stdio.h> + caddr_t create_shared_heap (const char *, size_t); + caddr_t get_shared_heap (const char *); + #endif + #endif + + DEF_Explain /* *************** *** 517,523 **** static void setup_shared_mem(void) { caddr_t m; ! #if defined(MAP_ANON) || defined(MAP_FILE) /* BSD style */ m = mmap((caddr_t)0, SCOREBOARD_SIZE, PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0); --- 530,552 ---- static void setup_shared_mem(void) { caddr_t m; ! ! #ifdef __EMX__ ! char errstr[MAX_STRING_LEN]; ! int rc; ! ! m = (caddr_t)create_shared_heap("\\SHAREMEM\\SCOREBOARD", HARD_SERVER_LIMIT*sizeof(short_score)); ! if(m == 0) { ! fprintf(stderr, "httpd: Could not create OS/2 Shared memory pool.\n"); ! exit(1); ! } ! ! rc = _uopen((Heap_t)m); ! if(rc != 0) { ! fprintf(stderr, "httpd: Could not uopen() newly created OS/2 Shared memory pool.\n"); ! } ! ! #elif defined(MAP_ANON) || defined(MAP_FILE) /* BSD style */ m = mmap((caddr_t)0, SCOREBOARD_SIZE, PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0); *************** *** 736,741 **** --- 765,787 ---- perror (scoreboard_fname); exit (1); } + #else + #ifdef __EMX__ + #ifdef HAVE_MMAP + caddr_t m; + char errstr[MAX_STRING_LEN]; + int rc; + + m = (caddr_t)get_shared_heap("\\SHAREMEM\\SCOREBOARD"); + if(m == 0) { + fprintf(stderr, "httpd: Could not find existing OS/2 Shared memory pool.\n"); + exit(1); + } + + rc = _uopen((Heap_t)m); + scoreboard_image = (scoreboard *)m; + #endif + #endif #endif } *************** *** 2062,2065 **** --- 2108,2157 ---- exit (0); } + #ifdef __EMX__ + #ifdef HAVE_MMAP + /* The next two routines are used to access shared memory under OS/2. */ + /* This requires EMX v09c to be installed. */ + + caddr_t create_shared_heap (const char *name, size_t size) + { + ULONG rc; + void *mem; + Heap_t h; + + rc = DosAllocSharedMem (&mem, name, size, + PAG_COMMIT | PAG_READ | PAG_WRITE); + if (rc != 0) + return NULL; + h = _ucreate (mem, size, !_BLOCK_CLEAN, _HEAP_REGULAR | _HEAP_SHARED, + NULL, NULL); + if (h == NULL) + DosFreeMem (mem); + return (caddr_t)h; + } + + caddr_t get_shared_heap (const char *Name) + { + + PVOID BaseAddress; /* Pointer to the base address of + the shared memory object */ + ULONG AttributeFlags; /* Flags describing characteristics + of the shared memory object */ + APIRET rc; /* Return code */ + + /* Request read and write access to */ + /* the shared memory object */ + AttributeFlags = PAG_WRITE | PAG_READ; + + rc = DosGetNamedSharedMem(&BaseAddress, Name, AttributeFlags); + + if(rc != 0) { + printf("DosGetNamedSharedMem error: return code = %ld", rc); + return 0; + } + + return BaseAddress; + } + #endif + #endif 1.85 +4 -1 apache/src/http_protocol.c Index: http_protocol.c =================================================================== RCS file: /export/home/cvs/apache/src/http_protocol.c,v retrieving revision 1.84 retrieving revision 1.85 diff -C3 -r1.84 -r1.85 *** http_protocol.c 1996/12/17 20:52:12 1.84 --- http_protocol.c 1996/12/28 00:04:51 1.85 *************** *** 441,447 **** for (loop = 0; loop <= strlen(r->uri); ++loop) { if (r->uri[loop] == '\\') r->uri[loop] = '/'; ! }; #endif if (*uri) r->args= pstrdup(r->pool, uri); --- 441,450 ---- for (loop = 0; loop <= strlen(r->uri); ++loop) { if (r->uri[loop] == '\\') r->uri[loop] = '/'; ! }; ! ! /* Fix OS/2 HPFS filename case problem. */ ! r->uri = strlwr(r->uri); #endif if (*uri) r->args= pstrdup(r->pool, uri); 1.4 +12 -0 apache/src/mod_fastcgi.c Index: mod_fastcgi.c =================================================================== RCS file: /export/home/cvs/apache/src/mod_fastcgi.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C3 -r1.3 -r1.4 *** mod_fastcgi.c 1996/11/25 11:22:00 1.3 --- mod_fastcgi.c 1996/12/28 00:04:52 1.4 *************** *** 178,183 **** --- 178,189 ---- #include <errno.h> #include <limits.h> #include <sys/types.h> + + #ifdef __EMX__ + /* If this value is changed. Make sure you also change it in conf.h */ + #define MAXSOCKETS 4096 + #endif + #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> *************** *** 849,855 **** --- 855,864 ---- || OS_Listen(listenSock, listenQueueDepth) < 0) { goto GET_IPC_ERROR_EXIT; } + #ifndef __EMX__ + /* OS/2 dosen't support changing ownership. */ chown(DStringValue(&ipcAddrPtr->bindPath), uid, gid); + #endif chmod(DStringValue(&ipcAddrPtr->bindPath), S_IRUSR | S_IWUSR); return listenSock; *************** *** 966,976 **** --- 975,988 ---- exit(errno); } DStringFree(&dirName); + #ifndef __EMX__ + /* OS/2 dosen't support nice() */ if(priority != 0) { if(nice (priority) == -1) { exit(errno); } } + #endif /* * Close any file descriptors we may have gotten from the parent * process. The only FD left open is the FCGI listener socket. 1.37 +1 -1 apache/src/util.c Index: util.c =================================================================== RCS file: /export/home/cvs/apache/src/util.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C3 -r1.36 -r1.37 *** util.c 1996/12/05 14:07:04 1.36 --- util.c 1996/12/28 00:04:53 1.37 *************** *** 943,949 **** #endif #ifdef __EMX__ /* OS/2 dosen't have Users and Groups */ ! return (finfo->st_mode & S_IEXEC); #else if(user_id == finfo->st_uid) if(finfo->st_mode & S_IXUSR) --- 943,949 ---- #endif #ifdef __EMX__ /* OS/2 dosen't have Users and Groups */ ! return 1; #else if(user_id == finfo->st_uid) if(finfo->st_mode & S_IXUSR)