diff options
26 files changed, 0 insertions, 4352 deletions
diff --git a/apr.dsp b/apr.dsp deleted file mode 100644 index 6b23169f5..000000000 --- a/apr.dsp +++ /dev/null @@ -1,333 +0,0 @@ -# Microsoft Developer Studio Project File - Name="aprlib" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=aprlib - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "aprlib.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "aprlib.mak" CFG="aprlib - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "aprlib - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "aprlib - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "aprlib - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "./include" /I "./inc" /I "./misc/win32" /I "./file_io/win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /machine:I386 - -!ELSEIF "$(CFG)" == "aprlib - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "./include" /I "./inc" /I "./misc/win32" /I "./file_io/win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# SUBTRACT CPP /YX -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ws2_32.lib mswsock.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "aprlib - Win32 Release" -# Name "aprlib - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter ".c" -# Begin Source File - -SOURCE=.\time\win32\access.c -# End Source File -# Begin Source File - -SOURCE=.\lib\apr_cpystrn.c -# End Source File -# Begin Source File - -SOURCE=.\lib\apr_execve.c -# End Source File -# Begin Source File - -SOURCE=.\lib\apr_fnmatch.c -# End Source File -# Begin Source File - -SOURCE=.\lib\apr_getpass.c -# End Source File -# Begin Source File - -SOURCE=.\lib\apr_md5.c -# End Source File -# Begin Source File - -SOURCE=.\lib\apr_pools.c -# End Source File -# Begin Source File - -SOURCE=.\lib\apr_slack.c -# ADD CPP /I "./misc/win32/" /I "./file_io/win32/" -# End Source File -# Begin Source File - -SOURCE=.\lib\apr_snprintf.c -# End Source File -# Begin Source File - -SOURCE=.\lib\apr_tables.c -# End Source File -# Begin Source File - -SOURCE=.\aprlib.def -# End Source File -# Begin Source File - -SOURCE=.\file_io\win32\dir.c -# End Source File -# Begin Source File - -SOURCE=.\file_io\win32\fileacc.c -# End Source File -# Begin Source File - -SOURCE=.\file_io\win32\filedup.c -# End Source File -# Begin Source File - -SOURCE=.\file_io\win32\fileio.h -# End Source File -# Begin Source File - -SOURCE=.\file_io\win32\filestat.c -# End Source File -# Begin Source File - -SOURCE=.\misc\win32\getopt.c -# End Source File -# Begin Source File - -SOURCE=.\locks\win32\locks.c -# End Source File -# Begin Source File - -SOURCE=.\misc\win32\names.c -# End Source File -# Begin Source File - -SOURCE=.\file_io\win32\open.c -# End Source File -# Begin Source File - -SOURCE=.\file_io\win32\pipe.c -# End Source File -# Begin Source File - -SOURCE=.\network_io\win32\poll.c -# End Source File -# Begin Source File - -SOURCE=.\threadproc\win32\proc.c -# End Source File -# Begin Source File - -SOURCE=.\file_io\win32\readdir.c -# End Source File -# Begin Source File - -SOURCE=.\file_io\win32\readdir.h -# End Source File -# Begin Source File - -SOURCE=.\file_io\win32\readwrite.c -# End Source File -# Begin Source File - -SOURCE=.\file_io\win32\seek.c -# End Source File -# Begin Source File - -SOURCE=.\network_io\win32\sendrecv.c -# End Source File -# Begin Source File - -SOURCE=.\threadproc\win32\signals.c -# End Source File -# Begin Source File - -SOURCE=.\network_io\win32\sockaddr.c -# End Source File -# Begin Source File - -SOURCE=.\network_io\win32\sockets.c -# End Source File -# Begin Source File - -SOURCE=.\network_io\win32\sockopt.c -# End Source File -# Begin Source File - -SOURCE=.\misc\win32\start.c -# End Source File -# Begin Source File - -SOURCE=.\threadproc\win32\thread.c -# End Source File -# Begin Source File - -SOURCE=.\threadproc\win32\threadcancel.c -# End Source File -# Begin Source File - -SOURCE=.\threadproc\win32\threadpriv.c -# End Source File -# Begin Source File - -SOURCE=.\time\win32\time.c -# End Source File -# Begin Source File - -SOURCE=.\time\win32\timestr.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter ".h" -# Begin Source File - -SOURCE=.\include\apr_errno.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_file_io.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_fnmatch.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_general.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_lib.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_lock.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_md5.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_network_io.h -# End Source File -# Begin Source File - -SOURCE=.\inc\apr_pools.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_portable.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_shmem.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_signal.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_thread_proc.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_time.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_win.h -# End Source File -# Begin Source File - -SOURCE=.\time\win32\atime.h -# End Source File -# Begin Source File - -SOURCE=.\locks\win32\locks.h -# End Source File -# Begin Source File - -SOURCE=.\misc\win32\misc.h -# End Source File -# Begin Source File - -SOURCE=.\network_io\win32\networkio.h -# End Source File -# Begin Source File - -SOURCE=.\threadproc\win32\threadproc.h -# End Source File -# End Group -# End Target -# End Project diff --git a/include/arch/beos/dso.h b/include/arch/beos/dso.h deleted file mode 100644 index 4305bba6c..000000000 --- a/include/arch/beos/dso.h +++ /dev/null @@ -1,70 +0,0 @@ -/* ==================================================================== - * 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_config.h" -#include "apr_general.h" -#include "apr_pools.h" -#include "apr_errno.h" -#include "apr_dso.h" -#include <kernel/image.h> - -struct dso_handle_t { - image_id handle; /* Handle to the DSO loaded */ - ap_context_t *cont; -}; - -#endif diff --git a/include/arch/beos/locks.h b/include/arch/beos/locks.h deleted file mode 100644 index 7f5dabd3b..000000000 --- a/include/arch/beos/locks.h +++ /dev/null @@ -1,82 +0,0 @@ -/* ==================================================================== - * 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 LOCKS_H -#define LOCKS_H - -#include <kernel/OS.h> -#include "apr_lock.h" -#include "apr_file_io.h" -#include "apr_general.h" -#include "apr_lib.h" - -struct lock_t { - ap_context_t *cntxt; - ap_locktype_e type; - ap_lockscope_e scope; - int curr_locked; - char *fname; - /* Inter proc */ - sem_id sem_interproc; - int32 ben_interproc; - /* Intra Proc */ - sem_id sem_intraproc; - int32 ben_intraproc; - /* At some point, we should do a scope for both inter and intra process - * locking here. Something like pthread_mutex with PTHREAD_PROCESS_SHARED - */ -}; - -#endif /* LOCKS_H */ - diff --git a/include/arch/beos/networkio.h b/include/arch/beos/networkio.h deleted file mode 100644 index 91253c0c1..000000000 --- a/include/arch/beos/networkio.h +++ /dev/null @@ -1,112 +0,0 @@ -/* ==================================================================== - * 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 NETWORK_IO_H -#define NETWORK_IO_H - -#include <socket.h> -#include <netdb.h> -#include <errno.h> -#include <string.h> -#include <stdlib.h> -#include <sys/time.h> -#include "apr_network_io.h" -#include "apr_general.h" -#include "apr_portable.h" -#include "apr_lib.h" -#include "fileio.h" -#include "apr_errno.h" - -/* The definition of isascii was missed from the PowerPC ctype.h - * - * It will be included in the next release, but until then... */ -#if __POWERPC__ -#define isascii(c) (((c) & ~0x7f)==0) -#endif - -#include "apr_general.h" -#include <ByteOrder.h> /* for the ntohs definition */ - -#define POLLIN 1 -#define POLLPRI 2 -#define POLLOUT 4 -#define POLLERR 8 -#define POLLHUP 16 -#define POLLNVAL 32 - -struct socket_t { - ap_context_t *cntxt; - int socketdes; - struct sockaddr_in *local_addr; - struct sockaddr_in *remote_addr; - int addr_len; - int timeout; - int connected; -}; - -struct pollfd_t { - ap_context_t *cntxt; - struct socket_t *sock; - fd_set *read; - fd_set *write; - fd_set *except; - int highsock; -}; - -ap_int16_t get_event(ap_int16_t); - -int inet_aton(const char *cp, struct in_addr *addr); - -#endif /* ! NETWORK_IO_H */ - diff --git a/include/arch/beos/threadproc.h b/include/arch/beos/threadproc.h deleted file mode 100644 index 73ea8ef54..000000000 --- a/include/arch/beos/threadproc.h +++ /dev/null @@ -1,135 +0,0 @@ -/* ==================================================================== - * 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_thread_proc.h" -#include "fileio.h" -#include "apr_file_io.h" -#include "apr_thread_proc.h" -#include "apr_file_io.h" -#include "apr_general.h" -#include "apr_portable.h" -#include <kernel/OS.h> -#include <signal.h> -#include <string.h> -#include <sys/wait.h> - -#ifndef THREAD_PROC_H -#define THREAD_PROC_H - -#define SHELL_PATH "/bin/sh" - -#define PTHREAD_CANCEL_AYNCHRONOUS CANCEL_ASYNCH; -#define PTHREAD_CANCEL_DEFERRED CANCEL_DEFER; - -#define PTHREAD_CANCEL_ENABLE CANCEL_ENABLE; -#define PTHREAD_CANCEL_DISABLE CANCEL_DISABLE; - -#define BEOS_MAX_DATAKEYS 128 - -struct thread_t { - ap_context_t *cntxt; - thread_id td; -}; - -struct threadattr_t { - ap_context_t *cntxt; - int32 attr; - int detached; - int joinable; -}; - -struct threadkey_t { - ap_context_t *cntxt; - int32 key; -}; - -struct beos_private_data { - const void ** data; - int count; - volatile thread_id td; -}; - -struct beos_key { - int assigned; - int count; - sem_id lock; - int32 ben_lock; - void (* destructor) (); -}; - -struct procattr_t { - ap_context_t *cntxt; - ap_file_t *parent_in; - ap_file_t *child_in; - ap_file_t *parent_out; - ap_file_t *child_out; - ap_file_t *parent_err; - ap_file_t *child_err; - char *currdir; - ap_int32_t cmdtype; - ap_int32_t detached; -}; - -struct proc_t { - ap_context_t *cntxt; - pid_t pid; - thread_id tid; - struct procattr_t *attr; -}; - -/* we need a structure to pass off to the thread that will run any - * new process we create */ - -#endif /* ! THREAD_PROC_H */ - diff --git a/include/arch/os2/dso.h b/include/arch/os2/dso.h deleted file mode 100644 index 0ef121ea1..000000000 --- a/include/arch/os2/dso.h +++ /dev/null @@ -1,71 +0,0 @@ -/* ==================================================================== - * 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 - -#define INCL_DOS -#include <os2.h> - -#include "apr_config.h" -#include "apr_general.h" -#include "apr_pools.h" -#include "apr_dso.h" - -struct dso_handle_t { - HMODULE handle; /* Handle to the DSO loaded */ - ap_context_t *cont; /* Context for returning error strings */ -}; - -#endif diff --git a/include/arch/os2/fileio.h b/include/arch/os2/fileio.h deleted file mode 100644 index 9965cdc39..000000000 --- a/include/arch/os2/fileio.h +++ /dev/null @@ -1,98 +0,0 @@ -/* ==================================================================== - * 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 FILE_IO_H -#define FILE_IO_H - -#define INCL_DOS -#include <os2.h> - -#include "apr_config.h" -#include "apr_general.h" -#include "apr_file_io.h" -#include "apr_errno.h" - -#define APR_FILE_BUFSIZE 4096 - -struct file_t { - ap_context_t *cntxt; - HFILE filedes; - char * fname; - int isopen; - int buffered; - int eof_hit; - ap_int32_t flags; - - /* Stuff for buffered mode */ - char *buffer; - int 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 -}; - -struct dir_t { - ap_context_t *cntxt; - char *dirname; - ULONG handle; - FILEFINDBUF3 entry; - int validentry; -}; - -ap_status_t apr_file_cleanup(void *); -ap_status_t ap_os2_time_to_ap_time(ap_time_t *result, FDATE os2date, FTIME os2time); -int os2errno( ULONG oserror ); - -#endif /* ! FILE_IO_H */ - diff --git a/include/arch/os2/locks.h b/include/arch/os2/locks.h deleted file mode 100644 index 5678f79a1..000000000 --- a/include/arch/os2/locks.h +++ /dev/null @@ -1,77 +0,0 @@ -/* ==================================================================== - * 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 LOCKS_H -#define LOCKS_H - -#include "apr_lock.h" -#include "apr_file_io.h" -#define INCL_DOS -#include <os2.h> - -struct lock_t { - ap_context_t *cntxt; - ap_locktype_e type; - ap_lockscope_e scope; - char *fname; - HMTX hMutex; - TID owner; - int lock_count; - TIB *tib; -}; - -void setup_lock(); - -#endif /* LOCKS_H */ - diff --git a/include/arch/os2/networkio.h b/include/arch/os2/networkio.h deleted file mode 100644 index d64f038b3..000000000 --- a/include/arch/os2/networkio.h +++ /dev/null @@ -1,99 +0,0 @@ -/* ==================================================================== - * 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 NETWORK_IO_H -#define NETWORK_IO_H - -#include "apr_network_io.h" -#include "apr_general.h" -#include "os2calls.h" - -int os2errno( unsigned long oserror ); - -struct socket_t { - ap_context_t *cntxt; - int socketdes; - struct sockaddr_in *local_addr; - struct sockaddr_in *remote_addr; - int addr_len; - int timeout; - int nonblock; -}; - -struct pollfd_t { - ap_context_t *cntxt; - int *socket_list; - int *r_socket_list; - int num_read; - int num_write; - int num_except; - int num_total; -}; - -/* 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 */ - -#endif /* ! NETWORK_IO_H */ - diff --git a/include/arch/os2/os2calls.h b/include/arch/os2/os2calls.h deleted file mode 100644 index 40d54ee6e..000000000 --- a/include/arch/os2/os2calls.h +++ /dev/null @@ -1,140 +0,0 @@ -/* ==================================================================== - * 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 <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); - -#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 - - -/* Error codes returned by above calls */ -#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 */ -#define SOCEWOULDBLOCK (SOCBASEERR+35) /* Operation would block */ -#define SOCEINPROGRESS (SOCBASEERR+36) /* Operation now in progress */ -#define SOCEALREADY (SOCBASEERR+37) /* Operation already in progress */ -#define SOCENOTSOCK (SOCBASEERR+38) /* Socket operation on non-socket */ -#define SOCEDESTADDRREQ (SOCBASEERR+39) /* Destination address required */ -#define SOCEMSGSIZE (SOCBASEERR+40) /* Message too long */ -#define SOCEPROTOTYPE (SOCBASEERR+41) /* Protocol wrong type for socket */ -#define SOCENOPROTOOPT (SOCBASEERR+42) /* Protocol not available */ -#define SOCEPROTONOSUPPORT (SOCBASEERR+43) /* Protocol not supported */ -#define SOCESOCKTNOSUPPORT (SOCBASEERR+44) /* Socket type not supported */ -#define SOCEOPNOTSUPP (SOCBASEERR+45) /* Operation not supported on socket */ -#define SOCEPFNOSUPPORT (SOCBASEERR+46) /* Protocol family not supported */ -#define SOCEAFNOSUPPORT (SOCBASEERR+47) /* Address family not supported by protocol family */ -#define SOCEADDRINUSE (SOCBASEERR+48) /* Address already in use */ -#define SOCEADDRNOTAVAIL (SOCBASEERR+49) /* Can't assign requested address */ -#define SOCENETDOWN (SOCBASEERR+50) /* Network is down */ -#define SOCENETUNREACH (SOCBASEERR+51) /* Network is unreachable */ -#define SOCENETRESET (SOCBASEERR+52) /* Network dropped connection on reset */ -#define SOCECONNABORTED (SOCBASEERR+53) /* Software caused connection abort */ -#define SOCECONNRESET (SOCBASEERR+54) /* Connection reset by peer */ -#define SOCENOBUFS (SOCBASEERR+55) /* No buffer space available */ -#define SOCEISCONN (SOCBASEERR+56) /* Socket is already connected */ -#define SOCENOTCONN (SOCBASEERR+57) /* Socket is not connected */ -#define SOCESHUTDOWN (SOCBASEERR+58) /* Can't send after socket shutdown */ -#define SOCETOOMANYREFS (SOCBASEERR+59) /* Too many references: can't splice */ -#define SOCETIMEDOUT (SOCBASEERR+60) /* Connection timed out */ -#define SOCECONNREFUSED (SOCBASEERR+61) /* Connection refused */ -#define SOCELOOP (SOCBASEERR+62) /* Too many levels of symbolic links */ -#define SOCENAMETOOLONG (SOCBASEERR+63) /* File name too long */ -#define SOCEHOSTDOWN (SOCBASEERR+64) /* Host is down */ -#define SOCEHOSTUNREACH (SOCBASEERR+65) /* No route to host */ -#define SOCENOTEMPTY (SOCBASEERR+66) /* Directory not empty */ diff --git a/include/arch/os2/threadproc.h b/include/arch/os2/threadproc.h deleted file mode 100644 index 37915daa8..000000000 --- a/include/arch/os2/threadproc.h +++ /dev/null @@ -1,108 +0,0 @@ -/* ==================================================================== - * 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_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 threadattr_t { - ap_context_t *cntxt; - unsigned long attr; -}; - -struct thread_t { - ap_context_t *cntxt; - struct threadattr_t *attr; - unsigned long tid; - ap_thread_start_t func; - void *data; - void *rv; -}; - -struct threadkey_t { - ap_context_t *cntxt; - unsigned long *key; -}; - -struct procattr_t { - ap_context_t *cntxt; - ap_file_t *parent_in; - ap_file_t *child_in; - ap_file_t *parent_out; - ap_file_t *child_out; - ap_file_t *parent_err; - ap_file_t *child_err; - char *currdir; - ap_int32_t cmdtype; - ap_int32_t detached; -}; - -struct proc_t { - ap_context_t *cntxt; - pid_t pid; - struct procattr_t *attr; - int running; -}; - -typedef void (*os2_thread_start_t)(void *); - -#endif /* ! THREAD_PROC_H */ - diff --git a/include/arch/unix/dso.h b/include/arch/unix/dso.h deleted file mode 100644 index 1a27dffb1..000000000 --- a/include/arch/unix/dso.h +++ /dev/null @@ -1,69 +0,0 @@ -/* ==================================================================== - * 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_config.h" -#include "apr_general.h" -#include "apr_pools.h" -#include "apr_dso.h" -#include "ltdl.h" - -struct dso_handle_t { - ap_context_t *cont; - lt_dlhandle handle; /* libtool handle */ -}; - -#endif diff --git a/include/arch/unix/fileio.h b/include/arch/unix/fileio.h deleted file mode 100644 index 75d8d5dd7..000000000 --- a/include/arch/unix/fileio.h +++ /dev/null @@ -1,126 +0,0 @@ -/* ==================================================================== - * 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 FILE_IO_H -#define FILE_IO_H - -#include "apr_config.h" -#include "apr_general.h" -#include "apr_file_io.h" -#include "apr_errno.h" -#include "apr_lib.h" - -/* System headers the file I/O library needs */ -#if HAVE_FCNTL_H -#include <fcntl.h> -#endif -#if HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif -#if HAVE_ERRNO_H -#include <errno.h> -#endif -#if HAVE_STRING_H -#include <string.h> -#endif -#if HAVE_DIRENT_H -#include <dirent.h> -#endif -#if HAVE_SYS_STAT_H -#include <sys/stat.h> -#endif -#if HAVE_UNISTD_H -#include <unistd.h> -#endif -#if HAVE_STDIO_H -#include <stdio.h> -#endif -#if HAVE_STDLIB_H -#include <stdlib.h> -#endif -#if HAVE_SYS_UIO_H -#include <sys/uio.h> -#endif -#if HAVE_SYS_TIME_H -#include <sys/time.h> -#endif -#ifdef BEOS -#include <kernel/OS.h> -#endif -/* End System headers */ - -struct file_t { - ap_context_t *cntxt; - int filedes; - FILE *filehand; - char * fname; - int oflags; - int buffered; - int eof_hit; - int pipe; - int timeout; -}; - -struct dir_t { - ap_context_t *cntxt; - char *dirname; - DIR *dirstruct; - struct dirent *entry; -}; - -ap_status_t file_cleanup(void *); -mode_t get_fileperms(ap_fileperms_t); - -#endif /* ! FILE_IO_H */ - diff --git a/include/arch/unix/locks.h b/include/arch/unix/locks.h deleted file mode 100644 index ce910d3d2..000000000 --- a/include/arch/unix/locks.h +++ /dev/null @@ -1,157 +0,0 @@ -/* ==================================================================== - * 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 LOCKS_H -#define LOCKS_H - -#include "apr_config.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_lock.h" - -/* System headers required by Locks library */ -#if HAVE_UNISTD_H -#include <unistd.h> -#endif -#if HAVE_STRING_H -#include <string.h> -#endif -#if HAVE_USLOCKS_H -#include <uslocks.h> -#endif -#if HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif -#if HAVE_SYS_IPC_H -#include <sys/ipc.h> -#endif -#if HAVE_SYS_SEM_H -#include <sys/sem.h> -#endif -#if HAVE_SYS_FILE_H -#include <sys/file.h> -#endif -#if HAVE_STDIO_H -#include <stdio.h> -#endif -#if HAVE_FCNTL_H -#include <fcntl.h> -#endif -#if HAVE_SYS_MMAN_H -#include <sys/mman.h> -#endif - -#if APR_HAS_THREADS -#if HAVE_PTHREAD_H -#include <pthread.h> -#endif -#endif -/* End System Headers */ - -#if !APR_HAVE_UNION_SEMUN && APR_USE_SYSVSEM_SERIALIZE -/* it makes no sense, but this isn't defined on solaris */ -union semun { - long val; - struct semid_ds *buf; - ushort *array; -}; -#endif - -struct lock_t { - ap_context_t *cntxt; - ap_locktype_e type; - ap_lockscope_e scope; - int curr_locked; - char *fname; -#if USE_SYSVSEM_SERIALIZE - int interproc; -#elif USE_FCNTL_SERIALIZE - int interproc; -#elif USE_PROC_PTHREAD_SERIALIZE - pthread_mutex_t *interproc; -#elif USE_FLOCK_SERIALIZE - int interproc; -#else - /* No Interprocess serialization. Too bad. */ -#endif -#if APR_HAS_THREADS - /* APR doesn't have threads, no sense in having an thread lock mechanism. - */ -#if USE_PTHREAD_SERIALIZE - pthread_mutex_t *intraproc; -#endif -#endif - /* At some point, we should do a scope for both inter and intra process - * locking here. Something like pthread_mutex with PTHREAD_PROCESS_SHARED - */ -}; - -#if APR_HAS_THREADS -ap_status_t create_intra_lock(struct lock_t *new); -ap_status_t lock_intra(struct lock_t *lock); -ap_status_t unlock_intra(struct lock_t *lock); -ap_status_t destroy_intra_lock(struct lock_t *lock); -#endif - -void setup_lock(); -ap_status_t create_inter_lock(struct lock_t *new); -ap_status_t lock_inter(struct lock_t *lock); -ap_status_t unlock_inter(struct lock_t *lock); -ap_status_t destroy_inter_lock(struct lock_t *lock); - -ap_status_t child_init_lock(struct lock_t **lock, ap_context_t *cont, - char *fname); - -#endif /* LOCKS_H */ - diff --git a/include/arch/unix/misc.h b/include/arch/unix/misc.h deleted file mode 100644 index aa6d1260f..000000000 --- a/include/arch/unix/misc.h +++ /dev/null @@ -1,92 +0,0 @@ -/* ==================================================================== - * 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 MISC_H -#define MISC_H - -#include "apr_config.h" -#include "apr_general.h" -#include "apr_pools.h" -#include "apr_getopt.h" -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif -#ifdef HAVE_STDIO_H -#include <stdio.h> -#endif -#ifdef HAVE_STRING_H -#include <string.h> -#endif -#ifdef HAVE_SIGNAL_H -#include <signal.h> -#endif -#ifdef HAVE_PTHREAD_H -#include <pthread.h> -#endif - -typedef struct datastruct { - void *data; - char *key; - struct datastruct *next; - struct datastruct *prev; -} datastruct; - -struct context_t { - struct ap_pool_t *pool; - datastruct *prog_data; - int (*apr_abort)(int retcode); -}; - -#endif /* ! MISC_H */ - diff --git a/include/arch/unix/mmap.c b/include/arch/unix/mmap.c deleted file mode 100644 index dd24215db..000000000 --- a/include/arch/unix/mmap.c +++ /dev/null @@ -1,134 +0,0 @@ -/* ==================================================================== - * 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/>. - */ - -#ifdef BEOS -#include "../beos/mmap_h.h" -#else -#include "mmap_h.h" -#endif - -#include "apr_portable.h" - -#if HAVE_MMAP - -ap_status_t mmap_cleanup(void *themmap) -{ - struct mmap_t *mm = themmap; - int rv; - rv = munmap(mm->mm, mm->size); - - if (rv == 0) { - mm->mm = (caddr_t)-1; - return APR_SUCCESS; - } - else - return errno; -} - -/* ***APRDOC******************************************************** - * ap_status_t ap_mmap_create(ap_mmap_t **new, ap_file_t *file, ap_off_t offset) - * Create a new mmap'ed file out of an existing APR file. - * arg 1) The newly created mmap'ed file. - * arg 2) The file turn into an mmap. - * arg 3) The offset into the file to start the data pointer at. - * arg 4) The size of the file - * arg 5) The context to use when creating the mmap. - */ -ap_status_t ap_mmap_create(ap_mmap_t **new, ap_file_t *file, ap_off_t offset, - ap_size_t size, ap_context_t *cont) -{ - caddr_t mm; - - if (file == NULL || file->buffered || file->filedes == -1) - return APR_EBADF; - - (*new) = (struct mmap_t *)ap_palloc(cont, sizeof(struct mmap_t)); - - ap_seek(file, APR_SET, &offset); - mm = mmap(NULL, size, PROT_READ, MAP_SHARED, file->filedes ,0); - - if (mm == (caddr_t)-1) { - /* we failed to get an mmap'd file... */ - return APR_ENOMEM; - } - (*new)->mm = mm; - (*new)->size = size; - (*new)->cntxt = cont; - - /* register the cleanup... */ - ap_register_cleanup((*new)->cntxt, (void*)(*new), mmap_cleanup, - ap_null_cleanup); - return APR_SUCCESS; -} - -/* ***APRDOC******************************************************** - * ap_status_t ap_mmap_delete(ap_mmap_t *mmap) - * Remove a mmap'ed. - * arg 1) The mmap'ed file. - */ -ap_status_t ap_mmap_delete(struct mmap_t *mmap) -{ - ap_status_t rv; - - if (mmap->mm == (caddr_t) -1) - return APR_ENOENT; - - if ((rv = mmap_cleanup(mmap)) == APR_SUCCESS) { - ap_kill_cleanup(mmap->cntxt, mmap, mmap_cleanup); - return APR_SUCCESS; - } - return rv; -} - -#endif diff --git a/include/arch/unix/networkio.h b/include/arch/unix/networkio.h deleted file mode 100644 index aff8cb1fe..000000000 --- a/include/arch/unix/networkio.h +++ /dev/null @@ -1,140 +0,0 @@ -/* ==================================================================== - * 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 NETWORK_IO_H -#define NETWORK_IO_H - -#include "apr_config.h" -#include "apr_network_io.h" -#include "apr_general.h" -#include "apr_lib.h" - -/* System headers the network I/O library needs */ -#if HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif -#if HAVE_SYS_UIO_H -#include <sys/uio.h> -#endif -#if HAVE_POLL_H -#include <poll.h> -#endif -#if HAVE_ERRNO_H -#include <errno.h> -#endif -#if HAVE_SYS_TIME_H -#include <sys/time.h> -#endif -#if HAVE_UNISTD_H -#include <unistd.h> -#endif -#if HAVE_STRING_H -#include <string.h> -#endif -#if HAVE_NETINET_TCP_H -#include <netinet/tcp.h> -#endif -#if HAVE_NETINET_IN_H -#include <netinet/in.h> -#endif -#if HAVE_ARPA_INET_H -#include <arpa/inet.h> -#endif -#if HAVE_SYS_SOCKET_H -#include <sys/socket.h> -#endif -#if HAVE_NETDB_H -#include <netdb.h> -#endif -#if HAVE_FCNTL_H -#include <fcntl.h> -#endif -#if HAVE_SYS_SENDFILE_H -#include <sys/sendfile.h> -#endif -/* End System Headers */ - -struct socket_t { - ap_context_t *cntxt; - int socketdes; - struct sockaddr_in *local_addr; - struct sockaddr_in *remote_addr; - socklen_t addr_len; - int timeout; -#ifndef HAVE_POLL - int connected; -#endif -}; - -struct pollfd_t { - ap_context_t *cntxt; -#ifdef HAVE_POLL - int *sock; - int curpos; -#else - fd_set *read; - fd_set *write; - fd_set *except; - int highsock; -#endif - ap_int16_t *events; - ap_int16_t *revents; - -}; - -ap_int16_t get_event(ap_int16_t); -ap_int16_t get_revent(ap_int16_t); - -#endif /* ! NETWORK_IO_H */ - diff --git a/include/arch/unix/threadproc.h b/include/arch/unix/threadproc.h deleted file mode 100644 index 98b32fa8d..000000000 --- a/include/arch/unix/threadproc.h +++ /dev/null @@ -1,126 +0,0 @@ -/* ==================================================================== - * 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_config.h" -#include "apr_thread_proc.h" -#include "apr_file_io.h" -#include "fileio.h" - -/* System headers required for thread/process library */ -#if HAVE_PTHREAD_H -#include <pthread.h> -#endif -#if HAVE_SIGNAL_H -#include <signal.h> -#endif -#if HAVE_STRING_H -#include <string.h> -#endif -#if HAVE_SYS_WAIT_H -#include <sys/wait.h> -#endif -#if HAVE_STRING_H -#include <string.h> -#endif -/* End System Headers */ - - -#ifndef THREAD_PROC_H -#define THREAD_PROC_H - -#define SHELL_PATH "/bin/sh" - -#if APR_HAS_THREADS -struct thread_t { - ap_context_t *cntxt; - pthread_t *td; -}; - -struct threadattr_t { - ap_context_t *cntxt; - pthread_attr_t *attr; -}; - -struct threadkey_t { - ap_context_t *cntxt; - pthread_key_t key; -}; -#endif - -struct procattr_t { - ap_context_t *cntxt; - ap_file_t *parent_in; - ap_file_t *child_in; - ap_file_t *parent_out; - ap_file_t *child_out; - ap_file_t *parent_err; - ap_file_t *child_err; - char *currdir; - ap_int32_t cmdtype; - ap_int32_t detached; -}; - -struct proc_t { - ap_context_t *cntxt; - pid_t pid; - struct procattr_t *attr; -}; - -/*This will move to ap_threadproc.h in time, but I need to figure it out - * on windows first. :) - */ -ap_status_t ap_detach(struct proc_t **, ap_context_t *); - -#endif /* ! THREAD_PROC_H */ - diff --git a/include/arch/win32/atime.h b/include/arch/win32/atime.h deleted file mode 100644 index c79a3c058..000000000 --- a/include/arch/win32/atime.h +++ /dev/null @@ -1,70 +0,0 @@ -/* ==================================================================== - * 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 ATIME_H -#define ATIME_H - -#include "apr_winconfig.h" -#include "apr_time.h" -#include <time.h> - -struct atime_t { - ap_context_t *cntxt; - time_t currtime; - SYSTEMTIME *explodedtime; -}; - - -#endif /* ! ATIME_H */ - diff --git a/include/arch/win32/fileio.h b/include/arch/win32/fileio.h deleted file mode 100644 index 5c2818b19..000000000 --- a/include/arch/win32/fileio.h +++ /dev/null @@ -1,130 +0,0 @@ -/* ==================================================================== - * 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 FILE_IO_H -#define FILE_IO_H - -#ifdef HAVE_SYS_STAT_H -#include <sys/stat.h> -#endif -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif -#ifdef HAVE_SYS_FCNTL_H -#include <fcntl.h> -#endif -#ifdef HAVE_TIME_H -#include <time.h> -#endif -#ifdef HAVE_DIRENT_H -#include <dirent.h> -#endif -#ifdef HAVE_MALLOC_H -#include <malloc.h> -#endif -#ifdef HAVE_UIO_H -#include <sys/uio.h> -#endif -#include "apr_winconfig.h" -#include "apr_pools.h" -#include "apr_general.h" -#include "apr_file_io.h" -#include "apr_errno.h" - -/* quick run-down of fields in windows' ap_file_t structure that may have - * obvious uses. - * fname -- the filename as passed to the open call. - * dwFileAttricutes -- Attributes used to open the file. - * demonfname -- the canonicalized filename. Used to store the result from - * ap_os_canonicalize_filename. - * lowerdemonfname -- inserted at Ken Parzygnat's request, because of the - * ugly way windows deals with case in the filesystem. - * append -- Windows doesn't support the append concept when opening files. - * APR needs to keep track of this, and always make sure we append - * correctly when writing to a file with this flag set TRUE. - */ - -struct file_t { - ap_context_t *cntxt; - HANDLE filehand; - char *fname; - DWORD dwFileAttributes; - char *demonfname; - char *lowerdemonfname; - int buffered; - int stated; - int append; - int eof_hit; - off_t size; - time_t atime; - time_t mtime; - time_t ctime; -}; - -struct dir_t { - ap_context_t *cntxt; - char *dirname; - HANDLE dirhand; - WIN32_FIND_DATA *entry; -}; - -ap_status_t file_cleanup(void *); -/*mode_t get_fileperms(ap_fileperms_t); -*/ -API_EXPORT(char *) ap_os_systemcase_filename(struct context_t *pCont, - const char *szFile); -char * canonical_filename(struct context_t *pCont, const char *szFile); - -#endif /* ! FILE_IO_H */ - diff --git a/include/arch/win32/locks.h b/include/arch/win32/locks.h deleted file mode 100644 index 7f1e2df33..000000000 --- a/include/arch/win32/locks.h +++ /dev/null @@ -1,70 +0,0 @@ -/* ==================================================================== - * 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 LOCKS_H -#define LOCKS_H - -#include "apr_lock.h" - -struct lock_t { - ap_context_t *cntxt; - ap_locktype_e type; - ap_lockscope_e scope; - HANDLE mutex; - CRITICAL_SECTION section; - char *fname; -}; - -#endif /* LOCKS_H */ - diff --git a/include/arch/win32/misc.h b/include/arch/win32/misc.h deleted file mode 100644 index aa6d1260f..000000000 --- a/include/arch/win32/misc.h +++ /dev/null @@ -1,92 +0,0 @@ -/* ==================================================================== - * 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 MISC_H -#define MISC_H - -#include "apr_config.h" -#include "apr_general.h" -#include "apr_pools.h" -#include "apr_getopt.h" -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif -#ifdef HAVE_STDIO_H -#include <stdio.h> -#endif -#ifdef HAVE_STRING_H -#include <string.h> -#endif -#ifdef HAVE_SIGNAL_H -#include <signal.h> -#endif -#ifdef HAVE_PTHREAD_H -#include <pthread.h> -#endif - -typedef struct datastruct { - void *data; - char *key; - struct datastruct *next; - struct datastruct *prev; -} datastruct; - -struct context_t { - struct ap_pool_t *pool; - datastruct *prog_data; - int (*apr_abort)(int retcode); -}; - -#endif /* ! MISC_H */ - diff --git a/include/arch/win32/networkio.h b/include/arch/win32/networkio.h deleted file mode 100644 index 0725949b1..000000000 --- a/include/arch/win32/networkio.h +++ /dev/null @@ -1,81 +0,0 @@ -/* ==================================================================== - * 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 NETWORK_IO_H -#define NETWORK_IO_H - -#include "apr_network_io.h" -#include "apr_general.h" - -struct socket_t { - ap_context_t *cntxt; - SOCKET sock; - struct sockaddr_in *local_addr; - struct sockaddr_in *remote_addr; - size_t addr_len; - int timeout; -}; - -struct pollfd_t { - ap_context_t *cntxt; - fd_set *read; - int numread; - fd_set *write; - int numwrite; - fd_set *except; - int numexcept; -}; - -#endif /* ! NETWORK_IO_H */ - diff --git a/include/arch/win32/threadproc.h b/include/arch/win32/threadproc.h deleted file mode 100644 index e9d3bcf72..000000000 --- a/include/arch/win32/threadproc.h +++ /dev/null @@ -1,103 +0,0 @@ -/* ==================================================================== - * 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_win.h" -#include "apr_thread_proc.h" -#include "apr_file_io.h" -#include <windows.h> - -#ifndef THREAD_PROC_H -#define THREAD_PROC_H - -#define SHELL_PATH "cmd.exe" - -struct thread_t { - ap_context_t *cntxt; - HANDLE td; - ap_int32_t cancel; - ap_int32_t cancel_how; -}; - -struct threadattr_t { - ap_context_t *cntxt; - ap_int32_t detach; -}; - -struct threadkey_t { - ap_context_t *cntxt; - DWORD key; -}; - -struct procattr_t { - ap_context_t *cntxt; - STARTUPINFO si; - ap_file_t *parent_in; - ap_file_t *child_in; - ap_file_t *parent_out; - ap_file_t *child_out; - ap_file_t *parent_err; - ap_file_t *child_err; - char *currdir; - ap_int32_t cmdtype; - ap_int32_t detached; -}; - -struct proc_t { - ap_context_t *cntxt; - PROCESS_INFORMATION pi; - struct procattr_t *attr; -}; - -#endif /* ! THREAD_PROC_H */ - diff --git a/libapr.def b/libapr.def deleted file mode 100644 index 7a723b440..000000000 --- a/libapr.def +++ /dev/null @@ -1,240 +0,0 @@ -; aprlib.def : - -LIBRARY aprlib -DESCRIPTION '' - -EXPORTS - ; Add new API calls to the end of this list. - ap_opendir @1 - ap_closedir @2 - ap_readdir @3 - ap_rewinddir @4 - ap_make_dir @5 - ap_remove_dir @6 - ap_dir_entry_size @7 - ap_dir_entry_mtime @8 - ap_dir_entry_ftype @9 - ap_get_dir_filename @10 -; ap_get_filename @11 - ap_stat @11 -; ap_get_filesize @12 -; ap_get_fileatime @13 -; ap_get_filectime @14 -; ap_make_iov @15 - ap_dupfile @16 - ap_getfileinfo @17 - ap_open @18 - ap_close @19 - ap_remove_file @20 - ap_create_pipe @21 - ap_read @22 - ap_write @23 - ap_seek @24 - ap_get_filedata @25 - ap_set_filedata @26 - ap_get_os_file @27 - ap_put_os_file @28 - ap_get_os_dir @29 - ap_putc @30 - ap_getc @31 - ap_puts @32 - ap_fgets @33 - ap_flush @34 - ap_fprintf @35 - ap_eof @36 -; ap_get_filetype @37 - ap_writev @38 - ; locks - ap_create_lock @39 - ap_lock @40 - ap_unlock @41 - ap_destroy_lock @42 - ap_child_init_lock @43 - ap_get_lockdata @44 - ap_set_lockdata @45 - ap_get_os_lock @46 - ap_create_tcp_socket @47 - ap_shutdown @48 - ap_close_socket @49 - ap_bind @50 - ap_listen @51 - ap_accept @52 - ap_connect @53 - ap_get_remote_hostname @54 - ap_gethostname @55 - ap_send @56 - ap_recv @57 - ap_setsocketopt @58 - ap_sendv @59 - ap_sendfile @60 - ap_setup_poll @61 - ap_poll @62 - ap_add_poll_socket @63 - ap_get_revents @64 - ap_get_socketdata @65 - ap_set_socketdata @66 - ap_get_polldata @67 - ap_set_polldata @68 - ap_put_os_sock @69 - ap_get_os_sock @70 - ap_remove_poll_socket @71 - ap_clear_poll_sockets @72 -; ap_setipaddr @73 -; ap_getipaddr @74 -; ap_create_signal @75 -; ap_setup_signal @76 -; SignalHandling @77 -; ap_send_signal @78 -; thread_ready @79 - ap_createprocattr_init @80 - ap_setprocattr_io @81 - ap_setprocattr_dir @82 - ap_setprocattr_cmdtype @83 - ap_setprocattr_detach @84 - ap_create_process @85 - ap_get_childin @86 - ap_get_childout @87 - ap_get_childerr @88 - ap_wait_proc @89 - ap_kill @90 - ap_create_threadattr @91 - ap_setthreadattr_detach @92 - ap_getthreadattr_detach @93 - ap_create_thread @94 - ap_thread_exit @95 - ap_thread_join @96 - ap_thread_detach @97 - ap_cancel_thread @98 - ap_create_thread_private @99 - ap_get_thread_private @100 - ap_set_thread_private @101 - ap_delete_thread_private @102 - ap_get_threaddata @103 - ap_set_threaddata @104 - ap_get_threadkeydata @105 - ap_set_threadkeydata @106 - ap_get_procdata @107 -; ap_set_procdata @108 - ap_get_os_proc @109 - ap_get_os_thread @110 - ap_get_os_threadkey @111 - ap_os_systemcase_filename @112 - canonical_filename @113 - ap_create_context @114 - ap_destroy_context @115 -; WinTimeToUnixTime @116 - ap_get_oslevel @117 - ap_get_userdata @118 - ap_set_userdata @119 - ap_initialize @120 - ap_getopt @121 - ap_opterr @122 DATA - ap_optind @123 DATA - ap_optopt @124 DATA - ap_optreset @125 DATA - ap_optarg @126 DATA -; ap_make_time @127 - ap_ansi_time_to_ap_time @127 -; ap_current_time @128 - ap_now @128 -; ap_explode_time @129 - ap_explode_gmt @129 -; ap_implode_time @130 - ap_explode_localtime @130 -; ap_get_curtime @131 - ap_implode_time @131 -; ap_get_sec @132 - ap_get_os_imp_time @132 -; ap_get_min @133 - ap_get_os_exp_time @133 -; ap_get_hour @134 - ap_put_os_imp_time @134 -; ap_get_mday @135 - ap_put_os_exp_time @135 -; ap_get_mon @136 - ap_ctime @136 -; ap_get_year @137 - ap_rfc822_date @137 -; ap_get_wday @138 - ap_strftime @138 -; ap_set_sec @139 -; ap_set_min @140 -; ap_set_hour @141 -; ap_set_mday @142 -; ap_set_mon @143 -; ap_set_year @144 -; ap_set_wday @145 -; ap_get_timedata @146 -; ap_set_timedata @147 -; ap_get_os_time @148 -; ap_timediff @149 - ap_MD5Final @150 - ap_MD5Init @151 - ap_MD5Update @152 - ap_cpystrn @153 - ap_register_cleanup @154 - ap_kill_cleanup @155 - ap_fnmatch @156 - ap_is_fnmatch @157 - ap_MD5Encode @158 - ap_validate_password @159 - ap_make_sub_pool @160 - ap_init_alloc @161 - ap_clear_pool @162 - ap_destroy_pool @163 - ap_bytes_in_pool @164 - ap_bytes_in_free_blocks @165 - ap_palloc @166 - ap_pcalloc @167 - ap_pstrdup @168 - ap_pstrndup @169 - ap_pstrcat @170 - ap_pvsprintf @171 - ap_psprintf @172 - ap_make_array @173 - ap_push_array @174 - ap_array_cat @175 - ap_copy_array @176 - ap_copy_array_hdr @177 - ap_append_arrays @178 - ap_array_pstrcat @179 - ap_make_table @180 - ap_copy_table @181 - ap_clear_table @182 - ap_table_get @183 - ap_table_set @184 - ap_table_setn @185 - ap_table_unset @186 - ap_table_merge @187 - ap_table_mergen @188 - ap_table_add @189 - ap_table_addn @190 - ap_overlay_tables @191 - ap_table_do @192 - ap_overlap_tables @193 - ap_run_cleanup @194 - ap_cleanup_for_exec @195 - ap_null_cleanup @196 - ap_note_subprocess @197 - ap_slack @198 - ap_vformatter @199 - ap_snprintf @200 - ap_vsnprintf @201 - ap_getpass @202 - ap_ungetc @203 - ap_tokenize_to_argv @204 - ap_filename_of_pathname @205 - ap_get_remote_name @206 - ap_get_local_name @207 - ap_get_local_ipaddr @208 - ap_set_local_ipaddr @209 - ap_get_remote_ipaddr @210 - ap_set_remote_ipaddr @211 - ap_get_local_port @212 - ap_set_local_port @213 - ap_get_remote_port @214 - ap_set_remote_port @215 - ap_open_stderr @216 - ap_set_pipe_timeout @217 - ap_terminate @218 - diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c deleted file mode 100644 index 522aba584..000000000 --- a/memory/unix/apr_pools.c +++ /dev/null @@ -1,1397 +0,0 @@ -/* ==================================================================== - * 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/>. - */ - -/* - * Resource allocation code... the code here is responsible for making - * sure that nothing leaks. - * - * rst --- 4/95 --- 6/95 - */ - -#ifndef WIN32 -#include "apr_config.h" -#else -#include "apr_winconfig.h" -#endif - -#include "apr_general.h" -#include "apr_pools.h" -#include "apr_lib.h" -#include "apr_lock.h" -#include "misc.h" - -#ifdef HAVE_SYS_STAT_H -#include <sys/stat.h> -#endif -#ifdef HAVE_SYS_SIGNAL_H -#include <sys/signal.h> -#endif -#ifdef HAVE_SIGNAL_H -#include <signal.h> -#endif -#ifdef HAVE_SYS_WAIT_H -#include <sys/wait.h> -#endif -#ifdef HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#ifdef HAVE_FCNTL_H -#include <fcntl.h> -#endif - -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif -#ifdef HAVE_MALLOC_H -#include <malloc.h> -#endif - -/* - * Debugging support: Define this to enable code which helps detect re-use - * of freed memory and other such nonsense. - * - * The theory is simple. The FILL_BYTE (0xa5) is written over all malloc'd - * memory as we receive it, and is written over everything that we free up - * during a clear_pool. We check that blocks on the free list always - * have the FILL_BYTE in them, and we check during palloc() that the bytes - * still have FILL_BYTE in them. If you ever see garbage URLs or whatnot - * containing lots of 0xa5s then you know something used data that's been - * freed or uninitialized. - */ -/* #define ALLOC_DEBUG */ - -/* - * Debugging support: If defined all allocations will be done with - * malloc and free()d appropriately at the end. This is intended to be - * used with something like Electric Fence or Purify to help detect - * memory problems. Note that if you're using efence then you should also - * add in ALLOC_DEBUG. But don't add in ALLOC_DEBUG if you're using Purify - * because ALLOC_DEBUG would hide all the uninitialized read errors that - * Purify can diagnose. - */ -/* #define ALLOC_USE_MALLOC */ - -/* - * Pool debugging support: This is intended to detect cases where the - * wrong pool is used when assigning data to an object in another pool. - * In particular, it causes the table_{set,add,merge}n routines to check - * that their arguments are safe for the ap_table_t they're being placed in. - * It currently only works with the unix multiprocess model, but could - * be extended to others. - */ -/* #define POOL_DEBUG */ - -/* - * Provide diagnostic information about make_table() calls which are - * possibly too small. This requires a recent gcc which supports - * __builtin_return_address(). The error_log output will be a - * message such as: - * table_push: ap_table_t created by 0x804d874 hit limit of 10 - * Use "l *0x804d874" to find the source that corresponds to. It - * indicates that a ap_table_t allocated by a call at that address has - * possibly too small an initial ap_table_t size guess. - */ -/* #define MAKE_TABLE_PROFILE */ - -/* - * Provide some statistics on the cost of allocations. It requires a - * bit of an understanding of how alloc.c works. - */ -/* #define ALLOC_STATS */ - -#ifdef POOL_DEBUG -#ifdef ALLOC_USE_MALLOC -#error "sorry, no support for ALLOC_USE_MALLOC and POOL_DEBUG at the same time" -#endif /* ALLOC_USE_MALLOC */ - -#ifdef MULTITHREAD -# error "sorry, no support for MULTITHREAD and POOL_DEBUG at the same time" -#endif /* MULTITHREAD */ - -#endif /* POOL_DEBUG */ - -#ifdef ALLOC_USE_MALLOC -#undef BLOCK_MINFREE -#undef BLOCK_MINALLOC -#define BLOCK_MINFREE 0 -#define BLOCK_MINALLOC 0 -#endif /* ALLOC_USE_MALLOC */ - -#define AP_SLACK_LOW 1 -#define AP_SLACK_HIGH 2 - - -/***************************************************************** - * - * Managing free storage blocks... - */ - -union align { - /* - * Types which are likely to have the longest RELEVANT alignment - * restrictions... - */ - - char *cp; - void (*f) (void); - long l; - FILE *fp; - double d; -}; - -#define CLICK_SZ (sizeof(union align)) - -union block_hdr { - union align a; - - /* Actual header... */ - - struct { - char *endp; - union block_hdr *next; - char *first_avail; -#ifdef POOL_DEBUG - union block_hdr *global_next; - ap_pool_t *owning_pool; -#endif /* POOL_DEBUG */ - } h; -}; - -#define APR_ABORT(conditional, retcode, func, str) \ - if (conditional) { \ - if ((func) == NULL) { \ - return NULL; \ - } \ - else { \ - fprintf(stderr, "%s", str); \ - (*(func))(retcode); \ - } \ - } - -/* - * Static cells for managing our internal synchronisation. - */ -static union block_hdr *block_freelist = NULL; - -#if APR_HAS_THREADS -static ap_lock_t *alloc_mutex; -static ap_lock_t *spawn_mutex; -#endif - -#ifdef POOL_DEBUG -static char *known_stack_point; -static int stack_direction; -static union block_hdr *global_block_list; -#define FREE_POOL ((ap_pool_t *)(-1)) -#endif /* POOL_DEBUG */ - -#ifdef ALLOC_STATS -static unsigned long long num_free_blocks_calls; -static unsigned long long num_blocks_freed; -static unsigned max_blocks_in_one_free; -static unsigned num_malloc_calls; -static unsigned num_malloc_bytes; -#endif /* ALLOC_STATS */ - -#ifdef ALLOC_DEBUG -#define FILL_BYTE ((char)(0xa5)) -#define debug_fill(ptr,size) ((void)memset((ptr), FILL_BYTE, (size))) - -static APR_INLINE void debug_verify_filled(const char *ptr, const char *endp, - const char *error_msg) -{ - for ( ; ptr < endp; ++ptr) { - if (*ptr != FILL_BYTE) { - fputs(error_msg, stderr); - abort(); - exit(1); - } - } -} - -#else /* ALLOC_DEBUG */ -#define debug_fill(a,b) -#define debug_verify_filled(a,b,c) -#endif /* ALLOC_DEBUG */ - -/* - * Get a completely new block from the system pool. Note that we rely on - * malloc() to provide aligned memory. - */ - -static union block_hdr *malloc_block(int size, int (*apr_abort)(int retcode)) -{ - union block_hdr *blok; - -#ifdef ALLOC_DEBUG - /* make some room at the end which we'll fill and expect to be - * always filled - */ - size += CLICK_SZ; -#endif /* ALLOC_DEBUG */ - -#ifdef ALLOC_STATS - ++num_malloc_calls; - num_malloc_bytes += size + sizeof(union block_hdr); -#endif /* ALLOC_STATS */ - - blok = (union block_hdr *) malloc(size + sizeof(union block_hdr)); - APR_ABORT(blok == NULL, APR_ENOMEM, apr_abort, - "Ouch! malloc failed in malloc_block()\n"); - debug_fill(blok, size + sizeof(union block_hdr)); - blok->h.next = NULL; - blok->h.first_avail = (char *) (blok + 1); - blok->h.endp = size + blok->h.first_avail; - -#ifdef ALLOC_DEBUG - blok->h.endp -= CLICK_SZ; -#endif /* ALLOC_DEBUG */ - -#ifdef POOL_DEBUG - blok->h.global_next = global_block_list; - global_block_list = blok; - blok->h.owning_pool = NULL; -#endif /* POOL_DEBUG */ - - return blok; -} - - - -#if defined(ALLOC_DEBUG) && !defined(ALLOC_USE_MALLOC) -static void chk_on_blk_list(union block_hdr *blok, union block_hdr *free_blk) -{ - debug_verify_filled(blok->h.endp, blok->h.endp + CLICK_SZ, - "Ouch! Someone trounced the padding " - "at the end of a block!\n"); - while (free_blk) { - if (free_blk == blok) { - fprintf(stderr, "Ouch! Freeing free block\n"); - abort(); - exit(1); - } - free_blk = free_blk->h.next; - } -} -#else /* defined(ALLOC_DEBUG) && !defined(ALLOC_USE_MALLOC) */ -#define chk_on_blk_list(_x, _y) -#endif /* defined(ALLOC_DEBUG) && !defined(ALLOC_USE_MALLOC) */ - -/* Free a chain of blocks --- must be called with alarms blocked. */ - -static void free_blocks(union block_hdr *blok) -{ -#ifdef ALLOC_USE_MALLOC - union block_hdr *next; - - for ( ; blok; blok = next) { - next = blok->h.next; - free(blok); - } -#else /* ALLOC_USE_MALLOC */ - -#ifdef ALLOC_STATS - unsigned num_blocks; -#endif /* ALLOC_STATS */ - - /* - * First, put new blocks at the head of the free list --- - * we'll eventually bash the 'next' pointer of the last block - * in the chain to point to the free blocks we already had. - */ - - union block_hdr *old_free_list; - - if (blok == NULL) { - return; /* Sanity check --- freeing empty pool? */ - } - -#if APR_HAS_THREADS - ap_lock(alloc_mutex); -#endif - old_free_list = block_freelist; - block_freelist = blok; - - /* - * Next, adjust first_avail pointers of each block --- have to do it - * sooner or later, and it simplifies the search in new_block to do it - * now. - */ - -#ifdef ALLOC_STATS - num_blocks = 1; -#endif /* ALLOC_STATS */ - - while (blok->h.next != NULL) { - -#ifdef ALLOC_STATS - ++num_blocks; -#endif /* ALLOC_STATS */ - - chk_on_blk_list(blok, old_free_list); - blok->h.first_avail = (char *) (blok + 1); - debug_fill(blok->h.first_avail, blok->h.endp - blok->h.first_avail); -#ifdef POOL_DEBUG - blok->h.owning_pool = FREE_POOL; -#endif /* POOL_DEBUG */ - blok = blok->h.next; - } - - chk_on_blk_list(blok, old_free_list); - blok->h.first_avail = (char *) (blok + 1); - debug_fill(blok->h.first_avail, blok->h.endp - blok->h.first_avail); -#ifdef POOL_DEBUG - blok->h.owning_pool = FREE_POOL; -#endif /* POOL_DEBUG */ - - /* Finally, reset next pointer to get the old free blocks back */ - - blok->h.next = old_free_list; - -#ifdef ALLOC_STATS - if (num_blocks > max_blocks_in_one_free) { - max_blocks_in_one_free = num_blocks; - } - ++num_free_blocks_calls; - num_blocks_freed += num_blocks; -#endif /* ALLOC_STATS */ - -#if APR_HAS_THREADS - ap_unlock(alloc_mutex); -#endif /* APR_HAS_THREADS */ -#endif /* ALLOC_USE_MALLOC */ -} - -/* - * Get a new block, from our own free list if possible, from the system - * if necessary. Must be called with alarms blocked. - */ - -static union block_hdr *new_block(int min_size, int (*apr_abort)(int retcode)) -{ - union block_hdr **lastptr = &block_freelist; - union block_hdr *blok = block_freelist; - - /* First, see if we have anything of the required size - * on the free list... - */ - - while (blok != NULL) { - if (min_size + BLOCK_MINFREE <= blok->h.endp - blok->h.first_avail) { - *lastptr = blok->h.next; - blok->h.next = NULL; - debug_verify_filled(blok->h.first_avail, blok->h.endp, - "Ouch! Someone trounced a block " - "on the free list!\n"); - return blok; - } - else { - lastptr = &blok->h.next; - blok = blok->h.next; - } - } - - /* Nope. */ - - min_size += BLOCK_MINFREE; - blok = malloc_block((min_size > BLOCK_MINALLOC) - ? min_size : BLOCK_MINALLOC, apr_abort); - return blok; -} - - -/* Accounting */ - -static long bytes_in_block_list(union block_hdr *blok) -{ - long size = 0; - - while (blok) { - size += blok->h.endp - (char *) (blok + 1); - blok = blok->h.next; - } - - return size; -} - - -/***************************************************************** - * - * Pool internals and management... - * NB that subprocesses are not handled by the generic cleanup code, - * basically because we don't want cleanups for multiple subprocesses - * to result in multiple three-second pauses. - */ - -struct process_chain; -struct cleanup; - -static void run_cleanups(struct cleanup *c); -static void free_proc_chain(struct process_chain *p); - -static ap_pool_t *permanent_pool; - -/* Each pool structure is allocated in the start of its own first block, - * so we need to know how many bytes that is (once properly aligned...). - * This also means that when a pool's sub-pool is destroyed, the storage - * associated with it is *completely* gone, so we have to make sure it - * gets taken off the parent's sub-pool list... - */ - -#define POOL_HDR_CLICKS (1 + ((sizeof(struct ap_pool_t) - 1) / CLICK_SZ)) -#define POOL_HDR_BYTES (POOL_HDR_CLICKS * CLICK_SZ) - -API_EXPORT(ap_pool_t *) ap_make_sub_pool(ap_pool_t *p, int (*apr_abort)(int retcode)) -{ - union block_hdr *blok; - ap_pool_t *new_pool; - - ap_block_alarms(); - -#if APR_HAS_THREADS - ap_lock(alloc_mutex); -#endif - - blok = new_block(POOL_HDR_BYTES, apr_abort); - new_pool = (ap_pool_t *) blok->h.first_avail; - blok->h.first_avail += POOL_HDR_BYTES; -#ifdef POOL_DEBUG - blok->h.owning_pool = new_pool; -#endif - - memset((char *) new_pool, '\0', sizeof(struct ap_pool_t)); - new_pool->free_first_avail = blok->h.first_avail; - new_pool->first = new_pool->last = blok; - - if (p) { - new_pool->parent = p; - new_pool->sub_next = p->sub_pools; - if (new_pool->sub_next) { - new_pool->sub_next->sub_prev = new_pool; - } - p->sub_pools = new_pool; - } - else { - permanent_pool = p; - } - -#if APR_HAS_THREADS - ap_unlock(alloc_mutex); -#endif - ap_unblock_alarms(); - - return new_pool; -} - -#ifdef POOL_DEBUG -static void stack_var_init(char *s) -{ - char t; - - if (s < &t) { - stack_direction = 1; /* stack grows up */ - } - else { - stack_direction = -1; /* stack grows down */ - } -} -#endif - -#ifdef ALLOC_STATS -static void dump_stats(void) -{ - fprintf(stderr, - "alloc_stats: [%d] #free_blocks %llu #blocks %llu max " - "%u #malloc %u #bytes %u\n", - (int) getpid(), - num_free_blocks_calls, - num_blocks_freed, - max_blocks_in_one_free, - num_malloc_calls, - num_malloc_bytes); -} -#endif - -/***************************************************************** - * - * Managing generic cleanups. - */ - -struct cleanup { - void *data; - ap_status_t (*plain_cleanup) (void *); - ap_status_t (*child_cleanup) (void *); - struct cleanup *next; -}; - -static void * ap_pool_palloc(ap_pool_t *a, int reqsize, int (*apr_abort)(int retcode)); - -#if 0 -static void ap_register_pool_cleanup(struct ap_pool_t *p, void *data, - ap_status_t (*plain_cleanup) (void *), - ap_status_t (*child_cleanup) (void *)) -{ - struct cleanup *c; - - if (p != NULL) { - c = (struct cleanup *) ap_pool_palloc(p, sizeof(struct cleanup), NULL); - c->data = data; - c->plain_cleanup = plain_cleanup; - c->child_cleanup = child_cleanup; - c->next = p->cleanups; - p->cleanups = c; - } -} -#endif - -API_EXPORT(void) ap_register_cleanup(struct context_t *p, void *data, - ap_status_t (*plain_cleanup) (void *), - ap_status_t (*child_cleanup) (void *)) -{ - struct cleanup *c; - - if (p != NULL) { - c = (struct cleanup *) ap_palloc(p, sizeof(struct cleanup)); - c->data = data; - c->plain_cleanup = plain_cleanup; - c->child_cleanup = child_cleanup; - c->next = p->pool->cleanups; - p->pool->cleanups = c; - } -} - -API_EXPORT(void) ap_kill_cleanup(struct context_t *p, void *data, - ap_status_t (*cleanup) (void *)) -{ - struct cleanup *c; - struct cleanup **lastp; - - if (p == NULL) - return; - c = p->pool->cleanups; - lastp = &p->pool->cleanups; - while (c) { - if (c->data == data && c->plain_cleanup == cleanup) { - *lastp = c->next; - break; - } - - lastp = &c->next; - c = c->next; - } -} - -API_EXPORT(void) ap_run_cleanup(struct context_t *p, void *data, - ap_status_t (*cleanup) (void *)) -{ - ap_block_alarms(); /* Run cleanup only once! */ - (*cleanup) (data); - ap_kill_cleanup(p, data, cleanup); - ap_unblock_alarms(); -} - -static void run_cleanups(struct cleanup *c) -{ - while (c) { - (*c->plain_cleanup) (c->data); - c = c->next; - } -} - -static void run_child_cleanups(struct cleanup *c) -{ - while (c) { - (*c->child_cleanup) (c->data); - c = c->next; - } -} - -static void cleanup_pool_for_exec(ap_pool_t *p) -{ - run_child_cleanups(p->cleanups); - p->cleanups = NULL; - - for (p = p->sub_pools; p; p = p->sub_next) { - cleanup_pool_for_exec(p); - } -} - -API_EXPORT(void) ap_cleanup_for_exec(void) -{ -#if !defined(WIN32) && !defined(OS2) - /* - * Don't need to do anything on NT or OS/2, because I - * am actually going to spawn the new process - not - * exec it. All handles that are not inheritable, will - * be automajically closed. The only problem is with - * file handles that are open, but there isn't much - * I can do about that (except if the child decides - * to go out and close them - */ - ap_block_alarms(); - cleanup_pool_for_exec(permanent_pool); - ap_unblock_alarms(); -#endif /* ndef WIN32 */ -} - -API_EXPORT_NONSTD(ap_status_t) ap_null_cleanup(void *data) -{ - /* do nothing cleanup routine */ - return APR_SUCCESS; -} - -ap_status_t ap_init_alloc(void) -{ -#if APR_HAS_THREADS - ap_status_t status; -#endif -#ifdef POOL_DEBUG - char s; - - known_stack_point = &s; - stack_var_init(&s); -#endif -#if APR_HAS_THREADS - status = ap_create_lock(&alloc_mutex, APR_MUTEX, APR_INTRAPROCESS, - NULL, NULL); - if (status != APR_SUCCESS) { - ap_destroy_lock(alloc_mutex); - return status; - } - status = ap_create_lock(&spawn_mutex, APR_MUTEX, APR_INTRAPROCESS, - NULL, NULL); - if (status != APR_SUCCESS) { - ap_destroy_lock(spawn_mutex); - return status; - } -#endif - -#ifdef ALLOC_STATS - atexit(dump_stats); -#endif - - return APR_SUCCESS; -} - -void ap_term_alloc(void) -{ -#if APR_HAS_THREADS - ap_destroy_lock(alloc_mutex); - ap_destroy_lock(spawn_mutex); -#endif -} - -void ap_destroy_real_pool(ap_pool_t *); - -/* We only want to lock the mutex if we are being called from ap_clear_pool. - * This is because if we also call this function from ap_destroy_real_pool, - * which also locks the same mutex, and recursive locks aren't portable. - * This way, we are garaunteed that we only lock this mutex once when calling - * either one of these functions. - */ -static void ap_clear_real_pool(ap_pool_t *a) -{ - ap_block_alarms(); - - while (a->sub_pools) { - ap_destroy_real_pool(a->sub_pools); - } - /* - * Don't hold the mutex during cleanups. - */ - run_cleanups(a->cleanups); - a->cleanups = NULL; - free_proc_chain(a->subprocesses); - a->subprocesses = NULL; - free_blocks(a->first->h.next); - a->first->h.next = NULL; - - a->last = a->first; - a->first->h.first_avail = a->free_first_avail; - debug_fill(a->first->h.first_avail, - a->first->h.endp - a->first->h.first_avail); - -#ifdef ALLOC_USE_MALLOC - { - void *c, *n; - - for (c = a->allocation_list; c; c = n) { - n = *(void **)c; - free(c); - } - a->allocation_list = NULL; - } -#endif - - ap_unblock_alarms(); -} - -API_EXPORT(void) ap_clear_pool(struct context_t *a) -{ - ap_clear_real_pool(a->pool); -} - -API_EXPORT(void) ap_destroy_real_pool(ap_pool_t *a) -{ - ap_block_alarms(); - ap_clear_real_pool(a); -#if APR_HAS_THREADS - ap_lock(alloc_mutex); -#endif - - if (a->parent) { - if (a->parent->sub_pools == a) { - a->parent->sub_pools = a->sub_next; - } - if (a->sub_prev) { - a->sub_prev->sub_next = a->sub_next; - } - if (a->sub_next) { - a->sub_next->sub_prev = a->sub_prev; - } - } -#if APR_HAS_THREADS - ap_unlock(alloc_mutex); -#endif - free_blocks(a->first); - ap_unblock_alarms(); -} - -API_EXPORT(void) ap_destroy_pool(struct context_t *a) -{ - ap_destroy_real_pool(a->pool); -} - -API_EXPORT(long) ap_bytes_in_pool(ap_pool_t *p) -{ - return bytes_in_block_list(p->first); -} -API_EXPORT(long) ap_bytes_in_free_blocks(void) -{ - return bytes_in_block_list(block_freelist); -} - -/***************************************************************** - * POOL_DEBUG support - */ -#ifdef POOL_DEBUG - -/* the unix linker defines this symbol as the last byte + 1 of - * the executable... so it includes TEXT, BSS, and DATA - */ -extern char _end; - -/* is ptr in the range [lo,hi) */ -#define is_ptr_in_range(ptr, lo, hi) \ - (((unsigned long)(ptr) - (unsigned long)(lo)) \ - < (unsigned long)(hi) - (unsigned long)(lo)) - -/* Find the pool that ts belongs to, return NULL if it doesn't - * belong to any pool. - */ -API_EXPORT(ap_pool_t *) ap_find_pool(const void *ts, int (apr_abort)(int retcode)) -{ - const char *s = ts; - union block_hdr **pb; - union block_hdr *b; - - /* short-circuit stuff which is in TEXT, BSS, or DATA */ - if (is_ptr_in_range(s, 0, &_end)) { - return NULL; - } - /* consider stuff on the stack to also be in the NULL pool... - * XXX: there's cases where we don't want to assume this - */ - APR_ABORT((stack_direction == -1 && - is_ptr_in_range(s, &ts, known_stack_point)) || - (stack_direction == 1 && - is_ptr_in_range(s, known_stack_point, &ts)), 1, apr_abort, - "Ouch! find_pool() called on pointer in a free block\n"); - ap_block_alarms(); - /* search the global_block_list */ - for (pb = &global_block_list; *pb; pb = &b->h.global_next) { - b = *pb; - if (is_ptr_in_range(s, b, b->h.endp)) { - if (b->h.owning_pool == FREE_POOL) { - abort(); - exit(1); - } - if (b != global_block_list) { - /* - * promote b to front of list, this is a hack to speed - * up the lookup - */ - *pb = b->h.global_next; - b->h.global_next = global_block_list; - global_block_list = b; - } - ap_unblock_alarms(); - return b->h.owning_pool; - } - } - ap_unblock_alarms(); - return NULL; -} - -/* return TRUE iff a is an ancestor of b - * NULL is considered an ancestor of all pools - */ -API_EXPORT(int) ap_pool_is_ancestor(ap_pool_t *a, ap_pool_t *b) -{ - if (a == NULL) { - return 1; - } - while (a->joined) { - a = a->joined; - } - while (b) { - if (a == b) { - return 1; - } - b = b->parent; - } - return 0; -} - -/* - * All blocks belonging to sub will be changed to point to p - * instead. This is a guarantee by the caller that sub will not - * be destroyed before p is. - */ -API_EXPORT(void) ap_pool_join(ap_pool_t *p, ap_pool_t *sub, - int (*apr_abort)(int retcode)) -{ - union block_hdr *b; - - /* We could handle more general cases... but this is it for now. */ - APR_ABORT(sub->parent != p, 1, apr_abort, - "pool_join: p is not a parent of sub\n"); - ap_block_alarms(); - while (p->joined) { - p = p->joined; - } - sub->joined = p; - for (b = global_block_list; b; b = b->h.global_next) { - if (b->h.owning_pool == sub) { - b->h.owning_pool = p; - } - } - ap_unblock_alarms(); -} -#endif - -/***************************************************************** - * - * Allocating stuff... - */ - -static void * ap_pool_palloc(ap_pool_t *a, int reqsize, int (*apr_abort)(int retcode)) -{ -#ifdef ALLOC_USE_MALLOC - int size = reqsize + CLICK_SZ; - void *ptr; - - ap_block_alarms(); - if (c == NULL) { - return malloc(reqsize); - } - ptr = malloc(size); - if (ptr == NULL) { - fputs("Ouch! Out of memory!\n", stderr); - exit(1); - } - debug_fill(ptr, size); /* might as well get uninitialized protection */ - *(void **)ptr = a->allocation_list; - a->allocation_list = ptr; - ap_unblock_alarms(); - return (char *)ptr + CLICK_SZ; -#else - - /* - * Round up requested size to an even number of alignment units - * (core clicks) - */ - int nclicks; - int size; - - /* First, see if we have space in the block most recently - * allocated to this pool - */ - - union block_hdr *blok; - char *first_avail; - char *new_first_avail; - - nclicks = 1 + ((reqsize - 1) / CLICK_SZ); - size = nclicks * CLICK_SZ; - - /* First, see if we have space in the block most recently - * allocated to this pool - */ - - blok = a->last; - first_avail = blok->h.first_avail; - - if (reqsize <= 0) { - return NULL; - } - - new_first_avail = first_avail + size; - - if (new_first_avail <= blok->h.endp) { - debug_verify_filled(first_avail, blok->h.endp, - "Ouch! Someone trounced past the end " - "of their allocation!\n"); - blok->h.first_avail = new_first_avail; - return (void *) first_avail; - } - - /* Nope --- get a new one that's guaranteed to be big enough */ - - ap_block_alarms(); - -#if APR_HAS_THREADS - ap_lock(alloc_mutex); -#endif - - blok = new_block(size, apr_abort); - a->last->h.next = blok; - a->last = blok; -#ifdef POOL_DEBUG - blok->h.owning_pool = a; -#endif - -#if APR_HAS_THREADS - ap_unlock(alloc_mutex); -#endif - - ap_unblock_alarms(); - - first_avail = blok->h.first_avail; - blok->h.first_avail += size; - - return (void *) first_avail; -#endif -} - -API_EXPORT(void *) ap_palloc(struct context_t *c, int reqsize) -{ - if (c == NULL) { - return malloc(reqsize); - } - return ap_pool_palloc(c->pool, reqsize, c->apr_abort); -} - -API_EXPORT(void *) ap_pcalloc(struct context_t *a, int size) -{ - void *res = ap_palloc(a, size); - memset(res, '\0', size); - return res; -} - -API_EXPORT(char *) ap_pstrdup(struct context_t *a, const char *s) -{ - char *res; - size_t len; - - if (s == NULL) { - return NULL; - } - len = strlen(s) + 1; - res = ap_palloc(a, len); - memcpy(res, s, len); - return res; -} - -API_EXPORT(char *) ap_pstrndup(struct context_t *a, const char *s, int n) -{ - char *res; - - if (s == NULL) { - return NULL; - } - res = ap_palloc(a, n + 1); - memcpy(res, s, n); - res[n] = '\0'; - return res; -} - -API_EXPORT_NONSTD(char *) ap_pstrcat(struct context_t *a, ...) -{ - char *cp, *argp, *res; - - /* Pass one --- find length of required string */ - - int len = 0; - va_list adummy; - - va_start(adummy, a); - - while ((cp = va_arg(adummy, char *)) != NULL) { - len += strlen(cp); - } - - va_end(adummy); - - /* Allocate the required string */ - - res = (char *) ap_palloc(a, len + 1); - cp = res; - *cp = '\0'; - - /* Pass two --- copy the argument strings into the result space */ - - va_start(adummy, a); - - while ((argp = va_arg(adummy, char *)) != NULL) { - strcpy(cp, argp); - cp += strlen(argp); - } - - va_end(adummy); - - /* Return the result string */ - - return res; -} - -/* - * ap_psprintf is implemented by writing directly into the current - * block of the pool, starting right at first_avail. If there's - * insufficient room, then a new block is allocated and the earlier - * output is copied over. The new block isn't linked into the pool - * until all the output is done. - * - * Note that this is completely safe because nothing else can - * allocate in this ap_context_t while ap_psprintf is running. alarms are - * blocked, and the only thing outside of alloc.c that's invoked - * is ap_vformatter -- which was purposefully written to be - * self-contained with no callouts. - */ - -struct psprintf_data { - ap_vformatter_buff_t vbuff; -#ifdef ALLOC_USE_MALLOC - char *base; -#else - union block_hdr *blok; - int got_a_new_block; -#endif -}; - -static int psprintf_flush(ap_vformatter_buff_t *vbuff) -{ - struct psprintf_data *ps = (struct psprintf_data *)vbuff; -#ifdef ALLOC_USE_MALLOC - int size; - char *ptr; - - size = (char *)ps->vbuff.curpos - ps->base; - ptr = realloc(ps->base, 2*size); - if (ptr == NULL) { - fputs("Ouch! Out of memory!\n", stderr); - exit(1); - } - ps->base = ptr; - ps->vbuff.curpos = ptr + size; - ps->vbuff.endpos = ptr + 2*size - 1; - return 0; -#else - union block_hdr *blok; - union block_hdr *nblok; - size_t cur_len; - char *strp; - - blok = ps->blok; - strp = ps->vbuff.curpos; - cur_len = strp - blok->h.first_avail; - - /* must try another blok */ -#if APR_HAS_THREADS - ap_lock(alloc_mutex); -#endif - nblok = new_block(2 * cur_len, NULL); -#if APR_HAS_THREADS - ap_unlock(alloc_mutex); -#endif - memcpy(nblok->h.first_avail, blok->h.first_avail, cur_len); - ps->vbuff.curpos = nblok->h.first_avail + cur_len; - /* save a byte for the NUL terminator */ - ps->vbuff.endpos = nblok->h.endp - 1; - - /* did we allocate the current blok? if so free it up */ - if (ps->got_a_new_block) { - debug_fill(blok->h.first_avail, blok->h.endp - blok->h.first_avail); -#if APR_HAS_THREADS - ap_lock(alloc_mutex); -#endif - blok->h.next = block_freelist; - block_freelist = blok; -#if APR_HAS_THREADS - ap_unlock(alloc_mutex); -#endif - } - ps->blok = nblok; - ps->got_a_new_block = 1; - /* note that we've deliberately not linked the new block onto - * the pool yet... because we may need to flush again later, and - * we'd have to spend more effort trying to unlink the block. - */ - return 0; -#endif -} - -API_EXPORT(char *) ap_pvsprintf(struct context_t *c, const char *fmt, va_list ap) -{ -#ifdef ALLOC_USE_MALLOC - ap_pool_t *p = c->pool; - struct psprintf_data ps; - void *ptr; - - ap_block_alarms(); - ps.base = malloc(512); - if (ps.base == NULL) { - fputs("Ouch! Out of memory!\n", stderr); - exit(1); - } - /* need room at beginning for allocation_list */ - ps.vbuff.curpos = ps.base + CLICK_SZ; - ps.vbuff.endpos = ps.base + 511; - ap_vformatter(psprintf_flush, &ps.vbuff, fmt, ap); - *ps.vbuff.curpos++ = '\0'; - ptr = ps.base; - /* shrink */ - ptr = realloc(ptr, (char *)ps.vbuff.curpos - (char *)ptr); - if (ptr == NULL) { - fputs("Ouch! Out of memory!\n", stderr); - exit(1); - } - *(void **)ptr = p->allocation_list; - p->allocation_list = ptr; - ap_unblock_alarms(); - return (char *)ptr + CLICK_SZ; -#else - struct psprintf_data ps; - char *strp; - int size; - ap_pool_t *p = c->pool; - - ap_block_alarms(); - ps.blok = p->last; - ps.vbuff.curpos = ps.blok->h.first_avail; - ps.vbuff.endpos = ps.blok->h.endp - 1; /* save one for NUL */ - ps.got_a_new_block = 0; - - ap_vformatter(psprintf_flush, &ps.vbuff, fmt, ap); - - strp = ps.vbuff.curpos; - *strp++ = '\0'; - - size = strp - ps.blok->h.first_avail; - size = (1 + ((size - 1) / CLICK_SZ)) * CLICK_SZ; - strp = ps.blok->h.first_avail; /* save away result pointer */ - ps.blok->h.first_avail += size; - - /* have to link the block in if it's a new one */ - if (ps.got_a_new_block) { - p->last->h.next = ps.blok; - p->last = ps.blok; -#ifdef POOL_DEBUG - ps.blok->h.owning_pool = p; -#endif - } - ap_unblock_alarms(); - - return strp; -#endif -} - -API_EXPORT_NONSTD(char *) ap_psprintf(struct context_t *p, const char *fmt, ...) -{ - va_list ap; - char *res; - - va_start(ap, fmt); - res = ap_pvsprintf(p, fmt, ap); - va_end(ap); - return res; -} - - -/***************************************************************** - * - * More grotty system stuff... subprocesses. Frump. These don't use - * the generic cleanup interface because I don't want multiple - * subprocesses to result in multiple three-second pauses; the - * subprocesses have to be "freed" all at once. If someone comes - * along with another resource they want to allocate which has the - * same property, we might want to fold support for that into the - * generic interface, but for now, it's a special case - */ - -API_EXPORT(void) ap_note_subprocess(struct context_t *a, ap_proc_t *pid, - enum kill_conditions how) -{ - struct process_chain *new = - (struct process_chain *) ap_palloc(a, sizeof(struct process_chain)); - - new->pid = pid; - new->kill_how = how; - new->next = a->pool->subprocesses; - a->pool->subprocesses = new; -} - -#ifdef WIN32 -#define os_pipe(fds) _pipe(fds, 512, O_BINARY | O_NOINHERIT) -#else -#define os_pipe(fds) pipe(fds) -#endif /* WIN32 */ - -/* for ap_fdopen, to get binary mode */ -#if defined (OS2) || defined (WIN32) -#define BINMODE "b" -#else -#define BINMODE -#endif - - -static void free_proc_chain(struct process_chain *procs) -{ - /* Dispose of the subprocesses we've spawned off in the course of - * whatever it was we're cleaning up now. This may involve killing - * some of them off... - */ - struct process_chain *p; - int need_timeout = 0; - int status; - - if (procs == NULL) { - return; /* No work. Whew! */ - } - - /* First, check to see if we need to do the SIGTERM, sleep, SIGKILL - * dance with any of the processes we're cleaning up. If we've got - * any kill-on-sight subprocesses, ditch them now as well, so they - * don't waste any more cycles doing whatever it is that they shouldn't - * be doing anymore. - */ - -#ifndef NEED_WAITPID - /* Pick up all defunct processes */ - for (p = procs; p; p = p->next) { - if (ap_wait_proc(p->pid, APR_NOWAIT) == APR_CHILD_DONE) { - p->kill_how = kill_never; - } - } -#endif - - for (p = procs; p; p = p->next) { - if ((p->kill_how == kill_after_timeout) - || (p->kill_how == kill_only_once)) { - /* - * Subprocess may be dead already. Only need the timeout if not. - * Note: ap_kill on Windows is TerminateProcess(), which is - * similar to a SIGKILL, so always give the process a timeout - * under Windows before killing it. - */ -#ifdef WIN32 - need_timeout = 1; -#else - if (ap_kill(p->pid, APR_SIGTERM) == APR_SUCCESS) { - need_timeout = 1; - } -#endif - } - else if (p->kill_how == kill_always) { - ap_kill(p->pid, APR_SIGKILL); - } - } - - /* Sleep only if we have to... */ - if (need_timeout) { - sleep(3); - } - - /* OK, the scripts we just timed out for have had a chance to clean up - * --- now, just get rid of them, and also clean up the system accounting - * goop... - */ - for (p = procs; p; p = p->next) { - if (p->kill_how == kill_after_timeout) { - ap_kill(p->pid, APR_SIGKILL); - } - } -#ifdef WIN32 - /* - * Do we need an APR function to clean-up a proc_t? - */ - { - PROCESS_INFORMATION pi; - for (p = procs; p; p = p->next) { - ap_get_os_proc(&pi, p->pid); - CloseHandle(pi.hProcess); - } - } -#endif /* WIN32 */ - - /* Now wait for all the signaled processes to die */ - for (p = procs; p; p = p->next) { - if (p->kill_how != kill_never) { - status = ap_wait_proc(p->pid, APR_WAIT); - } - } -} |