diff options
author | dreid <dreid@13f79535-47bb-0310-9956-ffa450edef68> | 2000-03-26 20:53:33 +0000 |
---|---|---|
committer | dreid <dreid@13f79535-47bb-0310-9956-ffa450edef68> | 2000-03-26 20:53:33 +0000 |
commit | bb55e7ef4574e0fd157a45600829fdb3d061139a (patch) | |
tree | 0528025cefa46d08aceed5ffa0d849403fe378bc /dso/beos | |
parent | bfbcccf210c3241b2b4106b8b4d210557046d3d5 (diff) | |
download | libapr-bb55e7ef4574e0fd157a45600829fdb3d061139a.tar.gz |
This is the first pass at DSO support for APR. It's basically the patch
sent by Jon Travis <jtravis@covalent.net> moved into a new directory and
tidied up a bit.
I didn't add the assert or the debug stuff and removed the error string as
it made it simpler, and simple is normally good! They can be added in
again easily enough if we want them.
Test program is started but not yet complete. Hopefully tomorrow I'll commit
the test program. This all compiles on BeOS but I haven't tested anywhere
else yet, and haven't added it to be automatically built until others have
tried and made sure it builds for them! Just add 'dso' to the list of
modules in configure.in and rerun autoconf/configure to try it.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@59737 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dso/beos')
-rw-r--r-- | dso/beos/Makefile.in | 60 | ||||
-rw-r--r-- | dso/beos/dso.c | 101 | ||||
-rw-r--r-- | dso/beos/dso.h | 72 |
3 files changed, 233 insertions, 0 deletions
diff --git a/dso/beos/Makefile.in b/dso/beos/Makefile.in new file mode 100644 index 000000000..d0dfd0438 --- /dev/null +++ b/dso/beos/Makefile.in @@ -0,0 +1,60 @@ +#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=../../include +INCLUDES=-I$(INCDIR) -I$(INCDIR1) -I. + +LIB=libdso.a + +OBJS=dso.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 +getopt.o: getopt.c misc.h ../../include/apr_config.h \ + ../../include/apr_general.h ../../include/apr.h \ + ../../include/apr_errno.h ../../include/apr_pools.h \ + ../../include/apr_lib.h ../../include/apr_file_io.h \ + ../../include/apr_getopt.h +start.o: start.c misc.h ../../include/apr_config.h \ + ../../include/apr_general.h ../../include/apr.h \ + ../../include/apr_errno.h ../../include/apr_pools.h \ + ../../include/apr_lib.h ../../include/apr_file_io.h \ + ../../include/apr_getopt.h diff --git a/dso/beos/dso.c b/dso/beos/dso.c new file mode 100644 index 000000000..3c63d8eaa --- /dev/null +++ b/dso/beos/dso.c @@ -0,0 +1,101 @@ +/* =================================================================== + * Copyright (c) 1996-2000 The Apache Software Foundation. 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 Software Foundation + * for use in the Apache HTTP server project (http://www.apache.org/)." + * + * 4. The names "Apache Server" and "Apache Software Foundation" 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 Software Foundation. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the Apache Software Foundation + * for use in the Apache HTTP server project (http://www.apache.org/)." + * + * THIS SOFTWARE IS PROVIDED BY THE Apache Software Foundation ``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 Software Foundation 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 Software Foundation and was originally based + * on public domain software written at the National Center for + * Supercomputing Applications, University of Illinois, Urbana-Champaign. + * For more information on the Apache Software Foundation and the Apache HTTP server + * project, please see <http://www.apache.org/>. + * + */ + +#include "dso.h" + + +ap_status_t ap_dso_init(void){ + return APR_SUCCESS; +} + +ap_status_t ap_dso_load(const char *path, ap_context_t *ctx, + ap_dso_handle_t **res_handle) +{ + image_id newid; + + if((newid = load_add_on(path)) < B_NO_ERROR) + return APR_EINIT; + + *res_handle = ap_pcalloc(ctx, sizeof(*res_handle)); + (*res_handle)->handle = newid; + (*res_handle)->cont = ctx; + return APR_SUCCESS; +} + +ap_status_t ap_dso_unload(ap_dso_handle_t *handle) +{ + if(unload_add_on(handle->handle) < B_NO_ERROR) + return APR_EINIT; + + return APR_SUCCESS; +} + +ap_status_t ap_dso_sym(ap_dso_handle_t *handle, const char *symname, + ap_dso_handle_sym_t *ressym) +{ + int err; + + if (symname == NULL) + return APR_EINIT; + + err = get_image_symbol(handle->handle, symname, B_SYMBOL_TYPE_ANY, + ressym); + + if(err != B_OK) + return APR_EINIT; + + return APR_SUCCESS; +} diff --git a/dso/beos/dso.h b/dso/beos/dso.h new file mode 100644 index 000000000..e82564f1f --- /dev/null +++ b/dso/beos/dso.h @@ -0,0 +1,72 @@ +/* =================================================================== + * Copyright (c) 1996-2000 The Apache Software Foundation. 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 Software Foundation + * for use in the Apache HTTP server project (http://www.apache.org/)." + * + * 4. The names "Apache Server" and "Apache Software Foundation" 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 Software Foundation. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the Apache Software Foundation + * for use in the Apache HTTP server project (http://www.apache.org/)." + * + * THIS SOFTWARE IS PROVIDED BY THE Apache Software Foundation ``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 Software Foundation 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 Software Foundation and was originally based + * on public domain software written at the National Center for + * Supercomputing Applications, University of Illinois, Urbana-Champaign. + * For more information on the Apache Software Foundation and the Apache HTTP server + * project, please see <http://www.apache.org/>. + * + */ + +#ifndef DSO_H +#define DSO_H + +#include "apr_config.h" +#include "apr_general.h" +#include "apr_pools.h" +#include "apr_errno.h" +#include "apr_dso.h" +#include <kernel/image.h> + +struct ap_dso_handle_st { + image_id handle; /* Handle to the DSO loaded */ + ap_context_t *cont; +}; + +#endif
\ No newline at end of file |