rbb 99/07/01 10:48:18
Modified: apr Makefile.in configure.in Added: apr/shmem/unix Makefile.in shmem.c include apr_shmem.h Log: First pass at shared memory for Unix. Revision Changes Path 1.12 +2 -2 apache-apr/apr/Makefile.in Index: Makefile.in =================================================================== RCS file: /home/cvs/apache-apr/apr/Makefile.in,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- Makefile.in 1999/06/30 19:45:30 1.11 +++ Makefile.in 1999/07/01 17:48:11 1.12 @@ -22,9 +22,9 @@ # # Macros for target determination # -MODULES=lib file_io network_io threadproc locks misc time +MODULES=lib file_io network_io threadproc locks misc time shmem SUBDIRS=lib file_io/@OSDIR@ network_io/@OSDIR@ threadproc/@OSDIR@ \ - locks/@OSDIR@ misc/@OSDIR@ time/@OSDIR@ signal/@OSDIR@ + locks/@OSDIR@ misc/@OSDIR@ time/@OSDIR@ signal/@OSDIR@ shmem/@OSDIR@ # # Rules for turning inputs into outputs 1.24 +2 -1 apache-apr/apr/configure.in Index: configure.in =================================================================== RCS file: /home/cvs/apache-apr/apr/configure.in,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- configure.in 1999/06/30 19:45:31 1.23 +++ configure.in 1999/07/01 17:48:12 1.24 @@ -179,4 +179,5 @@ AC_OUTPUT(Makefile lib/Makefile file_io/$OSDIR/Makefile network_io/$OSDIR/Makefile threadproc/$OSDIR/Makefile locks/$OSDIR/Makefile misc/$OSDIR/Makefile - time/$OSDIR/Makefile signal/$OSDIR/Makefile test/Makefile) + time/$OSDIR/Makefile signal/$OSDIR/Makefile shmem/$OSDIR/Makefile + test/Makefile) 1.1 apache-apr/apr/shmem/unix/Makefile.in Index: Makefile.in =================================================================== #CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS) #LIBS=$(EXTRA_LIBS) $(LIBS1) #INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES) #LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS) [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ @CFLAGS@ @OPTIM@ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ $(LDLIBS) INCDIR=../../include INCDIR1=../../../include INCLUDES=-I$(INCDIR) -I$(INCDIR1) -Imm -I. LIB=../libshmem.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 >> Makefile.new \ && sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' \ -e '1,$$s: $(OSDIR)/: $$(OSDIR)/:g' Makefile.new \ > Makefile.in \ && rm Makefile.new # DO NOT REMOVE 1.1 apache-apr/apr/shmem/unix/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 * [EMAIL PROTECTED] * * 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 "mm.h" #include "apr_general.h" #include "apr_errno.h" struct shmem_t { MM *mm; ap_context_t *cntxt; }; ap_status_t ap_shm_create(ap_context_t *cont, ap_size_t size, const char *file, struct shmem_t **new) { MM *mm = mm_create(size, file); if (mm == NULL) { return APR_ENOMEM; } (*new) = (struct shmem_t *)mm_malloc(mm, sizeof(struct shmem_t)); if ((*new) == NULL) { return APR_ENOMEM; } (*new)->mm = mm; (*new)->cntxt = cont; return APR_SUCCESS; } ap_status_t ap_shm_destroy(struct shmem_t *shared) { mm_destroy(shared->mm); shared->mm = NULL; return APR_SUCCESS; } ap_status_t ap_shm_malloc(struct shmem_t *shared, ap_size_t size, void **entity) { entity = mm_malloc(shared->mm, size); if (entity == NULL) { return APR_ENOMEM; } return APR_SUCCESS; } ap_status_t ap_shm_calloc(struct shmem_t *shared, ap_size_t num, ap_size_t size, void **entity) { entity = mm_calloc(shared->mm, num, size); if (entity == NULL) { return APR_ENOMEM; } return APR_SUCCESS; } ap_status_t ap_shm_realloc(struct shmem_t *shared, ap_size_t size, void **entity) { void *new; new = mm_realloc(shared->mm, *entity, size); if (new == NULL) { return APR_ENOMEM; } (*entity) = new; return APR_SUCCESS; } ap_status_t apr_shm_free(struct shmem_t *shared, void *entity) { mm_free(shared->mm, entity); return APR_SUCCESS; } ap_status_t ap_shm_strdup(struct shmem_t *shared, const char *old, char **new) { (*new) = mm_strdup(shared->mm, old); if ((*new) == NULL) { return APR_ENOMEM; } return APR_SUCCESS; } ap_status_t ap_shm_sizeof(struct shmem_t *shared, const void *ent, ap_size_t *size) { *size = mm_sizeof(shared->mm, ent); if ((*size) == -1) { return APR_EINVAL; } return APR_SUCCESS; } ap_status_t ap_shm_maxsize(ap_size_t *size) { (*size) = mm_maxsize(); if ((*size) <= 0) { return APR_ENOMEM; } return APR_SUCCESS; } ap_status_t ap_shm_available(struct shmem_t *shared, ap_size_t *size) { (*size) = mm_available(shared->mm); if ((*size) <= 0) { return APR_ENOMEM; } return APR_SUCCESS; } ap_status_t ap_shm_child_create(ap_context_t *cont, const char *fname, struct shmem_t **shared) { return APR_SUCCESS; } 1.1 apache-apr/include/apr_shmem.h Index: apr_shmem.h =================================================================== /* ==================================================================== * 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 * [EMAIL PROTECTED] * * 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/>. * */ #ifndef APR_SHMEM_H #define APR_SHMEM_H #include "apr_general.h" #include "apr_errno.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ typedef struct shmem_t ap_shmem_t ap_status_t ap_shm_create(ap_context_t *, ap_size_t, const char *, ap_shmem_t **); ap_status_t ap_shm_destroy(ap_shmem_t *); ap_status_t ap_shm_malloc(ap_shmem_t *, ap_size_t, void **); ap_status_t ap_shm_calloc(ap_shmem_t *, ap_size_t, ap_size_t, void **); ap_status_t ap_shm_realloc(ap_shmem_t *, ap_size_t, void **); ap_status_t ap_shm_free(ap_shmem_t *, void *); ap_status_t ap_shm_strdup(ap_shmem_t *, const char *, char **); ap_status_t ap_shm_sizeof(ap_shmem_t *, void *, ap_size_t *); ap_status_t ap_shm_maxsize(ap_size_t *); ap_status_t ap_shm_available(ap_shmem_t *, ap_size_t *); ap_status_t ap_shm_child_create(ap_context_t *, const char *, ap_shmem_t**); #ifdef __cplusplus } #endif #endif /* ! APR_FILE_IO_H */