httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dr...@hyperreal.org
Subject cvs commit: apache-2.0/src/lib/apr/shmem/unix/mm configure.in mm.h mm_conf.h.in mm_core.c
Date Sat, 05 Feb 2000 12:07:39 GMT
dreid       00/02/05 04:07:39

  Modified:    src/lib/apr/shmem/unix/mm configure.in mm.h mm_conf.h.in
                        mm_core.c
  Log:
  This commit gets mm running on BeOS.  With this BeOS APR once more
  compiles and builds cleanly.  Not sure if this is how to update mm, but
  it gets things working again.
  
  Revision  Changes    Path
  1.3       +12 -0     apache-2.0/src/lib/apr/shmem/unix/mm/configure.in
  
  Index: configure.in
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/shmem/unix/mm/configure.in,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- configure.in	1999/09/27 07:42:04	1.2
  +++ configure.in	2000/02/05 12:07:37	1.3
  @@ -93,12 +93,16 @@
   AC_HAVE_HEADERS(unistd.h)
   AC_HAVE_FUNCS(getpagesize sysconf)
   AC_CHECK_DEFINE(_SC_PAGESIZE, unistd.h)
  +AC_HAVE_HEADERS(kernel/OS.h)
  +AC_CHECK_DEFINE(B_PAGE_SIZE, kernel/OS.h)
   
   AC_BEGIN_DECISION([memory page size determination])
   AC_IFALLYES(header:unistd.h func:getpagesize, 
               AC_DECIDE(MM_VMPS_GETPAGESIZE, [4.2BSD getpagesize()]))
   AC_IFALLYES(header:unistd.h func:sysconf define:_SC_PAGESIZE, 
               AC_DECIDE(MM_VMPS_SYSCONF, [POSIX.1 sysconf(_SC_PAGESIZE)]))
  +AC_IFALLYES(header:kernel/OS.h define:B_PAGE_SIZE,
  +            AC_DECIDE(MM_VMPS_BEOS, [BeOS B_PAGE_SIZE])) 
   AC_END_DECISION
   AC_DEFINE_UNQUOTED($ac_decision)
   
  @@ -114,6 +118,8 @@
   AC_TEST_FILE(/dev/zero)
   AC_HAVE_HEADERS(sys/ipc.h sys/shm.h sys/file.h)
   AC_HAVE_FUNCS(shmget shmat shmdt shmctl)
  +AC_HAVE_HEADERS(kernel/OS.h)
  +AC_HAVE_FUNCS(create_area)
   
   AC_BEGIN_DECISION([shared memory allocation method])
   AC_IFALLYES(header:sys/mman.h func:mmap func:munmap, 
  @@ -127,6 +133,8 @@
               AC_DECIDE(MM_SHMT_IPCSHM, [SysV IPC shmget()]))
   AC_IFALLYES(header:sys/mman.h func:mmap func:munmap define:MAP_ANON, 
               AC_DECIDE(MM_SHMT_MMANON, [4.4BSD-style mmap() via MAP_ANON]))
  +AC_IFALLYES(header:kernel/OS.h func:create_area,
  +           AC_DECIDE(MM_SHMT_BEOS, [BeOS areas]))
   case $PLATFORM in
       *-*-linux* ) 
           #   Linux has problems with MM_SHMT_MMANON
  @@ -155,6 +163,8 @@
   AC_CHECK_DEFINE(F_SETLK, fcntl.h)
   AC_CHECK_DEFINE(IPC_PRIVATE, sys/ipc.h)
   AC_CHECK_DEFINE(SEM_UNDO, sys/sem.h)
  +AC_HAVE_HEADERS(kernel/OS.h)
  +AC_CHECK_FUNCS(create_sem, kernel/OS.h)
   
   AC_MSG_CHECKING(whether union semun is defined in sys/sem.h)
   AC_TRY_COMPILE([
  @@ -178,6 +188,8 @@
               AC_DECIDE(MM_SEMT_IPCSEM, [SysV IPC semget()]))
   AC_IFALLYES(header:fcntl.h define:F_SETLK, 
               AC_DECIDE(MM_SEMT_FCNTL, [SVR4-style fcntl() on temporary file]))
  +AC_IFALLYES(header:kernel/OS.h func:create_sem,
  +            AC_DECIDE(MM_SEMT_BEOS, [BeOS semaphores/benaphores]))
   AC_ARG_WITH(sem,dnl
   [  --with-sem=TYPE         force semaphore type: FLOCK FCNTL IPCSEM],
   AC_DECISION_FORCE(MM_SEMT_$withval)
  
  
  
  1.3       +11 -0     apache-2.0/src/lib/apr/shmem/unix/mm/mm.h
  
  Index: mm.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/shmem/unix/mm/mm.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- mm.h	1999/09/27 07:42:08	1.2
  +++ mm.h	2000/02/05 12:07:37	1.3
  @@ -187,6 +187,10 @@
   #include <sys/file.h>
   #endif
   
  +#ifdef MM_SHMT_BEOS
  +#include <kernel/OS.h>
  +#endif
  +
   #define MM_ALLOC_MINSIZE         (1024*8) 
   #define MM_CORE_FILEMODE         (S_IRUSR|S_IWUSR)
   #define MM_CORE_DEFAULT_PAGESIZE (1024*8)
  @@ -262,6 +266,13 @@
      int          mc_fdmem;
   #if defined(MM_SHMT_MMFILE)
      char         mc_fnmem[MM_MAXPATH];
  +#endif
  +#if defined(MM_SHMT_BEOS)
  +    area_id     mc_areaid;
  +#endif
  +#if defined(MM_SEMT_BEOS)
  +    sem_id      mc_semid;
  +    int32       mc_ben;
   #endif
   #if !defined(MM_SEMT_FLOCK)
      int          mc_fdsem;
  
  
  
  1.2       +3 -0      apache-2.0/src/lib/apr/shmem/unix/mm/mm_conf.h.in
  
  Index: mm_conf.h.in
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/shmem/unix/mm/mm_conf.h.in,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- mm_conf.h.in	1999/08/17 15:59:45	1.1
  +++ mm_conf.h.in	2000/02/05 12:07:38	1.2
  @@ -8,6 +8,7 @@
   /* VM Page Size Determination */
   #undef MM_VMPS_GETPAGESIZE
   #undef MM_VMPS_SYSCONF
  +#undef MM_VMPS_BEOS
   
   /* Shared Memory Type */
   #undef MM_SHMT_MMANON
  @@ -15,6 +16,7 @@
   #undef MM_SHMT_MMZERO
   #undef MM_SHMT_MMFILE
   #undef MM_SHMT_IPCSHM
  +#undef MM_SHMT_BEOS
   
   /* Shared Memory Maximum Segment Size */
   #define MM_SHM_MAXSEGSIZE @MM_SHM_MAXSEGSIZE@
  @@ -23,6 +25,7 @@
   #undef MM_SEMT_FLOCK
   #undef MM_SEMT_FCNTL
   #undef MM_SEMT_IPCSEM
  +#undef MM_SEMT_BEOS
   
   /* Debugging */
   #undef MM_DEBUG
  
  
  
  1.3       +42 -0     apache-2.0/src/lib/apr/shmem/unix/mm/mm_core.c
  
  Index: mm_core.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/shmem/unix/mm/mm_core.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- mm_core.c	1999/09/27 07:42:09	1.2
  +++ mm_core.c	2000/02/05 12:07:38	1.3
  @@ -149,6 +149,8 @@
           pagesize = getpagesize();
   #elif defined(MM_VMPS_SYSCONF)
           pagesize = sysconf(_SC_PAGESIZE);
  +#elif defined(MM_VMPS_BEOS)
  +        pagesize = B_PAGE_SIZE;
   #else
           pagesize = MM_CORE_DEFAULT_PAGESIZE;
   #endif
  @@ -207,6 +209,9 @@
   #if defined(MM_SEMT_FLOCK) || defined(MM_SEMT_FCNTL)
       char semfilename[MM_MAXPATH];
   #endif
  +#if defined(MM_SHMT_BEOS)
  +    area_id temparea;
  +#endif
       char filename[MM_MAXPATH];
   
       if (usersize <= 0 || usersize > mm_core_maxsegsize()) {
  @@ -236,6 +241,11 @@
           FAIL(MM_ERR_CORE|MM_ERR_SYSTEM, "failed to memory map anonymous area");
   #endif /* MM_SHMT_MMANON */
   
  +#if defined(MM_SHMT_BEOS)
  +    if ((temparea = create_area("mm",(void*)&area, B_ANY_ADDRESS,
  +                        size, B_LAZY_LOCK, B_READ_AREA | B_WRITE_AREA)) < 0)
  +        FAIL(MM_ERR_CORE|MM_ERR_SYSTEM, "failed to create the memory area");
  +#endif /* MM_SHMT_BEOS */
   #if defined(MM_SHMT_MMPOSX)
       shm_unlink(fnmem); /* Ok when it fails */
       if ((fdmem = shm_open(fnmem, O_RDWR|O_CREAT, MM_CORE_FILEMODE)) == -1)
  @@ -335,6 +345,13 @@
   #else
       mc->mc_fdsem    = fdsem;
   #endif
  +#if defined(MM_SEMT_BEOS)
  +    mc->mc_semid = create_sem(0, "mm_semid");
  +    mc->mc_ben=0;
  +#endif
  +#if defined(MM_SHMT_BEOS)
  +    mc->mc_areaid = temparea;
  +#endif
   #if defined(MM_SEMT_IPCSEM)
       mc->mc_fdsem_rd = fdsem_rd;
       mc->mc_readers  = 0;
  @@ -371,6 +388,13 @@
       if (fdmem != -1)
           shmctl(fdmem, IPC_RMID, NULL);
   #endif
  +#if defined(MM_SHMT_BEOS)
  +    delete_area(mc->mc_areaid);
  +#endif
  +#if defined(MM_SEMT_BEOS)
  +    delete_sem(mc->mc_semid);
  +#endif
  +
   #if defined(MM_SEMT_FLOCK) || defined(MM_SEMT_FCNTL)
       if (fdsem != -1)
           close(fdsem);
  @@ -529,6 +553,17 @@
       }
       mc->mc_lockmode = mode;
   #endif
  +#if defined(MM_SEMT_BEOS)
  +	rc=0;
  +	if (atomic_add (&mc->mc_ben, 1) > 0){
  +		/* someone already in lock..acquire sem and wait */
  +		if (acquire_sem(mc->mc_semid) != B_NO_ERROR){
  +			atomic_add(&mc->mc_ben,-1);
  +	        rc = -1;
  +    	}
  +    }
  +#endif
  +
       if (rc < 0) {
           ERR(MM_ERR_CORE|MM_ERR_SYSTEM, "Failed to lock");
           rc = FALSE;
  @@ -572,6 +607,13 @@
           while (((rc = semop(fdsem, mm_core_dounlock, 1)) < 0) && (errno == EINTR))
;
       }
   #endif
  +#if defined(MM_SEMT_BEOS)
  +    rc=0;
  +	if (atomic_add(&mc->mc_ben, -1) > 1){
  +		release_sem(mc->mc_semid);
  +    }
  +#endif
  +
       if (rc < 0) {
           ERR(MM_ERR_CORE|MM_ERR_SYSTEM, "Failed to unlock");
           rc = FALSE;
  
  
  

Mime
View raw message