summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjh <bjh@13f79535-47bb-0310-9956-ffa450edef68>2001-03-19 12:35:16 +0000
committerbjh <bjh@13f79535-47bb-0310-9956-ffa450edef68>2001-03-19 12:35:16 +0000
commitd71b5e693b34d6ef89e94fb123eb7fc5d0f89d4e (patch)
treea7fbda419d142fcd2954375a2b17a41e1933dcbd
parent2ff8a28a468ebe3e5535533847296586eda348e7 (diff)
downloadlibapr-d71b5e693b34d6ef89e94fb123eb7fc5d0f89d4e.tar.gz
OS/2: add an assortment of misc helper functions that were missing so
exports.c can safely be linked in. There's also a few stub functions returning APR_ENOTIMPL. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@61367 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--file_io/os2/dir.c20
-rw-r--r--locks/os2/locks.c40
-rw-r--r--network_io/os2/Makefile.in1
-rw-r--r--network_io/os2/poll.c26
-rw-r--r--network_io/os2/sendrecv_udp.c73
-rw-r--r--threadproc/os2/proc.c7
-rw-r--r--threadproc/os2/thread.c36
-rw-r--r--threadproc/os2/threadpriv.c33
8 files changed, 236 insertions, 0 deletions
diff --git a/file_io/os2/dir.c b/file_io/os2/dir.c
index ae7c2c626..12d5679e7 100644
--- a/file_io/os2/dir.c
+++ b/file_io/os2/dir.c
@@ -56,6 +56,7 @@
#include "apr_file_io.h"
#include "apr_lib.h"
#include "apr_strings.h"
+#include "apr_portable.h"
#include <string.h>
static apr_status_t dir_cleanup(void *thedir)
@@ -181,5 +182,24 @@ apr_status_t apr_dir_remove(const char *path, apr_pool_t *cont)
+apr_status_t apr_os_dir_get(apr_os_dir_t **thedir, apr_dir_t *dir)
+{
+ if (dir == NULL) {
+ return APR_ENODIR;
+ }
+ *thedir = &dir->handle;
+ return APR_SUCCESS;
+}
+
+apr_status_t apr_os_dir_put(apr_dir_t **dir, apr_os_dir_t *thedir,
+ apr_pool_t *cont)
+{
+ if ((*dir) == NULL) {
+ (*dir) = (apr_dir_t *)apr_pcalloc(cont, sizeof(apr_dir_t));
+ (*dir)->cntxt = cont;
+ }
+ (*dir)->handle = *thedir;
+ return APR_SUCCESS;
+}
diff --git a/locks/os2/locks.c b/locks/os2/locks.c
index 15d721273..9e08a426c 100644
--- a/locks/os2/locks.c
+++ b/locks/os2/locks.c
@@ -55,6 +55,7 @@
#include "apr_general.h"
#include "apr_lib.h"
#include "apr_strings.h"
+#include "apr_portable.h"
#include "locks.h"
#include "fileio.h"
#include <string.h>
@@ -187,3 +188,42 @@ apr_status_t apr_lock_destroy(apr_lock_t *lock)
return APR_OS2_STATUS(rc);
}
+
+
+
+apr_status_t apr_os_lock_get(apr_os_lock_t *oslock, apr_lock_t *lock)
+{
+ *oslock = lock->hMutex;
+ return APR_SUCCESS;
+}
+
+
+
+apr_status_t apr_os_lock_put(apr_lock_t **lock, apr_os_lock_t *thelock,
+ apr_pool_t *cont)
+{
+ if (cont == NULL) {
+ return APR_ENOPOOL;
+ }
+ if ((*lock) == NULL) {
+ (*lock) = (apr_lock_t *)apr_pcalloc(cont, sizeof(apr_lock_t));
+ (*lock)->cntxt = cont;
+ }
+ (*lock)->hMutex = *thelock;
+ return APR_SUCCESS;
+}
+
+
+
+apr_status_t apr_lock_data_get(apr_lock_t *lock, const char *key, void *data)
+{
+ return apr_pool_userdata_get(data, key, lock->cntxt);
+}
+
+
+
+apr_status_t apr_lock_data_set(apr_lock_t *lock, void *data, const char *key,
+ apr_status_t (*cleanup) (void *))
+{
+ return apr_pool_userdata_set(data, key, cleanup, lock->cntxt);
+}
diff --git a/network_io/os2/Makefile.in b/network_io/os2/Makefile.in
index 543a36e15..5737cd7bf 100644
--- a/network_io/os2/Makefile.in
+++ b/network_io/os2/Makefile.in
@@ -2,6 +2,7 @@
TARGETS = \
poll.lo \
sendrecv.lo \
+ sendrecv_udp.lo \
sockets.lo \
sockopt.lo \
sockaddr.lo \
diff --git a/network_io/os2/poll.c b/network_io/os2/poll.c
index f89253597..55e2f0175 100644
--- a/network_io/os2/poll.c
+++ b/network_io/os2/poll.c
@@ -222,3 +222,29 @@ apr_status_t apr_poll_socket_remove(apr_pollfd_t *aprset, apr_socket_t *sock)
{
return apr_poll_socket_mask(aprset, sock, APR_POLLIN|APR_POLLOUT|APR_POLLPRI);
}
+
+
+
+apr_status_t apr_poll_socket_clear(apr_pollfd_t *aprset, apr_int16_t events)
+{
+ aprset->num_read = 0;
+ aprset->num_write = 0;
+ aprset->num_except = 0;
+ aprset->num_total = 0;
+ return APR_SUCCESS;
+}
+
+
+
+apr_status_t apr_poll_data_get(apr_pollfd_t *pollfd, const char *key, void *data)
+{
+ return apr_pool_userdata_get(data, key, pollfd->cntxt);
+}
+
+
+
+apr_status_t apr_poll_data_set(apr_pollfd_t *pollfd, void *data, const char *key,
+ apr_status_t (*cleanup) (void *))
+{
+ return apr_pool_userdata_set(data, key, cleanup, pollfd->cntxt);
+}
diff --git a/network_io/os2/sendrecv_udp.c b/network_io/os2/sendrecv_udp.c
new file mode 100644
index 000000000..a2b0b046b
--- /dev/null
+++ b/network_io/os2/sendrecv_udp.c
@@ -0,0 +1,73 @@
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000-2001 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 "networkio.h"
+#include "apr_errno.h"
+#include "apr_general.h"
+#include "apr_network_io.h"
+#include "apr_lib.h"
+#include <sys/time.h>
+
+apr_status_t apr_sendto(apr_socket_t *sock, apr_sockaddr_t *where,
+ apr_int32_t flags, const char *buf, apr_size_t *len)
+{
+ return APR_ENOTIMPL;
+}
+
+apr_status_t apr_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock,
+ apr_int32_t flags, char *buf,
+ apr_size_t *len)
+{
+ return APR_ENOTIMPL;
+}
diff --git a/threadproc/os2/proc.c b/threadproc/os2/proc.c
index f5edca8cd..9b4061648 100644
--- a/threadproc/os2/proc.c
+++ b/threadproc/os2/proc.c
@@ -554,3 +554,10 @@ apr_status_t apr_get_os_proc(apr_os_proc_t *theproc, apr_proc_t *proc)
*theproc = proc->pid;
return APR_SUCCESS;
}
+
+
+
+apr_status_t apr_proc_detach()
+{
+ return APR_ENOTIMPL;
+}
diff --git a/threadproc/os2/thread.c b/threadproc/os2/thread.c
index 4bc6d8c4f..aa85f43f1 100644
--- a/threadproc/os2/thread.c
+++ b/threadproc/os2/thread.c
@@ -58,6 +58,7 @@
#include "apr_thread_proc.h"
#include "apr_general.h"
#include "apr_lib.h"
+#include "apr_portable.h"
#include "fileio.h"
#include <stdlib.h>
@@ -182,3 +183,38 @@ apr_status_t apr_thread_detach(apr_thread_t *thd)
}
+
+apr_status_t apr_os_thread_get(apr_os_thread_t **thethd, apr_thread_t *thd)
+{
+ *thethd = &thd->tid;
+ return APR_SUCCESS;
+}
+
+
+
+apr_status_t apr_os_thread_put(apr_thread_t **thd, apr_os_thread_t *thethd,
+ apr_pool_t *cont)
+{
+ if ((*thd) == NULL) {
+ (*thd) = (apr_thread_t *)apr_pcalloc(cont, sizeof(apr_thread_t));
+ (*thd)->cntxt = cont;
+ }
+ (*thd)->tid = *thethd;
+ return APR_SUCCESS;
+}
+
+
+
+apr_status_t apr_thread_data_get(void **data, const char *key, apr_thread_t *thread)
+{
+ return apr_pool_userdata_get(data, key, thread->cntxt);
+}
+
+
+
+apr_status_t apr_thread_data_set(void *data, const char *key,
+ apr_status_t (*cleanup) (void *),
+ apr_thread_t *thread)
+{
+ return apr_pool_userdata_set(data, key, cleanup, thread->cntxt);
+}
diff --git a/threadproc/os2/threadpriv.c b/threadproc/os2/threadpriv.c
index da3989fdd..5a93765e4 100644
--- a/threadproc/os2/threadpriv.c
+++ b/threadproc/os2/threadpriv.c
@@ -54,6 +54,7 @@
#include "threadproc.h"
#include "apr_thread_proc.h"
+#include "apr_portable.h"
#include "apr_general.h"
#include "apr_errno.h"
#include "apr_lib.h"
@@ -89,3 +90,35 @@ apr_status_t apr_threadkey_private_delete(apr_threadkey_t *key)
return APR_OS2_STATUS(DosFreeThreadLocalMemory(key->key));
}
+apr_status_t apr_threadkey_data_get(void **data, const char *key,
+ apr_threadkey_t *threadkey)
+{
+ return apr_pool_userdata_get(data, key, threadkey->cntxt);
+}
+
+apr_status_t apr_threadkey_data_set(void *data, const char *key,
+ apr_status_t (*cleanup) (void *),
+ apr_threadkey_t *threadkey)
+{
+ return apr_pool_userdata_set(data, key, cleanup, threadkey->cntxt);
+}
+
+apr_status_t apr_os_threadkey_get(apr_os_threadkey_t *thekey, apr_threadkey_t *key)
+{
+ *thekey = key->key;
+ return APR_SUCCESS;
+}
+
+apr_status_t apr_os_threadkey_put(apr_threadkey_t **key,
+ apr_os_threadkey_t *thekey, apr_pool_t *cont)
+{
+ if (cont == NULL) {
+ return APR_ENOPOOL;
+ }
+ if ((*key) == NULL) {
+ (*key) = (apr_threadkey_t *)apr_pcalloc(cont, sizeof(apr_threadkey_t));
+ (*key)->cntxt = cont;
+ }
+ (*key)->key = *thekey;
+ return APR_SUCCESS;
+}