httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Garey Smiley" <ga...@main.slink.com>
Subject Re: New OS/2 features?
Date Thu, 26 Dec 1996 21:35:39 GMT
On Thu, 26 Dec 1996 14:22:31 -0600, Randy Terbush wrote:

>> Randy Terbush liltingly intones:
>> > 
>> > If the changes can be reasonably ifdef'ed for EMX, I don't have
>> > a problem with it. I'm a liberal though... :)
>> > 
>> > > I have two new features for OS/2 and was wondering if I could submit
>> > > them for 1.2. I relaize it may be to late. One is an OS/2 version of a
>> > > MMAP style function for the scoreboard. The other is a UNIX style
>> > > extension to OS/2. Under OS/2 the #! command in the first line of a
>> > > script is not interperted, but I have figured out a way to add this
>> > > feature directly to Apache for OS/2. This will allow greater
>> > > compatabilty to run UNIX scripts under Apache on OS/2.
>> > 
>> Yeah. Who are we to complain about small things after 1.2b3? 8^)
>> 
>> As long as these work, nominally fix a bug, and don't break anything else,
>> I'm OK with them. I think RobH may have said that. Repeatedly. 8^)
>> 
>> chuck
>
>Is Ben online to give us a call about b4? Might be good to head off
>some of these "bug" reports as quickly as possible.
>
>Garey, if you have these patches ready, get them to us ASAP.

OK. Here they are.

*** mod_fastcgi.c.orig	Mon Nov 25 03:22:00 1996
--- mod_fastcgi.c	Thu Dec 26 11:02:42 1996
***************
*** 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.
*** util.c.orig	Thu Dec  5 06:07:04 1996
--- util.c	Thu Dec 26 16:35:46 1996
***************
*** 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)
*** http_core.c.orig	Tue Dec 17 12:30:46 1996
--- http_core.c	Thu Dec 26 14:04:22 1996
***************
*** 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, "~")) {
*** http_protocol.c.orig	Tue Dec 17 12:52:12 1996
--- http_protocol.c	Thu Dec 26 14:17:36 1996
***************
*** 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);
*** http_main.c.orig	Tue Dec 24 11:17:50 1996
--- http_main.c	Thu Dec 26 15:05:10 1996
***************
*** 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
  
*** conf.h.orig	Fri Dec 20 08:27:16 1996
--- conf.h	Thu Dec 26 14:58:30 1996
***************
*** 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,487 ****
--- 482,492 ----
  #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
  #endif


Garey Smiley
SoftLink Services
garey@slink.com
http://www.slink.com/
(330)848-1312 FAX/Data(330)699-4474

Mime
View raw message