summaryrefslogtreecommitdiff
path: root/dso
diff options
context:
space:
mode:
authortrawick <trawick@13f79535-47bb-0310-9956-ffa450edef68>2000-08-17 14:20:13 +0000
committertrawick <trawick@13f79535-47bb-0310-9956-ffa450edef68>2000-08-17 14:20:13 +0000
commitc38bf4f423fc3ddb41684f625ffe5aab4368ffb6 (patch)
tree9b8cf2f8bc10ca15085cc7d4df73225979b9ef89 /dso
parent75f044d12315d919579d27b3853b396d8b4b75bd (diff)
downloadlibapr-c38bf4f423fc3ddb41684f625ffe5aab4368ffb6.tar.gz
Add support to APR for dsos on OS/390.
Submitted by: Greg Ames Reviewed by: Jeff Trawick git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@60501 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dso')
-rw-r--r--dso/os390/.cvsignore1
-rw-r--r--dso/os390/Makefile.in60
-rw-r--r--dso/os390/dso.c129
-rw-r--r--dso/os390/dso.h76
4 files changed, 266 insertions, 0 deletions
diff --git a/dso/os390/.cvsignore b/dso/os390/.cvsignore
new file mode 100644
index 000000000..f3c7a7c5d
--- /dev/null
+++ b/dso/os390/.cvsignore
@@ -0,0 +1 @@
+Makefile
diff --git a/dso/os390/Makefile.in b/dso/os390/Makefile.in
new file mode 100644
index 000000000..f755b93e6
--- /dev/null
+++ b/dso/os390/Makefile.in
@@ -0,0 +1,60 @@
+#CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS)
+#LIBS=$(EXTRA_LIBS) $(LIBS1)
+#INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES)
+#LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
+
+RM=@RM@
+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
+
+
+$(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.in. 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_private.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_private.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/os390/dso.c b/dso/os390/dso.c
new file mode 100644
index 000000000..6b491a75a
--- /dev/null
+++ b/dso/os390/dso.c
@@ -0,0 +1,129 @@
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 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. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" 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 name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+#include "apr_strings.h"
+#include "dso.h"
+#include <errno.h>
+#include <string.h>
+
+#if APR_HAS_DSO
+
+static apr_status_t dso_cleanup(void *thedso)
+{
+ apr_dso_handle_t *dso = thedso;
+ return apr_dso_unload(dso);
+}
+
+apr_status_t apr_dso_load(apr_dso_handle_t **res_handle, const char *path,
+ apr_pool_t *ctx)
+{
+ dllhandle *handle;
+ int rc;
+
+ *res_handle = apr_pcalloc(ctx, sizeof(*res_handle));
+
+ if ((handle = dllload(path)) != NULL) {
+ (*res_handle)->handle = handle;
+ apr_register_cleanup(ctx, *res_handle, dso_cleanup, apr_null_cleanup);
+ return APR_SUCCESS;
+ }
+
+ (*res_handle)->failing_errno = errno;
+ return errno;
+}
+
+apr_status_t apr_dso_unload(apr_dso_handle_t *handle)
+{
+ int rc;
+
+ if (handle->handle == 0)
+ return APR_SUCCESS;
+
+ rc = dllfree(handle->handle);
+
+ if (rc == 0) {
+ handle->handle = 0;
+ return APR_SUCCESS;
+ }
+ handle->failing_errno = errno;
+ return errno;
+}
+
+apr_status_t apr_dso_sym(apr_dso_handle_sym_t *ressym,
+ apr_dso_handle_t *handle,
+ const char *symname)
+{
+ void *func_ptr;
+ void *var_ptr;
+
+ if ((func_ptr = (void *)dllqueryfn(handle->handle, symname)) != NULL) {
+ *ressym = func_ptr;
+ return APR_SUCCESS;
+ }
+ if ((var_ptr = dllqueryvar(handle->handle, symname)) != NULL) {
+ *ressym = var_ptr;
+ return APR_SUCCESS;
+ }
+ handle->failing_errno = errno;
+ return errno;
+}
+
+const char *apr_dso_error(apr_dso_handle_t *handle, char *buffer,
+ apr_size_t buflen)
+{
+ apr_cpystrn(buffer, strerror(handle->failing_errno), buflen);
+ return buffer;
+}
+
+#endif
diff --git a/dso/os390/dso.h b/dso/os390/dso.h
new file mode 100644
index 000000000..0ee06e7f9
--- /dev/null
+++ b/dso/os390/dso.h
@@ -0,0 +1,76 @@
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 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. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" 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 name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``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. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+#ifndef DSO_H
+#define DSO_H
+
+#include "apr_private.h"
+#include "apr_general.h"
+#include "apr_pools.h"
+#include "apr_dso.h"
+#include "apr.h"
+
+#if APR_HAS_DSO
+
+#include <dll.h>
+
+struct apr_dso_handle_t {
+ dllhandle *handle; /* Handle to the DSO loaded */
+ int failing_errno; /* Don't save the buffer returned by
+ strerror(); it gets reused */
+};
+
+#endif
+
+#endif