summaryrefslogtreecommitdiff
path: root/include/arch/os2
diff options
context:
space:
mode:
Diffstat (limited to 'include/arch/os2')
-rw-r--r--include/arch/os2/apr_arch_dso.h37
-rw-r--r--include/arch/os2/apr_arch_file_io.h86
-rw-r--r--include/arch/os2/apr_arch_inherit.h50
-rw-r--r--include/arch/os2/apr_arch_networkio.h76
-rw-r--r--include/arch/os2/apr_arch_os2calls.h59
-rw-r--r--include/arch/os2/apr_arch_proc_mutex.h31
-rw-r--r--include/arch/os2/apr_arch_thread_cond.h28
-rw-r--r--include/arch/os2/apr_arch_thread_mutex.h29
-rw-r--r--include/arch/os2/apr_arch_thread_rwlock.h31
-rw-r--r--include/arch/os2/apr_arch_threadproc.h67
10 files changed, 494 insertions, 0 deletions
diff --git a/include/arch/os2/apr_arch_dso.h b/include/arch/os2/apr_arch_dso.h
new file mode 100644
index 0000000..2bda6b7
--- /dev/null
+++ b/include/arch/os2/apr_arch_dso.h
@@ -0,0 +1,37 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#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
+
+struct apr_dso_handle_t {
+ apr_pool_t *cont; /* Context for returning error strings */
+ HMODULE handle; /* Handle to the DSO loaded */
+ apr_status_t load_error;
+ char *failed_module;
+};
+
+#endif
+
+#endif
diff --git a/include/arch/os2/apr_arch_file_io.h b/include/arch/os2/apr_arch_file_io.h
new file mode 100644
index 0000000..79a5796
--- /dev/null
+++ b/include/arch/os2/apr_arch_file_io.h
@@ -0,0 +1,86 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef FILE_IO_H
+#define FILE_IO_H
+
+#include "apr_private.h"
+#include "apr_general.h"
+#include "apr_thread_mutex.h"
+#include "apr_file_io.h"
+#include "apr_file_info.h"
+#include "apr_errno.h"
+#include "apr_poll.h"
+
+/* We have an implementation of mkstemp but it's not very multi-threading
+ * friendly & is part of the POSIX emulation rather than native so don't
+ * use it.
+ */
+#undef HAVE_MKSTEMP
+
+#define APR_FILE_DEFAULT_BUFSIZE 4096
+#define APR_FILE_BUFSIZE APR_FILE_DEFAULT_BUFSIZE
+
+struct apr_file_t {
+ apr_pool_t *pool;
+ HFILE filedes;
+ char * fname;
+ int isopen;
+ int buffered;
+ int eof_hit;
+ apr_int32_t flags;
+ int timeout;
+ int pipe;
+ HEV pipeSem;
+ enum { BLK_UNKNOWN, BLK_OFF, BLK_ON } blocking;
+
+ /* Stuff for buffered mode */
+ char *buffer;
+ apr_size_t bufsize; /* Read/Write position in buffer */
+ apr_size_t bufpos; /* Read/Write position in buffer */
+ unsigned long dataRead; /* amount of valid data read into buffer */
+ int direction; /* buffer being used for 0 = read, 1 = write */
+ unsigned long filePtr; /* position in file of handle */
+ apr_thread_mutex_t *mutex; /* mutex semaphore, must be owned to access
+ the above fields */
+};
+
+struct apr_dir_t {
+ apr_pool_t *pool;
+ char *dirname;
+ ULONG handle;
+ FILEFINDBUF3 entry;
+ int validentry;
+};
+
+apr_status_t apr_file_cleanup(void *);
+apr_status_t apr_os2_time_to_apr_time(apr_time_t *result, FDATE os2date,
+ FTIME os2time);
+apr_status_t apr_apr_time_to_os2_time(FDATE *os2date, FTIME *os2time,
+ apr_time_t aprtime);
+
+/* see win32/fileio.h for description of these */
+extern const char c_is_fnchar[256];
+
+#define IS_FNCHAR(c) c_is_fnchar[(unsigned char)c]
+
+apr_status_t filepath_root_test(char *path, apr_pool_t *p);
+apr_status_t filepath_drive_get(char **rootpath, char drive,
+ apr_int32_t flags, apr_pool_t *p);
+apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p);
+
+#endif /* ! FILE_IO_H */
+
diff --git a/include/arch/os2/apr_arch_inherit.h b/include/arch/os2/apr_arch_inherit.h
new file mode 100644
index 0000000..494772a
--- /dev/null
+++ b/include/arch/os2/apr_arch_inherit.h
@@ -0,0 +1,50 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef INHERIT_H
+#define INHERIT_H
+
+#include "apr_inherit.h"
+
+#define APR_INHERIT (1 << 24) /* Must not conflict with other bits */
+
+#define APR_IMPLEMENT_INHERIT_SET(name, flag, pool, cleanup) \
+APR_DECLARE(apr_status_t) apr_##name##_inherit_set(apr_##name##_t *the##name) \
+{ \
+ int rv; \
+ ULONG state; \
+ if (((rv = DosQueryFHState(attr->parent_err->filedes, &state)) \
+ != 0) || \
+ ((rv = DosSetFHState(attr->parent_err->filedes, \
+ state & ~OPEN_FLAGS_NOINHERIT)) != 0)) \
+ return APR_FROM_OS_ERROR(rv); \
+ return APR_SUCCESS; \
+}
+
+#define APR_IMPLEMENT_INHERIT_UNSET(name, flag, pool, cleanup) \
+APR_DECLARE(apr_status_t) apr_##name##_inherit_unset(apr_##name##_t *the##name)\
+{ \
+ int rv; \
+ ULONG state; \
+ if (((rv = DosQueryFHState(attr->parent_err->filedes, &state)) \
+ != 0) || \
+ ((rv = DosSetFHState(attr->parent_err->filedes, \
+ state | OPEN_FLAGS_NOINHERIT)) != 0)) \
+ return APR_FROM_OS_ERROR(rv); \
+ return APR_SUCCESS; \
+}
+
+#endif /* ! INHERIT_H */
diff --git a/include/arch/os2/apr_arch_networkio.h b/include/arch/os2/apr_arch_networkio.h
new file mode 100644
index 0000000..10c6de8
--- /dev/null
+++ b/include/arch/os2/apr_arch_networkio.h
@@ -0,0 +1,76 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef NETWORK_IO_H
+#define NETWORK_IO_H
+
+#include "apr_private.h"
+#include "apr_network_io.h"
+#include "apr_general.h"
+#include "apr_arch_os2calls.h"
+#include "apr_poll.h"
+
+#if APR_HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
+typedef struct sock_userdata_t sock_userdata_t;
+struct sock_userdata_t {
+ sock_userdata_t *next;
+ const char *key;
+ void *data;
+};
+
+struct apr_socket_t {
+ apr_pool_t *pool;
+ int socketdes;
+ int type;
+ int protocol;
+ apr_sockaddr_t *local_addr;
+ apr_sockaddr_t *remote_addr;
+ apr_interval_time_t timeout;
+ int nonblock;
+ int local_port_unknown;
+ int local_interface_unknown;
+ int remote_addr_unknown;
+ apr_int32_t options;
+ apr_int32_t inherit;
+ sock_userdata_t *userdata;
+
+ /* if there is a timeout set, then this pollset is used */
+ apr_pollset_t *pollset;
+};
+
+/* Error codes returned from sock_errno() */
+#define SOCBASEERR 10000
+#define SOCEPERM (SOCBASEERR+1) /* Not owner */
+#define SOCESRCH (SOCBASEERR+3) /* No such process */
+#define SOCEINTR (SOCBASEERR+4) /* Interrupted system call */
+#define SOCENXIO (SOCBASEERR+6) /* No such device or address */
+#define SOCEBADF (SOCBASEERR+9) /* Bad file number */
+#define SOCEACCES (SOCBASEERR+13) /* Permission denied */
+#define SOCEFAULT (SOCBASEERR+14) /* Bad address */
+#define SOCEINVAL (SOCBASEERR+22) /* Invalid argument */
+#define SOCEMFILE (SOCBASEERR+24) /* Too many open files */
+#define SOCEPIPE (SOCBASEERR+32) /* Broken pipe */
+#define SOCEOS2ERR (SOCBASEERR+100) /* OS/2 Error */
+
+const char *apr_inet_ntop(int af, const void *src, char *dst, apr_size_t size);
+int apr_inet_pton(int af, const char *src, void *dst);
+void apr_sockaddr_vars_set(apr_sockaddr_t *, int, apr_port_t);
+
+#endif /* ! NETWORK_IO_H */
+
diff --git a/include/arch/os2/apr_arch_os2calls.h b/include/arch/os2/apr_arch_os2calls.h
new file mode 100644
index 0000000..3c739bf
--- /dev/null
+++ b/include/arch/os2/apr_arch_os2calls.h
@@ -0,0 +1,59 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apr_errno.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+
+extern int (*apr_os2_socket)(int, int, int);
+extern int (*apr_os2_select)(int *, int, int, int, long);
+extern int (*apr_os2_sock_errno)();
+extern int (*apr_os2_accept)(int, struct sockaddr *, int *);
+extern int (*apr_os2_bind)(int, struct sockaddr *, int);
+extern int (*apr_os2_connect)(int, struct sockaddr *, int);
+extern int (*apr_os2_getpeername)(int, struct sockaddr *, int *);
+extern int (*apr_os2_getsockname)(int, struct sockaddr *, int *);
+extern int (*apr_os2_getsockopt)(int, int, int, char *, int *);
+extern int (*apr_os2_ioctl)(int, int, caddr_t, int);
+extern int (*apr_os2_listen)(int, int);
+extern int (*apr_os2_recv)(int, char *, int, int);
+extern int (*apr_os2_send)(int, const char *, int, int);
+extern int (*apr_os2_setsockopt)(int, int, int, char *, int);
+extern int (*apr_os2_shutdown)(int, int);
+extern int (*apr_os2_soclose)(int);
+extern int (*apr_os2_writev)(int, struct iovec *, int);
+extern int (*apr_os2_sendto)(int, const char *, int, int, const struct sockaddr *, int);
+extern int (*apr_os2_recvfrom)(int, char *, int, int, struct sockaddr *, int *);
+
+#define socket apr_os2_socket
+#define select apr_os2_select
+#define sock_errno apr_os2_sock_errno
+#define accept apr_os2_accept
+#define bind apr_os2_bind
+#define connect apr_os2_connect
+#define getpeername apr_os2_getpeername
+#define getsockname apr_os2_getsockname
+#define getsockopt apr_os2_getsockopt
+#define ioctl apr_os2_ioctl
+#define listen apr_os2_listen
+#define recv apr_os2_recv
+#define send apr_os2_send
+#define setsockopt apr_os2_setsockopt
+#define shutdown apr_os2_shutdown
+#define soclose apr_os2_soclose
+#define writev apr_os2_writev
+#define sendto apr_os2_sendto
+#define recvfrom apr_os2_recvfrom
diff --git a/include/arch/os2/apr_arch_proc_mutex.h b/include/arch/os2/apr_arch_proc_mutex.h
new file mode 100644
index 0000000..8caf336
--- /dev/null
+++ b/include/arch/os2/apr_arch_proc_mutex.h
@@ -0,0 +1,31 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef PROC_MUTEX_H
+#define PROC_MUTEX_H
+
+#include "apr_proc_mutex.h"
+#include "apr_file_io.h"
+
+struct apr_proc_mutex_t {
+ apr_pool_t *pool;
+ HMTX hMutex;
+ TID owner;
+ int lock_count;
+};
+
+#endif /* PROC_MUTEX_H */
+
diff --git a/include/arch/os2/apr_arch_thread_cond.h b/include/arch/os2/apr_arch_thread_cond.h
new file mode 100644
index 0000000..648b85d
--- /dev/null
+++ b/include/arch/os2/apr_arch_thread_cond.h
@@ -0,0 +1,28 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef THREAD_COND_H
+#define THREAD_COND_H
+
+#include "apr_thread_cond.h"
+#include "apr_file_io.h"
+
+struct apr_thread_cond_t {
+ apr_pool_t *pool;
+};
+
+#endif /* THREAD_COND_H */
+
diff --git a/include/arch/os2/apr_arch_thread_mutex.h b/include/arch/os2/apr_arch_thread_mutex.h
new file mode 100644
index 0000000..3ae2a41
--- /dev/null
+++ b/include/arch/os2/apr_arch_thread_mutex.h
@@ -0,0 +1,29 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef THREAD_MUTEX_H
+#define THREAD_MUTEX_H
+
+#include "apr_thread_mutex.h"
+#include "apr_file_io.h"
+
+struct apr_thread_mutex_t {
+ apr_pool_t *pool;
+ HMTX hMutex;
+};
+
+#endif /* THREAD_MUTEX_H */
+
diff --git a/include/arch/os2/apr_arch_thread_rwlock.h b/include/arch/os2/apr_arch_thread_rwlock.h
new file mode 100644
index 0000000..7187d5c
--- /dev/null
+++ b/include/arch/os2/apr_arch_thread_rwlock.h
@@ -0,0 +1,31 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef THREAD_RWLOCK_H
+#define THREAD_RWLOCK_H
+
+#include "apr_thread_rwlock.h"
+#include "apr_file_io.h"
+
+struct apr_thread_rwlock_t {
+ apr_pool_t *pool;
+ int readers;
+ HMTX write_lock;
+ HEV read_done;
+};
+
+#endif /* THREAD_RWLOCK_H */
+
diff --git a/include/arch/os2/apr_arch_threadproc.h b/include/arch/os2/apr_arch_threadproc.h
new file mode 100644
index 0000000..c8017ad
--- /dev/null
+++ b/include/arch/os2/apr_arch_threadproc.h
@@ -0,0 +1,67 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apr_thread_proc.h"
+#include "apr_file_io.h"
+
+#ifndef THREAD_PROC_H
+#define THREAD_PROC_H
+
+#define APR_THREADATTR_DETACHED 1
+
+#define SHELL_PATH "cmd.exe"
+#define APR_THREAD_STACKSIZE 65536
+
+struct apr_threadattr_t {
+ apr_pool_t *pool;
+ unsigned long attr;
+ apr_size_t stacksize;
+};
+
+struct apr_thread_t {
+ apr_pool_t *pool;
+ struct apr_threadattr_t *attr;
+ unsigned long tid;
+ apr_thread_start_t func;
+ void *data;
+ apr_status_t exitval;
+};
+
+struct apr_threadkey_t {
+ apr_pool_t *pool;
+ unsigned long *key;
+};
+
+struct apr_procattr_t {
+ apr_pool_t *pool;
+ apr_file_t *parent_in;
+ apr_file_t *child_in;
+ apr_file_t *parent_out;
+ apr_file_t *child_out;
+ apr_file_t *parent_err;
+ apr_file_t *child_err;
+ char *currdir;
+ apr_int32_t cmdtype;
+ apr_int32_t detached;
+};
+
+struct apr_thread_once_t {
+ unsigned long sem;
+ char hit;
+};
+
+#endif /* ! THREAD_PROC_H */
+