You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by bj...@locus.apache.org on 2000/03/16 10:48:31 UTC
cvs commit: apache-2.0/src/lib/apr/shmem/unix shmem.c
bjh 00/03/16 01:48:31
Modified: src/lib/apr/include apr_shmem.h
src/lib/apr/shmem/unix shmem.c
Added: src/lib/apr/shmem/os2 Makefile.in shmem.c
Log:
Shared memory for OS/2
Revision Changes Path
1.5 +1 -1 apache-2.0/src/lib/apr/include/apr_shmem.h
Index: apr_shmem.h
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_shmem.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- apr_shmem.h 2000/03/10 00:06:09 1.4
+++ apr_shmem.h 2000/03/16 09:48:31 1.5
@@ -74,7 +74,7 @@
typedef struct shmem_t ap_shmem_t;
-ap_status_t ap_shm_init(ap_shmem_t **m, ap_size_t reqsize, const char *file);
+ap_status_t ap_shm_init(ap_shmem_t **m, ap_size_t reqsize, const char *file, ap_context_t *cont);
ap_status_t ap_shm_destroy(ap_shmem_t *m);
void *ap_shm_malloc(ap_shmem_t *c, ap_size_t reqsize);
void *ap_shm_calloc(ap_shmem_t *shared, ap_size_t size);
1.1 apache-2.0/src/lib/apr/shmem/os2/Makefile.in
Index: Makefile.in
===================================================================
#CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS)
#LIBS=$(EXTRA_LIBS) $(LIBS1)
#INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES)
#LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
CC=@CC@
RANLIB=@RANLIB@
CFLAGS=@CFLAGS@ @OPTIM@
LIBS=@LIBS@
LDFLAGS=@LDFLAGS@ $(LIBS)
INCDIR=../../inc
INCDIR1=../../include
INCDIR2=../../file_io/os2
INCLUDES=-I$(INCDIR) -I$(INCDIR1) -I$(INCDIR2) -I.
LIB=shmem.a
OBJS=shmem.o
.c.o:
$(CC) $(CFLAGS) -c $(INCLUDES) $<
all: $(LIB)
clean:
$(RM) -f *.o *.a *.so
distclean: clean
-$(RM) -f Makefile
$(OBJS): Makefile
$(LIB): $(OBJS)
$(RM) -f $@
$(AR) cr $@ $(OBJS)
$(RANLIB) $@
#
# We really don't expect end users to use this rule. It works only with
# gcc, and rebuilds Makefile.tmpl. You have to re-run Configure after
# using it.
#
depend:
cp Makefile.in Makefile.in.bak \
&& sed -ne '1,/^# DO NOT REMOVE/p' Makefile.in > Makefile.new \
&& gcc -MM $(INCLUDES) $(CFLAGS) *.c | sed -e "s%\\\\\(.\)%/\\1%g" >> Makefile.new \
&& sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' \
-e '1,$$s: $(INCDIR1)/: $$(INCDIR1)/:g' \
-e '1,$$s: $(INCDIR2)/: $$(INCDIR2)/:g' \
-e '1,$$s: $(OSDIR)/: $$(OSDIR)/:g' Makefile.new \
> Makefile.in \
&& rm Makefile.new
# DO NOT REMOVE
shmem.o: shmem.c $(INCDIR1)/apr_general.h $(INCDIR1)/apr.h \
$(INCDIR1)/apr_errno.h $(INCDIR1)/apr_shmem.h \
$(INCDIR1)/apr_lib.h $(INCDIR1)/apr_file_io.h \
$(INCDIR1)/apr_time.h $(INCDIR1)/apr_thread_proc.h
1.1 apache-2.0/src/lib/apr/shmem/os2/shmem.c
Index: shmem.c
===================================================================
/* ====================================================================
* Copyright (c) 1999 The Apache Group. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the Apache Group
* for use in the Apache HTTP server project (http://www.apache.org/)."
*
* 4. The names "Apache Server" and "Apache Group" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the Apache Group
* for use in the Apache HTTP server project (http://www.apache.org/)."
*
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Group.
* For more information on the Apache Group and the Apache HTTP server
* project, please see <http://www.apache.org/>.
*
*/
#include "apr_general.h"
#include "apr_shmem.h"
#include "apr_errno.h"
#include "apr_lib.h"
#include <umalloc.h>
#include <stdlib.h>
#define INCL_DOS
#include <os2.h>
int os2errno( unsigned long oserror );
struct shmem_t {
void *memblock;
Heap_t heap;
};
ap_status_t ap_shm_init(struct shmem_t **m, ap_size_t reqsize, const char *file, ap_context_t *cont)
{
int rc;
struct shmem_t *newm = (struct shmem_t *)ap_palloc(cont, sizeof(struct shmem_t));
char *name = NULL;
if (file)
name = ap_pstrcat(cont, "\\SHAREMEM\\", file, NULL);
rc = DosAllocSharedMem(&(newm->memblock), name, reqsize, PAG_COMMIT|OBJ_GETTABLE|PAG_READ|PAG_WRITE);
if (rc)
return os2errno(rc);
newm->heap = _ucreate(newm->memblock, reqsize, !_BLOCK_CLEAN, _HEAP_REGULAR|_HEAP_SHARED, NULL, NULL);
_uopen(newm->heap);
*m = newm;
return APR_SUCCESS;
}
ap_status_t ap_shm_destroy(struct shmem_t *m)
{
_uclose(m->heap);
_udestroy(m->heap, _FORCE);
DosFreeMem(m->memblock);
return APR_SUCCESS;
}
void *ap_shm_malloc(struct shmem_t *m, ap_size_t reqsize)
{
return _umalloc(m->heap, reqsize);
}
void *ap_shm_calloc(struct shmem_t *m, ap_size_t size)
{
return _ucalloc(m->heap, size, 1);
}
ap_status_t ap_shm_free(struct shmem_t *m, void *entity)
{
free(entity);
return APR_SUCCESS;
}
ap_status_t ap_get_shm_name(ap_shmem_t *c, ap_shm_name_t **name)
{
return APR_ANONYMOUS;
}
ap_status_t ap_set_shm_name(ap_shmem_t *c, ap_shm_name_t *name)
{
return APR_ANONYMOUS;
}
ap_status_t ap_open_shmem(struct shmem_t *m)
{
int rc;
rc = DosGetSharedMem(m->memblock, PAG_READ|PAG_WRITE);
if (rc)
return os2errno(rc);
_uopen(m->heap);
return APR_SUCCESS;
}
ap_status_t ap_shm_avail(struct shmem_t *c, ap_size_t *size)
{
return APR_ENOTIMPL;
}
1.8 +2 -1 apache-2.0/src/lib/apr/shmem/unix/shmem.c
Index: shmem.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/shmem/unix/shmem.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- shmem.c 2000/03/15 17:05:11 1.7
+++ shmem.c 2000/03/16 09:48:31 1.8
@@ -69,8 +69,9 @@
* arg 2) The size of the shared memory pool.
* arg 3) The file to use for the shared memory on platforms that
* require it.
+ * arg 4) The context to use
*/
-ap_status_t ap_shm_init(struct shmem_t **m, ap_size_t reqsize, const char *file)
+ap_status_t ap_shm_init(struct shmem_t **m, ap_size_t reqsize, const char *file, ap_context_t *cont)
{
MM *newmm = mm_create(reqsize, file);
if (newmm == NULL) {