You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@locus.apache.org on 2000/05/16 19:12:46 UTC

cvs commit: apache-2.0/src/lib/apr/mmap/unix common.c mmap.c mmap_h.h

rbb         00/05/16 10:12:46

  Modified:    src/lib/apr/mmap/unix common.c mmap.c mmap_h.h
  Removed:     src/lib/apr/mmap/beos Makefile.in mmap.c mmap_common.c
                        mmap_h.h
  Log:
  Update the unix code to support BeOS.  Remove the now un-necessary BeOS
  directory.
  
  Revision  Changes    Path
  1.12      +0 -4      apache-2.0/src/lib/apr/mmap/unix/common.c
  
  Index: common.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/mmap/unix/common.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- common.c	2000/04/14 01:38:44	1.11
  +++ common.c	2000/05/16 17:12:45	1.12
  @@ -61,11 +61,7 @@
    *
    */
   
  -#ifdef BEOS
  -#include "../beos/mmap_h.h"
  -#else
   #include "mmap_h.h"
  -#endif
   
   #if HAVE_MMAP
   
  
  
  
  1.20      +36 -9     apache-2.0/src/lib/apr/mmap/unix/mmap.c
  
  Index: mmap.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/mmap/unix/mmap.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- mmap.c	2000/04/30 21:17:56	1.19
  +++ mmap.c	2000/05/16 17:12:45	1.20
  @@ -52,12 +52,7 @@
    * <http://www.apache.org/>.
    */
   
  -#ifdef BEOS
  -#include "../beos/mmap_h.h"
  -#else
   #include "mmap_h.h"
  -#endif
  -
   #include "apr_portable.h"
   
   #if HAVE_MMAP
  @@ -66,33 +61,65 @@
   {
       ap_mmap_t *mm = themmap;
       int rv;
  +#ifdef BEOS
  +    rv = delete_area(mm->area);
  +
  +    if (rv == 0) {
  +        mm->mm = (caddr_t)-1;
  +        return APR_SUCCESS;
  +    }
  +#else
       rv = munmap(mm->mm, mm->size);
   
       if (rv == 0) {
           mm->mm = (caddr_t)-1;
           return APR_SUCCESS;
       }
  -    else
  -        return errno;
  +#endif
  +    return errno;
   }
   
   ap_status_t ap_mmap_create(ap_mmap_t **new, ap_file_t *file, ap_off_t offset, 
          ap_size_t size, ap_pool_t *cont)
   {
  +#ifdef BEOS
  +    void *mm;
  +    area_id aid = -1;
  +    char *areaname = "apr_mmap\0";
  +    uint32 pages = 0;
  +#else
       caddr_t mm;
  +#endif
      
  -    if (file == NULL || file->filedes == -1)
  +    if (file == NULL || file->filedes == -1 || file->buffered)
           return APR_EBADF;
  -
       (*new) = (ap_mmap_t *)ap_pcalloc(cont, sizeof(ap_mmap_t));
       
       ap_seek(file, APR_SET, &offset);
  +#ifdef BEOS
  +    pages = ((size -1) / B_PAGE_SIZE) + 1;
  +
  +    aid = create_area(areaname, &mm , B_ANY_ADDRESS, pages * B_PAGE_SIZE,
  +        B_FULL_LOCK, B_READ_AREA|B_WRITE_AREA);
  +
  +    if (aid < B_NO_ERROR) {
  +        /* we failed to get an mmap'd file... */
  +        return APR_ENOMEM;
  +    }
  +
  +    if (aid >= B_NO_ERROR)
  +        read(file->filedes, mm, size);
  +    (*new)->area = aid;
  +#else
  +
       mm = mmap(NULL, size, PROT_READ, MAP_SHARED, file->filedes ,0);
   
       if (mm == (caddr_t)-1) {
           /* we failed to get an mmap'd file... */
           return APR_ENOMEM;
       }
  +#endif
  +
       (*new)->mm = mm;
       (*new)->size = size;
       (*new)->cntxt = cont;
  
  
  
  1.12      +3 -4      apache-2.0/src/lib/apr/mmap/unix/mmap_h.h
  
  Index: mmap_h.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/mmap/unix/mmap_h.h,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- mmap_h.h	2000/04/22 06:16:40	1.11
  +++ mmap_h.h	2000/05/16 17:12:45	1.12
  @@ -60,11 +60,7 @@
   #include "apr_mmap.h"
   #include "apr_errno.h"
   #include "fileio.h"
  -#ifdef BEOS
  -#include "../beos/mmap_h.h"
  -#else
   #include "mmap_h.h"
  -#endif
   
   /* System headers required for the mmap library */
   #ifdef BEOS
  @@ -86,6 +82,9 @@
   
   struct ap_mmap_t {
       ap_pool_t *cntxt;
  +#ifdef BEOS
  +    area_id;
  +#endif
       void *mm;
       size_t size;
   };
  
  
  

Re: cvs commit: apache-2.0/src/lib/apr/mmap/unix common.c mmap.c mmap_h.h

Posted by rb...@covalent.net.
On Tue, 16 May 2000, Greg Stein wrote:

> On 16 May 2000 rbb@locus.apache.org wrote:
> > rbb         00/05/16 10:12:46
> > 
> >   Modified:    src/lib/apr/mmap/unix common.c mmap.c mmap_h.h
> >   Removed:     src/lib/apr/mmap/beos Makefile.in mmap.c mmap_common.c
> >                         mmap_h.h
> >   Log:
> >   Update the unix code to support BeOS.  Remove the now un-necessary BeOS
> >   directory.
> >...
> >   --- mmap_h.h	2000/04/22 06:16:40	1.11
> >   +++ mmap_h.h	2000/05/16 17:12:45	1.12
> >   @@ -60,11 +60,7 @@
> >    #include "apr_mmap.h"
> >    #include "apr_errno.h"
> >    #include "fileio.h"
> >   -#ifdef BEOS
> >   -#include "../beos/mmap_h.h"
> >   -#else
> >    #include "mmap_h.h"
> >   -#endif
> >    
> >    /* System headers required for the mmap library */
> >    #ifdef BEOS
> >   @@ -86,6 +82,9 @@
> >    
> >    struct ap_mmap_t {
> >        ap_pool_t *cntxt;
> >   +#ifdef BEOS
> >   +    area_id;
> >   +#endif
> 
> Isn't that supposed to be "area_id area;" ??

Yeah.  I'll fix that ASAP.

Ryan


_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: apache-2.0/src/lib/apr/mmap/unix common.c mmap.c mmap_h.h

Posted by Greg Stein <gs...@lyra.org>.
On 16 May 2000 rbb@locus.apache.org wrote:
> rbb         00/05/16 10:12:46
> 
>   Modified:    src/lib/apr/mmap/unix common.c mmap.c mmap_h.h
>   Removed:     src/lib/apr/mmap/beos Makefile.in mmap.c mmap_common.c
>                         mmap_h.h
>   Log:
>   Update the unix code to support BeOS.  Remove the now un-necessary BeOS
>   directory.
>...
>   --- mmap_h.h	2000/04/22 06:16:40	1.11
>   +++ mmap_h.h	2000/05/16 17:12:45	1.12
>   @@ -60,11 +60,7 @@
>    #include "apr_mmap.h"
>    #include "apr_errno.h"
>    #include "fileio.h"
>   -#ifdef BEOS
>   -#include "../beos/mmap_h.h"
>   -#else
>    #include "mmap_h.h"
>   -#endif
>    
>    /* System headers required for the mmap library */
>    #ifdef BEOS
>   @@ -86,6 +82,9 @@
>    
>    struct ap_mmap_t {
>        ap_pool_t *cntxt;
>   +#ifdef BEOS
>   +    area_id;
>   +#endif

Isn't that supposed to be "area_id area;" ??

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/