apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject cvs commit: apr/shmem/os2 shm.c
Date Mon, 28 Jan 2002 05:32:32 GMT
bjh         02/01/27 21:32:32

  Modified:    shmem/os2 shm.c
  Log:
  OS/2: Implement apr_os_shm_get/put.
  
  Revision  Changes    Path
  1.5       +17 -2     apr/shmem/os2/shm.c
  
  Index: shm.c
  ===================================================================
  RCS file: /home/cvs/apr/shmem/os2/shm.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- shm.c	25 Jan 2002 07:16:01 -0000	1.4
  +++ shm.c	28 Jan 2002 05:32:32 -0000	1.5
  @@ -57,6 +57,7 @@
   #include "apr_errno.h"
   #include "apr_lib.h"
   #include "apr_strings.h"
  +#include "apr_portable.h"
   
   struct apr_shm_t {
       apr_pool_t *pool;
  @@ -149,13 +150,27 @@
   APR_DECLARE(apr_status_t) apr_os_shm_get(apr_os_shm_t *osshm,
                                            apr_shm_t *shm)
   {
  -    return APR_ENOTIMPL;
  +    *osshm = shm->memblock;
  +    return APR_SUCCESS;
   }
   
   APR_DECLARE(apr_status_t) apr_os_shm_put(apr_shm_t **m,
                                            apr_os_shm_t *osshm,
                                            apr_pool_t *pool)
   {
  -    return APR_ENOTIMPL;
  +    int rc;
  +    apr_shm_t *newm = (apr_shm_t *)apr_palloc(pool, sizeof(apr_shm_t));
  +    ULONG flags = PAG_COMMIT|PAG_READ|PAG_WRITE;
  +
  +    newm->pool = pool;
  +
  +    rc = DosGetSharedMem(&(newm->memblock), flags);
  +
  +    if (rc) {
  +        return APR_FROM_OS_ERROR(rc);
  +    }
  +
  +    *m = newm;
  +    return APR_SUCCESS;
   }    
   
  
  
  

Mime
View raw message