mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-14 10:09:48 +00:00
Import apache apr-1.4.6
This commit is contained in:
commit
b641829dca
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/apr/dist/; revision=251875 svn path=/vendor/apr/apr-1.4.6/; revision=251878; tag=vendor/apr/apr-1.4.6
190
CHANGES
Normal file
190
CHANGES
Normal file
@ -0,0 +1,190 @@
|
||||
-*- coding: utf-8 -*-
|
||||
Changes for APR 1.4.6
|
||||
|
||||
*) Flush write buffer before truncate call on a file.
|
||||
[Mladen Turk]
|
||||
|
||||
*) Security: oCERT-2011-003
|
||||
Randomise hashes by providing a seed.
|
||||
[Bojan Smojver, Branko Čibej, Ruediger Pluem et al.]
|
||||
|
||||
*) apr_random: Prevent segfault if pool used to initialize apr_random is
|
||||
destroyed before forking. [Stefan Fritsch]
|
||||
|
||||
*) testrand: Improve child randomness test case. [Rainer Jung]
|
||||
|
||||
*) apr_proc_fork, apr_random_after_fork: disambiguate what happens to the
|
||||
proc structure passed in, and ensure that the pid is set correctly in
|
||||
a newly created child; note that merely mixing a PID into the random
|
||||
seed of a new child doesn't markedly increase entropy. [Sander Temme]
|
||||
|
||||
*) apr_file_open: Avoid fcntl() calls if support for O_CLOEXEC works.
|
||||
PR 48557. [Mike Frysinger <vapier gentoo org>]
|
||||
|
||||
*) apr_dir_make_recursive: Fix race condition that could lead to EEXIST
|
||||
being returned. PR 51254. [William Lee <william lee rainstor com>,
|
||||
Wim Lewis <wiml omnigroup com>]
|
||||
|
||||
*) configure: Fix APR_RESTORE_THE_ENVIRONMENT if the original variable was
|
||||
a single space. PR 50334. [Nathan Phillip Brink <binki gentoo org>]
|
||||
|
||||
*) apr_proc_create: Don't close any of the new stdin/stdout/stderr in the
|
||||
child if it already has the correct FD. PR 51995.
|
||||
[Dan Ports <drkp csail mit edu>]
|
||||
|
||||
*) Fix flag character '#' in combination with format character 'x' in
|
||||
apr snprintf implementations. [Rainer Jung]
|
||||
|
||||
*) Improve platform detection by updating config.guess and config.sub.
|
||||
[Rainer Jung]
|
||||
|
||||
*) Add libtool2 files to extraclean make target. [Rainer Jung]
|
||||
|
||||
*) Don't overwrite our config.guess and config.sub
|
||||
when running buildconf. [Rainer Jung]
|
||||
|
||||
*) Silence autoconf 2.68 warnings. [Rainer Jung]
|
||||
|
||||
Changes for APR 1.4.5
|
||||
|
||||
*) Security: CVE-2011-1928
|
||||
apr_fnmatch(): Fix high CPU loop. [William Rowe]
|
||||
|
||||
*) Fix top_builddir in installed apr_rules.mk. [Bojan Smojver]
|
||||
|
||||
Changes for APR 1.4.4
|
||||
|
||||
*) Windows: Fix command-line builds. [William Rowe]
|
||||
|
||||
Changes for APR 1.4.3
|
||||
|
||||
*) Security: CVE-2011-0419
|
||||
Reimplement apr_fnmatch() from scratch using a non-recursive
|
||||
algorithm; now has improved compliance with the fnmatch() spec.
|
||||
[William Rowe]
|
||||
|
||||
*) Fix environment-related crash using some non-standard builds on
|
||||
Windows 7/Server 2008. [Steve Hay <SteveHay planit.com>]
|
||||
|
||||
*) poll, pollset, pollcb on Windows: Handle calls with no file/socket
|
||||
descriptors. PR 49882. [Stefan Ruppert <sr myarm.com>, Jeff Trawick]
|
||||
|
||||
*) Fix APR_IPV6_V6ONLY issues on Windows related to run-time behavior
|
||||
on Windows older than Vista and SDK/MinGW levels without IPV6_V6ONLY.
|
||||
PR 45321. [Sob <sob hisoftware.cz>]
|
||||
|
||||
*) Fix address handling when accepting an AF_INET socket from a socket
|
||||
bound as AF_INET6. PR 49678. [Joe Orton]
|
||||
|
||||
*) Fix error return values from apr_sockaddr_info_get() on Windows for
|
||||
IPv6 builds. [Ivan Zhakov <ivan visualsvn.com>]
|
||||
|
||||
*) Add new experimental configure option --enable-allocator-uses-mmap to
|
||||
use mmap instead of malloc in apr_allocator_alloc(). This greatly reduces
|
||||
memory fragmentation with malloc implementations (e.g. glibc) that
|
||||
don't handle allocationss of a page-size-multiples in an efficient way.
|
||||
It also makes apr_allocator_max_free_set() actually have some effect
|
||||
on such platforms. [Stefan Fritsch]
|
||||
|
||||
*) configure: Support 64 and 32 bit universal builds for Darwin/
|
||||
OS X 10.6+. [Jim Jagielski]
|
||||
|
||||
*) apr_sockaddr_info_get() on AIX: Fix a problem which could set
|
||||
the port field in the native socket address to 1 when 0 was
|
||||
specified. PR 46964. [Jeff Trawick]
|
||||
|
||||
*) configure: Make definition of apr_ino_t independent of
|
||||
_FILE_OFFSET_BITS even on platforms where ino_t is 'unsigned int'.
|
||||
[Stefan Fritsch]
|
||||
|
||||
*) apr_ring: Workaround for aliasing problem that causes gcc 4.5 to
|
||||
miscompile some brigade related code. PR 50190. [Stefan Fritsch]
|
||||
|
||||
*) apr_file_flush_locked(): Handle short writes. [Stefan Fritsch]
|
||||
|
||||
*) apr_pollset_create_ex(): Trap errors from pollset providers.
|
||||
PR 49094. [Sami Tolvanen <sami.tolvanen mywot.com>]
|
||||
|
||||
*) apr_pollset_create*(): Fix memory lifetime problem with the wakeup
|
||||
pipe when the pollset was created with APR_POLLSET_NOCOPY.
|
||||
[Neil Conway <nrc cs.berkeley.edu>]
|
||||
|
||||
*) Fix detection of some Linux variants when configure is built with
|
||||
recent GNU tools. [Eric Covener]
|
||||
|
||||
*) Avoid a redundant fcntl() call in apr_file_open() where O_CLOEXEC
|
||||
is supported. PR 46297. [Joe Orton]
|
||||
|
||||
*) Improve platform detection by updating config.guess and config.sub.
|
||||
[Rainer Jung]
|
||||
|
||||
Changes for APR 1.4.2
|
||||
|
||||
*) Undo a crash-bug introduced in 1.4.1 affecting some applications of
|
||||
the apr hash and table structures, reported to affect Subversion
|
||||
by Bert Huijben <bert qqmail.nl>. [Graham Leggett]
|
||||
|
||||
Changes for APR 1.4.1
|
||||
|
||||
*) Win32: Properly handle the ERROR_DIRECTORY system error code.
|
||||
[Brane Čibej]
|
||||
|
||||
Changes for APR 1.4.0
|
||||
|
||||
*) Windows: Default build configurations assume NT or higher at run-time.
|
||||
|
||||
*) Add apr_global_mutex_lockfile() for retrieving the file, if any,
|
||||
associated with the mutex. Add apr_global_mutex_name() for retrieving
|
||||
the name of the lock mechanism used by the underlying proc mutex.
|
||||
[Jeff Trawick]
|
||||
|
||||
*) Add apr_socket_atreadeof to determine whether the receive part of the
|
||||
socket has been closed by the peer.
|
||||
[Ruediger Pluem, Mladen Turk, Joe Orton]
|
||||
|
||||
*) Make apr_pollset and apr_pollcb implementations using providers.
|
||||
Added apr_pollset_create_ex and apr_pollcb_create_ex that allows
|
||||
choosing non-default providers.
|
||||
[Mladen Turk]
|
||||
|
||||
*) Win32: Use WSAPoll as default pollset method if supported and found
|
||||
inside winsock dll. [Mladen Turk]
|
||||
|
||||
*) apr_temp_dir_get() now checks the TMPDIR environment variable first,
|
||||
instead of third. [Jim Jagielski]
|
||||
|
||||
*) Add apr_file_sync() and apr_file_datasync() calls. [Bojan Smojver]
|
||||
|
||||
*) apr_pollset_wakeup() on Windows: Fix core caused by closing the
|
||||
file_socket_pipe with standard file_close.
|
||||
[Arsen Chaloyan, Mladen Turk]
|
||||
|
||||
*) Introduce apr_hash_do() for iterating over a hash table. [Mladen Turk]
|
||||
|
||||
*) Make sure WIN32 behaves the same as posix for file-backed shared memory
|
||||
by removing the file on cleanup/remove. [Mladen Turk]
|
||||
|
||||
*) Introduce apr_pollset_wakeup() for interrupting the blocking
|
||||
apr_pollset_poll() call. [Mladen Turk]
|
||||
|
||||
*) Add apr_file_link() function. PR 44841. [Mark Heily <mark heily.com>]
|
||||
|
||||
Changes for APR 1.3.x and later:
|
||||
|
||||
*) http://svn.apache.org/viewvc/apr/apr/branches/1.3.x/CHANGES?view=markup
|
||||
|
||||
Changes for APR 1.2.x and later:
|
||||
|
||||
*) http://svn.apache.org/viewvc/apr/apr/branches/1.2.x/CHANGES?view=markup
|
||||
|
||||
Changes for APR 1.1.x and later:
|
||||
|
||||
*) http://svn.apache.org/viewvc/apr/apr/branches/1.1.x/CHANGES?view=markup
|
||||
|
||||
Changes for APR 1.0.x and later:
|
||||
|
||||
*) http://svn.apache.org/viewvc/apr/apr/branches/1.0.x/CHANGES?view=markup
|
||||
|
||||
Changes for APR 0.9.x and later/earlier:
|
||||
|
||||
*) http://svn.apache.org/viewvc/apr/apr/branches/0.9.x/CHANGES?view=markup
|
341
LICENSE
Normal file
341
LICENSE
Normal file
@ -0,0 +1,341 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
|
||||
|
||||
APACHE PORTABLE RUNTIME SUBCOMPONENTS:
|
||||
|
||||
The Apache Portable Runtime includes a number of subcomponents with
|
||||
separate copyright notices and license terms. Your use of the source
|
||||
code for the these subcomponents is subject to the terms and
|
||||
conditions of the following licenses.
|
||||
|
||||
From strings/apr_fnmatch.c, include/apr_fnmatch.h, misc/unix/getopt.c,
|
||||
file_io/unix/mktemp.c, strings/apr_strings.c:
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS 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 REGENTS OR 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.
|
||||
|
||||
From network_io/unix/inet_ntop.c, network_io/unix/inet_pton.c:
|
||||
|
||||
/* Copyright (c) 1996 by Internet Software Consortium.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
|
||||
From dso/aix/dso.c:
|
||||
|
||||
* Based on libdl (dlfcn.c/dlfcn.h) which is
|
||||
* Copyright (c) 1992,1993,1995,1996,1997,1988
|
||||
* Jens-Uwe Mager, Helios Software GmbH, Hannover, Germany.
|
||||
*
|
||||
* Not derived from licensed software.
|
||||
*
|
||||
* Permission is granted to freely use, copy, modify, and redistribute
|
||||
* this software, provided that the author is not construed to be liable
|
||||
* for any results of using the software, alterations are clearly marked
|
||||
* as such, and this notice is not modified.
|
||||
|
||||
From strings/apr_strnatcmp.c, include/apr_strings.h:
|
||||
|
||||
strnatcmp.c -- Perform 'natural order' comparisons of strings in C.
|
||||
Copyright (C) 2000 by Martin Pool <mbp@humbug.org.au>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
From strings/apr_snprintf.c:
|
||||
|
||||
*
|
||||
* cvt - IEEE floating point formatting routines.
|
||||
* Derived from UNIX V7, Copyright(C) Caldera International Inc.
|
||||
*
|
||||
|
||||
Copyright(C) Caldera International Inc. 2001-2002. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
Redistributions of source code and documentation must retain the above
|
||||
copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
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.
|
||||
|
||||
All advertising materials mentioning features or use of this software
|
||||
must display the following acknowledgement:
|
||||
|
||||
This product includes software developed or owned by Caldera
|
||||
International, Inc.
|
||||
|
||||
Neither the name of Caldera International, Inc. nor the names of other
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
|
||||
INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS 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 CALDERA INTERNATIONAL, INC. 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.
|
||||
|
||||
|
129
Makefile.in
Normal file
129
Makefile.in
Normal file
@ -0,0 +1,129 @@
|
||||
|
||||
srcdir=@srcdir@
|
||||
VPATH=@srcdir@
|
||||
top_srcdir=@apr_srcdir@
|
||||
top_blddir=@apr_builddir@
|
||||
|
||||
#
|
||||
# APR (Apache Portable Runtime) library Makefile.
|
||||
#
|
||||
CPP = @CPP@
|
||||
|
||||
# get substituted into some targets
|
||||
APR_MAJOR_VERSION=@APR_MAJOR_VERSION@
|
||||
|
||||
#
|
||||
# Macros for supporting directories
|
||||
#
|
||||
INCDIR=./include
|
||||
OSDIR=$(top_srcdir)/include/arch/@OSDIR@
|
||||
DEFOSDIR=$(INCDIR)/arch/@DEFAULT_OSDIR@
|
||||
INCLUDES=-I$(INCDIR) -I$(OSDIR) -I$(DEFOSDIR) -I$(top_srcdir)/include/arch/@DEFAULT_OSDIR@ -I$(top_srcdir)/include
|
||||
|
||||
#
|
||||
# Macros for target determination
|
||||
#
|
||||
CLEAN_SUBDIRS= test
|
||||
INSTALL_SUBDIRS=@INSTALL_SUBDIRS@
|
||||
|
||||
TARGET_LIB = lib@APR_LIBNAME@.la
|
||||
APR_PCFILE = apr-$(APR_MAJOR_VERSION).pc
|
||||
APR_CONFIG = apr-$(APR_MAJOR_VERSION)-config
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
|
||||
#
|
||||
# Rules for building specific targets, starting with 'all' for
|
||||
# building the entire package.
|
||||
#
|
||||
TARGETS = $(TARGET_LIB) apr.exp apr-config.out build/apr_rules.out
|
||||
|
||||
LT_VERSION = @LT_VERSION@
|
||||
|
||||
# bring in rules.mk for standard functionality
|
||||
@INCLUDE_RULES@
|
||||
@INCLUDE_OUTPUTS@
|
||||
|
||||
CLEAN_TARGETS = apr-config.out apr.exp exports.c export_vars.c .make.dirs \
|
||||
build/apr_rules.out
|
||||
DISTCLEAN_TARGETS = config.cache config.log config.status \
|
||||
include/apr.h include/arch/unix/apr_private.h \
|
||||
libtool $(APR_CONFIG) build/apr_rules.mk apr.pc \
|
||||
build/pkg/pkginfo
|
||||
EXTRACLEAN_TARGETS = configure aclocal.m4 include/arch/unix/apr_private.h.in \
|
||||
build-outputs.mk build/ltcf-c.sh build/aclocal.m4 \
|
||||
build/ltconfig build/ltmain.sh \
|
||||
build/argz.m4 build/libtool.m4 build/ltoptions.m4 \
|
||||
build/ltsugar.m4 build/ltversion.m4 build/lt~obsolete.m4
|
||||
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
bindir=@bindir@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
installbuilddir=@installbuilddir@
|
||||
|
||||
# Create apr-config script suitable for the install tree
|
||||
apr-config.out: $(APR_CONFIG)
|
||||
sed 's,^\(location=\).*$$,\1installed,' < $(APR_CONFIG) > $@
|
||||
|
||||
# Create apr_rules.mk suitable for the install tree
|
||||
build/apr_rules.out: build/apr_rules.mk
|
||||
sed -e 's,^\(apr_build.*=\).*$$,\1$(installbuilddir),' -e 's,^\(top_build.*=\).*$$,\1$(installbuilddir),' < build/apr_rules.mk > $@
|
||||
|
||||
install: $(TARGETS)
|
||||
$(APR_MKDIR) $(DESTDIR)$(libdir) $(DESTDIR)$(bindir) $(DESTDIR)$(installbuilddir) \
|
||||
$(DESTDIR)$(libdir)/pkgconfig $(DESTDIR)$(includedir)
|
||||
$(INSTALL_DATA) $(top_blddir)/include/apr.h $(DESTDIR)$(includedir)
|
||||
for f in $(top_srcdir)/include/apr_*.h; do \
|
||||
$(INSTALL_DATA) $${f} $(DESTDIR)$(includedir); \
|
||||
done
|
||||
$(LIBTOOL) --mode=install $(INSTALL) -m 755 $(TARGET_LIB) $(DESTDIR)$(libdir)
|
||||
$(INSTALL_DATA) apr.exp $(DESTDIR)$(libdir)/apr.exp
|
||||
$(INSTALL_DATA) apr.pc $(DESTDIR)$(libdir)/pkgconfig/$(APR_PCFILE)
|
||||
for f in libtool shlibtool; do \
|
||||
if test -f $${f}; then $(INSTALL) -m 755 $${f} $(DESTDIR)$(installbuilddir); fi; \
|
||||
done
|
||||
$(INSTALL) -m 755 $(top_srcdir)/build/mkdir.sh $(DESTDIR)$(installbuilddir)
|
||||
for f in make_exports.awk make_var_export.awk; do \
|
||||
$(INSTALL_DATA) $(top_srcdir)/build/$${f} $(DESTDIR)$(installbuilddir); \
|
||||
done
|
||||
$(INSTALL_DATA) build/apr_rules.out $(DESTDIR)$(installbuilddir)/apr_rules.mk
|
||||
$(INSTALL) -m 755 apr-config.out $(DESTDIR)$(bindir)/$(APR_CONFIG)
|
||||
@if [ $(INSTALL_SUBDIRS) != "none" ]; then \
|
||||
for i in $(INSTALL_SUBDIRS); do \
|
||||
( cd $$i ; $(MAKE) DESTDIR=$(DESTDIR) install ); \
|
||||
done \
|
||||
fi
|
||||
|
||||
$(TARGET_LIB): $(OBJECTS)
|
||||
$(LINK) @lib_target@ $(ALL_LIBS)
|
||||
|
||||
exports.c: $(HEADERS)
|
||||
$(APR_MKEXPORT) $(HEADERS) > $@
|
||||
|
||||
export_vars.c: $(HEADERS)
|
||||
$(APR_MKVAREXPORT) $(HEADERS) > $@
|
||||
|
||||
apr.exp: exports.c export_vars.c
|
||||
@echo "#! lib@APR_LIBNAME@.so" > $@
|
||||
@echo "* This file was AUTOGENERATED at build time." >> $@
|
||||
@echo "* Please do not edit by hand." >> $@
|
||||
$(CPP) $(ALL_CPPFLAGS) $(ALL_INCLUDES) exports.c | grep "ap_hack_" | sed -e 's/^.*[)]\(.*\);$$/\1/' >> $@
|
||||
$(CPP) $(ALL_CPPFLAGS) $(ALL_INCLUDES) export_vars.c | sed -e 's/^\#[^!]*//' | sed -e '/^$$/d' >> $@
|
||||
|
||||
dox:
|
||||
doxygen $(top_srcdir)/docs/doxygen.conf
|
||||
|
||||
gcov:
|
||||
@build/run-gcov.sh
|
||||
|
||||
test: check
|
||||
check: $(TARGET_LIB)
|
||||
cd test && $(MAKE) all check
|
||||
|
||||
etags:
|
||||
etags `find . -name '*.[ch]'`
|
||||
|
||||
# DO NOT REMOVE
|
||||
docs: $(INCDIR)/*.h
|
181
Makefile.win
Normal file
181
Makefile.win
Normal file
@ -0,0 +1,181 @@
|
||||
# Makefile.win for Win32 APR alone
|
||||
#
|
||||
# Targets are:
|
||||
#
|
||||
# buildall - compile everything
|
||||
# checkall - run APR regression tests
|
||||
# install - compile everything
|
||||
# clean - mop up everything
|
||||
#
|
||||
# You can override the build mechansim, choose only one;
|
||||
#
|
||||
# USEMAK=1 - compile from exported make files
|
||||
# USEDSW=1 - compile from .dsw / .dsp VC6 projects
|
||||
# USESLN=1 - compile from converted .sln / .vcproj VC7+ files
|
||||
#
|
||||
# Define ARCH to your desired preference (your PATH must point
|
||||
# to the correct compiler tools!) Choose only one;
|
||||
#
|
||||
# ARCH="Win32 Release"
|
||||
# ARCH="Win32 Debug"
|
||||
# ARCH="Win32 Release9x"
|
||||
# ARCH="Win32 Debug9x"
|
||||
# ARCH="x64 Release"
|
||||
# ARCH="x64 Debug"
|
||||
#
|
||||
# For example;
|
||||
#
|
||||
# nmake -f Makefile.win PREFIX=C:\APR buildall checkall installall clean
|
||||
#
|
||||
|
||||
!IF EXIST("apr.sln") && ([devenv /help > NUL 2>&1] == 0) \
|
||||
&& !defined(USEMAK) && !defined(USEDSW)
|
||||
USESLN=1
|
||||
USEMAK=0
|
||||
USEDSW=0
|
||||
!ELSEIF EXIST("apr.mak") && !defined(USEDSW)
|
||||
USESLN=0
|
||||
USEMAK=1
|
||||
USEDSW=0
|
||||
!ELSE
|
||||
USESLN=0
|
||||
USEMAK=0
|
||||
USEDSW=1
|
||||
!ENDIF
|
||||
|
||||
PREFIX=..\apr-dist
|
||||
|
||||
!IF [$(COMSPEC) /c cl /nologo /? \
|
||||
| $(SystemRoot)\System32\find.exe "x64" >NUL ] == 0
|
||||
ARCH=x64 Release
|
||||
!ELSE
|
||||
ARCH=Win32 Release
|
||||
!ENDIF
|
||||
|
||||
!MESSAGE ARCH = $(ARCH)
|
||||
!MESSAGE PREFIX = $(PREFIX) (install path)
|
||||
|
||||
|
||||
# Utility and Translation things, nothing here for the user
|
||||
#
|
||||
!IF "$(ARCH)" == "Win32 Release"
|
||||
SLNARCH=Release|Win32
|
||||
ARCHOSPATH=Release
|
||||
LIBSOSPATH=LibR
|
||||
!ELSEIF "$(ARCH)" == "Win32 Debug"
|
||||
SLNARCH=Debug|Win32
|
||||
ARCHOSPATH=Debug
|
||||
LIBSOSPATH=LibD
|
||||
!ELSEIF "$(ARCH)" == "Win32 Release9x"
|
||||
SLNARCH=Release9x|Win32
|
||||
ARCHOSPATH=9x\Release
|
||||
LIBSOSPATH=9x\LibR
|
||||
!ELSEIF "$(ARCH)" == "Win32 Debug9x"
|
||||
SLNARCH=Debug9x|Win32
|
||||
ARCHOSPATH=9x\Debug
|
||||
LIBSOSPATH=9x\LibD
|
||||
!ELSEIF "$(ARCH)" == "x64 Release"
|
||||
SLNARCH=Release|x64
|
||||
ARCHOSPATH=x64\Release
|
||||
LIBSOSPATH=x64\LibR
|
||||
!ELSEIF "$(ARCH)" == "x64 Debug"
|
||||
SLNARCH=Debug|x64
|
||||
ARCHOSPATH=x64\Debug
|
||||
LIBSOSPATH=x64\LibD
|
||||
!ENDIF
|
||||
|
||||
!IFNDEF MAKEOPT
|
||||
# Only default the behavior if MAKEOPT= is omitted
|
||||
!IFDEF _NMAKE_VER
|
||||
# Microsoft NMake options
|
||||
MAKEOPT=-nologo
|
||||
!ELSEIF "$(MAKE)" == "make"
|
||||
# Borland make options? Not really supported (yet)
|
||||
MAKEOPT=-s -N
|
||||
!ENDIF
|
||||
!ENDIF
|
||||
|
||||
|
||||
all: buildall checkall
|
||||
|
||||
!IF $(USEMAK) == 1
|
||||
|
||||
clean:
|
||||
$(MAKE) $(MAKEOPT) -f Makefile.win ARCH="$(ARCH)" \
|
||||
CTARGET=CLEAN buildall
|
||||
|
||||
buildall:
|
||||
$(MAKE) $(MAKEOPT) -f apr.mak CFG="apr - $(ARCH)" RECURSE=0 $(CTARGET)
|
||||
$(MAKE) $(MAKEOPT) -f libapr.mak CFG="libapr - $(ARCH)" RECURSE=0 $(CTARGET)
|
||||
cd build
|
||||
$(MAKE) $(MAKEOPT) -f aprapp.mak CFG="aprapp - $(ARCH)" RECURSE=0 $(CTARGET)
|
||||
$(MAKE) $(MAKEOPT) -f libaprapp.mak CFG="libaprapp - $(ARCH)" RECURSE=0 $(CTARGET)
|
||||
cd ..
|
||||
|
||||
!ELSEIF $(USESLN) == 1
|
||||
|
||||
clean:
|
||||
-devenv apr.sln /useenv /clean "$(SLNARCH)" /project libaprapp
|
||||
-devenv apr.sln /useenv /clean "$(SLNARCH)" /project libapr
|
||||
-devenv apr.sln /useenv /clean "$(SLNARCH)" /project aprapp
|
||||
-devenv apr.sln /useenv /clean "$(SLNARCH)" /project apr
|
||||
|
||||
buildall:
|
||||
devenv apr.sln /useenv /build "$(SLNARCH)" /project apr
|
||||
devenv apr.sln /useenv /build "$(SLNARCH)" /project aprapp
|
||||
devenv apr.sln /useenv /build "$(SLNARCH)" /project libapr
|
||||
devenv apr.sln /useenv /build "$(SLNARCH)" /project libaprapp
|
||||
|
||||
!ELSE
|
||||
# $(USEDSP) == 1
|
||||
|
||||
clean:
|
||||
-msdev apr.dsw /USEENV /MAKE "libaprapp - $(ARCH)" /CLEAN
|
||||
-msdev apr.dsw /USEENV /MAKE "libapr - $(ARCH)" /CLEAN
|
||||
-msdev apr.dsw /USEENV /MAKE "aprapp - $(ARCH)" /CLEAN
|
||||
-msdev apr.dsw /USEENV /MAKE "apr - $(ARCH)" /CLEAN
|
||||
|
||||
buildall:
|
||||
@msdev apr.dsw /USEENV /MAKE "apr - $(ARCH)"
|
||||
@msdev apr.dsw /USEENV /MAKE "aprapp - $(ARCH)"
|
||||
@msdev apr.dsw /USEENV /MAKE "libapr - $(ARCH)"
|
||||
@msdev apr.dsw /USEENV /MAKE "libaprapp - $(ARCH)"
|
||||
|
||||
!ENDIF
|
||||
|
||||
|
||||
checkapr:
|
||||
cd test
|
||||
$(MAKE) $(MAKEOPT) -f Makefile.win MODEL=static \
|
||||
OUTDIR=$(LIBSOSPATH) check
|
||||
$(MAKE) $(MAKEOPT) -f Makefile.win MODEL=dynamic \
|
||||
OUTDIR=$(ARCHOSPATH) check
|
||||
cd ..
|
||||
|
||||
checkall: checkapr
|
||||
|
||||
|
||||
install:
|
||||
echo Y >.y
|
||||
echo A >.A
|
||||
@if NOT EXIST "$(PREFIX)\." mkdir "$(PREFIX)"
|
||||
@if NOT EXIST "$(PREFIX)\bin\." mkdir "$(PREFIX)\bin"
|
||||
@if NOT EXIST "$(PREFIX)\include\." mkdir "$(PREFIX)\include"
|
||||
@if NOT EXIST "$(PREFIX)\lib\." mkdir "$(PREFIX)\lib"
|
||||
copy CHANGES "$(PREFIX)\APR-CHANGES.txt" <.y
|
||||
copy LICENSE "$(PREFIX)\APR-LICENSE.txt" <.y
|
||||
copy NOTICE "$(PREFIX)\APR-NOTICE.txt" <.y
|
||||
xcopy include\*.h "$(PREFIX)\include\" /d < .a
|
||||
copy $(LIBSOSPATH)\apr-1.lib "$(PREFIX)\lib\" <.y
|
||||
copy $(LIBSOSPATH)\apr-1.pdb "$(PREFIX)\lib\" <.y
|
||||
copy $(LIBSOSPATH)\aprapp-1.lib "$(PREFIX)\lib\" <.y
|
||||
copy $(LIBSOSPATH)\aprapp-1.pdb "$(PREFIX)\lib\" <.y
|
||||
copy $(ARCHOSPATH)\libaprapp-1.lib "$(PREFIX)\lib\" <.y
|
||||
copy $(ARCHOSPATH)\libaprapp-1.pdb "$(PREFIX)\lib\" <.y
|
||||
copy $(ARCHOSPATH)\libapr-1.lib "$(PREFIX)\lib\" <.y
|
||||
copy $(ARCHOSPATH)\libapr-1.exp "$(PREFIX)\lib\" <.y
|
||||
copy $(ARCHOSPATH)\libapr-1.dll "$(PREFIX)\bin\" <.y
|
||||
copy $(ARCHOSPATH)\libapr-1.pdb "$(PREFIX)\bin\" <.y
|
||||
del .y
|
||||
del .a
|
||||
|
15
NOTICE
Normal file
15
NOTICE
Normal file
@ -0,0 +1,15 @@
|
||||
Apache Portable Runtime
|
||||
Copyright (c) 2011 The Apache Software Foundation.
|
||||
|
||||
This product includes software developed by
|
||||
The Apache Software Foundation (http://www.apache.org/).
|
||||
|
||||
Portions of this software were developed at the National Center
|
||||
for Supercomputing Applications (NCSA) at the University of
|
||||
Illinois at Urbana-Champaign.
|
||||
|
||||
This software contains code derived from the RSA Data Security
|
||||
Inc. MD5 Message-Digest Algorithm.
|
||||
|
||||
This software contains code derived from UNIX V7, Copyright(C)
|
||||
Caldera International Inc.
|
430
NWGNUmakefile
Normal file
430
NWGNUmakefile
Normal file
@ -0,0 +1,430 @@
|
||||
#
|
||||
# Define our macros with defaults if we dont got them already.
|
||||
#
|
||||
ifndef APR_WORK
|
||||
export APR_WORK = $(CURDIR)
|
||||
endif
|
||||
ifneq "$(wildcard $(APR_WORK)/include/apr_version.h)" "$(APR_WORK)/include/apr_version.h"
|
||||
$(error APR_WORK does not point to a valid APR source tree)
|
||||
endif
|
||||
ifndef APU_WORK
|
||||
export APU_WORK = $(CURDIR)/../apr-util
|
||||
endif
|
||||
ifneq "$(wildcard $(APU_WORK)/include/apu_version.h)" "$(APU_WORK)/include/apu_version.h"
|
||||
$(error APU_WORK does not point to a valid APU source tree)
|
||||
endif
|
||||
|
||||
#
|
||||
# Declare the sub-directories to be built here
|
||||
#
|
||||
|
||||
SUBDIRS = \
|
||||
build \
|
||||
$(APU_WORK) \
|
||||
$(EOLIST)
|
||||
|
||||
ifeq "$(TEST)" "1"
|
||||
SUBDIRS += \
|
||||
test \
|
||||
$(APU_WORK)/test \
|
||||
$(EOLIST)
|
||||
endif
|
||||
|
||||
#
|
||||
# Get the 'head' of the build environment. This includes default targets and
|
||||
# paths to tools
|
||||
#
|
||||
|
||||
include $(APR_WORK)/build/NWGNUhead.inc
|
||||
|
||||
#
|
||||
# build this level's files
|
||||
|
||||
#
|
||||
# Make sure all needed macro's are defined
|
||||
#
|
||||
|
||||
#
|
||||
# These directories will be at the beginning of the include list, followed by
|
||||
# INCDIRS
|
||||
#
|
||||
XINCDIRS += \
|
||||
$(APR)/include \
|
||||
$(APR)/include/arch/NetWare \
|
||||
$(APR)/include/arch/unix \
|
||||
$(APR)/memory/unix \
|
||||
$(APR)/random/unix \
|
||||
$(APU)/include \
|
||||
$(APU)/xml \
|
||||
$(LDAPSDK)/inc \
|
||||
$(EOLIST)
|
||||
|
||||
#
|
||||
# These flags will come after CFLAGS
|
||||
#
|
||||
XCFLAGS += \
|
||||
$(EOLIST)
|
||||
|
||||
#
|
||||
# These defines will come after DEFINES
|
||||
#
|
||||
XDEFINES += \
|
||||
$(EOLIST)
|
||||
|
||||
#
|
||||
# These flags will be added to the link.opt file
|
||||
#
|
||||
XLFLAGS += \
|
||||
$(EOLIST)
|
||||
|
||||
#
|
||||
# These values will be appended to the correct variables based on the value of
|
||||
# RELEASE
|
||||
#
|
||||
ifeq "$(RELEASE)" "debug"
|
||||
XINCDIRS += \
|
||||
$(EOLIST)
|
||||
|
||||
XCFLAGS += \
|
||||
$(EOLIST)
|
||||
|
||||
XDEFINES += \
|
||||
$(EOLIST)
|
||||
|
||||
XLFLAGS += \
|
||||
$(EOLIST)
|
||||
endif
|
||||
|
||||
ifeq "$(RELEASE)" "noopt"
|
||||
XINCDIRS += \
|
||||
$(EOLIST)
|
||||
|
||||
XCFLAGS += \
|
||||
$(EOLIST)
|
||||
|
||||
XDEFINES += \
|
||||
$(EOLIST)
|
||||
|
||||
XLFLAGS += \
|
||||
$(EOLIST)
|
||||
endif
|
||||
|
||||
ifeq "$(RELEASE)" "release"
|
||||
XINCDIRS += \
|
||||
$(EOLIST)
|
||||
|
||||
XCFLAGS += \
|
||||
$(EOLIST)
|
||||
|
||||
XDEFINES += \
|
||||
$(EOLIST)
|
||||
|
||||
XLFLAGS += \
|
||||
$(EOLIST)
|
||||
endif
|
||||
|
||||
#
|
||||
# These are used by the link target if an NLM is being generated
|
||||
# This is used by the link 'name' directive to name the nlm. If left blank
|
||||
# TARGET_nlm (see below) will be used.
|
||||
#
|
||||
NLM_NAME = aprlib
|
||||
|
||||
#
|
||||
# This is used by the link '-desc ' directive.
|
||||
# If left blank, NLM_NAME will be used.
|
||||
#
|
||||
NLM_DESCRIPTION = Apache Portability Runtime Library $(VERSION_STR) $(VERSION_SKT)
|
||||
|
||||
#
|
||||
# This is used by the '-threadname' directive. If left blank,
|
||||
# NLM_NAME Thread will be used.
|
||||
#
|
||||
NLM_THREAD_NAME =
|
||||
#
|
||||
# If this is specified, it will override VERSION value in
|
||||
# $(APR_WORK)/build/NWGNUenvironment.inc
|
||||
#
|
||||
NLM_VERSION =
|
||||
|
||||
#
|
||||
# If this is specified, it will override the default of 64K
|
||||
#
|
||||
NLM_STACK_SIZE =
|
||||
|
||||
#
|
||||
# If this is specified it will be used by the link '-entry' directive
|
||||
#
|
||||
NLM_ENTRY_SYM =
|
||||
|
||||
#
|
||||
# If this is specified it will be used by the link '-exit' directive
|
||||
#
|
||||
NLM_EXIT_SYM =
|
||||
|
||||
#
|
||||
# If this is specified it will be used by the link '-check' directive
|
||||
#
|
||||
NLM_CHECK_SYM =
|
||||
|
||||
#
|
||||
# If this is specified it will be used by the link '-flags' directive
|
||||
#
|
||||
NLM_FLAGS =
|
||||
|
||||
#
|
||||
# If this is specified it will be linked in with the XDCData option in the def
|
||||
# file instead of the default of $(APR)/misc/netware/apache.xdc. XDCData can
|
||||
# be disabled by setting APACHE_UNIPROC in the environment
|
||||
#
|
||||
XDCDATA =
|
||||
|
||||
#
|
||||
# Declare all target files (you must add your files here)
|
||||
#
|
||||
|
||||
#
|
||||
# If there is an NLM target, put it here
|
||||
#
|
||||
TARGET_nlm = \
|
||||
$(OBJDIR)/aprlib.nlm \
|
||||
$(EOLIST)
|
||||
|
||||
#
|
||||
# If there is an LIB target, put it here
|
||||
#
|
||||
TARGET_lib = \
|
||||
$(OBJDIR)/aprlib.lib \
|
||||
$(EOLIST)
|
||||
|
||||
#
|
||||
# These are the OBJ files needed to create the NLM target above.
|
||||
# Paths must all use the '/' character
|
||||
#
|
||||
FILES_nlm_objs = \
|
||||
$(OBJDIR)/libprews.o \
|
||||
$(EOLIST)
|
||||
|
||||
#
|
||||
# These are the LIB files needed to create the NLM target above.
|
||||
# These will be added as a library command in the link.opt file.
|
||||
#
|
||||
FILES_nlm_libs = \
|
||||
$(PRELUDE) \
|
||||
$(APRLIB) \
|
||||
$(APULIB) \
|
||||
$(APULDAPLIB) \
|
||||
$(APUXMLLIB) \
|
||||
$(EOLIST)
|
||||
|
||||
#
|
||||
# These are the modules that the above NLM target depends on to load.
|
||||
# These will be added as a module command in the link.opt file.
|
||||
#
|
||||
FILES_nlm_modules = \
|
||||
Libc \
|
||||
$(EOLIST)
|
||||
|
||||
# Include the Winsock libraries if Winsock is being used
|
||||
ifndef USE_STDSOCKETS
|
||||
FILES_nlm_modules += ws2_32 \
|
||||
$(EOLIST)
|
||||
endif
|
||||
|
||||
#If the LDAP support is defined then add the auto-load modules
|
||||
ifneq "$(LDAPSDK)" ""
|
||||
FILES_nlm_modules += \
|
||||
lldapsdk \
|
||||
lldapssl \
|
||||
$(EOLIST)
|
||||
endif
|
||||
|
||||
#
|
||||
# If the nlm has a msg file, put it's path here
|
||||
#
|
||||
FILE_nlm_msg =
|
||||
|
||||
#
|
||||
# If the nlm has a hlp file put it's path here
|
||||
#
|
||||
FILE_nlm_hlp =
|
||||
|
||||
#
|
||||
# If this is specified, it will override $(NWOS)\copyright.txt.
|
||||
#
|
||||
FILE_nlm_copyright =
|
||||
|
||||
#
|
||||
# Any additional imports go here
|
||||
#
|
||||
FILES_nlm_Ximports = \
|
||||
@libc.imp \
|
||||
@netware.imp \
|
||||
$(EOLIST)
|
||||
|
||||
# Include the Winsock imports if Winsock is being used
|
||||
ifndef USE_STDSOCKETS
|
||||
FILES_nlm_Ximports += \
|
||||
@ws2nlm.imp \
|
||||
WSAStartupRTags \
|
||||
WSACleanupRTag \
|
||||
$(EOLIST)
|
||||
endif
|
||||
|
||||
#If the LDAP support is defined then add the imports
|
||||
ifneq "$(LDAPSDK)" ""
|
||||
FILES_nlm_Ximports += \
|
||||
@lldapsdk.imp \
|
||||
@lldapssl.imp \
|
||||
$(EOLIST)
|
||||
endif
|
||||
|
||||
#
|
||||
# Any symbols exported to here
|
||||
#
|
||||
FILES_nlm_exports = \
|
||||
@aprlib.imp \
|
||||
$(EOLIST)
|
||||
|
||||
#
|
||||
# These are the OBJ files needed to create the LIB target above.
|
||||
# Paths must all use the '/' character
|
||||
#
|
||||
FILES_lib_objs = \
|
||||
$(OBJDIR)/apr_atomic.o \
|
||||
$(OBJDIR)/apr_cpystrn.o \
|
||||
$(OBJDIR)/apr_fnmatch.o \
|
||||
$(OBJDIR)/apr_getpass.o \
|
||||
$(OBJDIR)/apr_hash.o \
|
||||
$(OBJDIR)/apr_pools.o \
|
||||
$(OBJDIR)/apr_random.o \
|
||||
$(OBJDIR)/apr_snprintf.o \
|
||||
$(OBJDIR)/apr_strings.o \
|
||||
$(OBJDIR)/apr_strnatcmp.o \
|
||||
$(OBJDIR)/apr_strtok.o \
|
||||
$(OBJDIR)/apr_tables.o \
|
||||
$(OBJDIR)/buffer.o \
|
||||
$(OBJDIR)/charset.o \
|
||||
$(OBJDIR)/copy.o \
|
||||
$(OBJDIR)/common.o \
|
||||
$(OBJDIR)/dir.o \
|
||||
$(OBJDIR)/dso.o \
|
||||
$(OBJDIR)/errorcodes.o \
|
||||
$(OBJDIR)/env.o \
|
||||
$(OBJDIR)/fileacc.o \
|
||||
$(OBJDIR)/filedup.o \
|
||||
$(OBJDIR)/filepath.o \
|
||||
$(OBJDIR)/filepath_util.o \
|
||||
$(OBJDIR)/filestat.o \
|
||||
$(OBJDIR)/filesys.o \
|
||||
$(OBJDIR)/flock.o \
|
||||
$(OBJDIR)/fullrw.o \
|
||||
$(OBJDIR)/getopt.o \
|
||||
$(OBJDIR)/groupinfo.o \
|
||||
$(OBJDIR)/inet_pton.o \
|
||||
$(OBJDIR)/inet_ntop.o \
|
||||
$(OBJDIR)/mktemp.o \
|
||||
$(OBJDIR)/mmap.o \
|
||||
$(OBJDIR)/multicast.o \
|
||||
$(OBJDIR)/open.o \
|
||||
$(OBJDIR)/pipe.o \
|
||||
$(OBJDIR)/otherchild.o \
|
||||
$(OBJDIR)/proc.o \
|
||||
$(OBJDIR)/procsup.o \
|
||||
$(OBJDIR)/proc_mutex.o \
|
||||
$(OBJDIR)/rand.o \
|
||||
$(OBJDIR)/readwrite.o \
|
||||
$(OBJDIR)/seek.o \
|
||||
$(OBJDIR)/pollcb.o \
|
||||
$(OBJDIR)/pollset.o \
|
||||
$(OBJDIR)/select.o \
|
||||
$(OBJDIR)/sendrecv.o \
|
||||
$(OBJDIR)/sha2.o \
|
||||
$(OBJDIR)/sha2_glue.o \
|
||||
$(OBJDIR)/shm.o \
|
||||
$(OBJDIR)/signals.o \
|
||||
$(OBJDIR)/sockaddr.o \
|
||||
$(OBJDIR)/socket_util.o \
|
||||
$(OBJDIR)/sockets.o \
|
||||
$(OBJDIR)/sockopt.o \
|
||||
$(OBJDIR)/start.o \
|
||||
$(OBJDIR)/tempdir.o \
|
||||
$(OBJDIR)/thread.o \
|
||||
$(OBJDIR)/thread_cond.o \
|
||||
$(OBJDIR)/thread_mutex.o \
|
||||
$(OBJDIR)/thread_rwlock.o \
|
||||
$(OBJDIR)/threadpriv.o \
|
||||
$(OBJDIR)/time.o \
|
||||
$(OBJDIR)/timestr.o \
|
||||
$(OBJDIR)/userinfo.o \
|
||||
$(OBJDIR)/version.o \
|
||||
$(OBJDIR)/waitio.o \
|
||||
$(EOLIST)
|
||||
|
||||
|
||||
#
|
||||
# implement targets and dependancies (leave this section alone)
|
||||
#
|
||||
|
||||
libs :: $(OBJDIR) $(TARGET_lib)
|
||||
|
||||
nlms :: libs $(TARGET_nlm)
|
||||
|
||||
#
|
||||
# Updated this target to create necessary directories and copy files to the
|
||||
# correct place. (See $(APR_WORK)/build/NWGNUhead.inc for examples)
|
||||
#
|
||||
install :: nlms $(INSTDIRS) FORCE
|
||||
$(call COPY,$(APR)/$(TARGET_nlm),$(INSTALLBASE)/)
|
||||
ifndef DEST
|
||||
-$(call COPY,$(APR)/LICENSE,$(INSTALLBASE)/)
|
||||
-$(call COPY,$(APR)/STATUS,$(INSTALLBASE)/STATUS.apr)
|
||||
-$(call COPY,$(APR)/CHANGES,$(INSTALLBASE)/CHANGES.apr)
|
||||
-$(call COPY,$(APU)/STATUS,$(INSTALLBASE)/STATUS.apu)
|
||||
-$(call COPY,$(APU)/CHANGES,$(INSTALLBASE)/CHANGES.apu)
|
||||
-$(call COPYR,$(APR)/docs,$(INSTALLBASE)/docs/)
|
||||
endif
|
||||
|
||||
ifndef DEST
|
||||
installdev :: $(INSTDEVDIRS) FORCE
|
||||
$(call COPY,$(APR)/include/*.h,$(INSTALLBASE)/include/)
|
||||
$(call COPY,$(APR)/*.imp,$(INSTALLBASE)/lib/)
|
||||
$(call COPY,$(APR)/misc/netware/*.xdc,$(INSTALLBASE)/lib/)
|
||||
$(call COPY,$(APR)/$(TARGET_nlm),$(INSTALLBASE)/bin/)
|
||||
$(call COPY,$(APRLIB),$(INSTALLBASE)/lib/)
|
||||
$(call COPY,$(APULIB),$(INSTALLBASE)/lib/)
|
||||
$(call COPY,$(APULDAPLIB),$(INSTALLBASE)/lib/)
|
||||
$(call COPY,$(APUXMLLIB),$(INSTALLBASE)/lib/)
|
||||
|
||||
$(INSTDEVDIRS) ::
|
||||
$(call MKDIR,$@)
|
||||
endif
|
||||
|
||||
#
|
||||
# Any specialized rules here
|
||||
#
|
||||
|
||||
vpath %.c atomic/netware:strings:tables:passwd:lib:time/unix
|
||||
vpath %.c file_io/unix:locks/netware:misc/netware:misc/unix:threadproc/netware
|
||||
vpath %.c poll/unix:shmem/unix:support/unix:random/unix
|
||||
vpath %.c dso/netware:memory/unix:mmap/unix:user/netware
|
||||
|
||||
# Use the win32 network_io if Winsock is being used
|
||||
ifndef USE_STDSOCKETS
|
||||
vpath %.c network_io/win32
|
||||
endif
|
||||
vpath %.c network_io/unix
|
||||
|
||||
$(OBJDIR)/%.o: file_io/netware/%.c $(OBJDIR)/$(NLM_NAME)_cc.opt
|
||||
# @echo Compiling $<
|
||||
@echo $(DL)CC $<$(DL)
|
||||
$(CC) $< -cwd source -o=$@ @$(OBJDIR)/$(NLM_NAME)_cc.opt
|
||||
|
||||
#
|
||||
# Include the 'tail' makefile that has targets that depend on variables defined
|
||||
# in this makefile
|
||||
#
|
||||
|
||||
include $(APRBUILD)/NWGNUtail.inc
|
||||
|
||||
|
167
README
Normal file
167
README
Normal file
@ -0,0 +1,167 @@
|
||||
Apache Portable Runtime Library (APR)
|
||||
-------------------------------------
|
||||
|
||||
The Apache Portable Runtime Library provides a predictable and
|
||||
consistent interface to underlying platform-specific
|
||||
implementations, with an API to which software developers may code
|
||||
and be assured of predictable if not identical behavior regardless
|
||||
of the platform on which their software is built, relieving them of
|
||||
the need to code special-case conditions to work around or take
|
||||
advantage of platform-specific deficiencies or features.
|
||||
|
||||
APR and its companion libraries are implemented entirely in C
|
||||
and provide a common programming interface across a wide variety
|
||||
of operating system platforms without sacrificing performance.
|
||||
Currently supported platforms include:
|
||||
|
||||
UNIX variants
|
||||
Windows
|
||||
Netware
|
||||
Mac OS X
|
||||
OS/2
|
||||
|
||||
To give a brief overview, the primary core
|
||||
subsystems of APR 1.3 include the following:
|
||||
|
||||
Atomic operations
|
||||
Dynamic Shared Object loading
|
||||
File I/O
|
||||
Locks (mutexes, condition variables, etc)
|
||||
Memory management (high performance allocators)
|
||||
Memory-mapped files
|
||||
Multicast Sockets
|
||||
Network I/O
|
||||
Shared memory
|
||||
Thread and Process management
|
||||
Various data structures (tables, hashes, priority queues, etc)
|
||||
|
||||
For a more complete list, please refer to the following URLs:
|
||||
|
||||
http://apr.apache.org/docs/apr/modules.html
|
||||
|
||||
Users of APR 0.9 should be aware that migrating to the APR 1.x
|
||||
programming interfaces may require some adjustments; APR 1.x is
|
||||
neither source nor binary compatible with earlier APR 0.9 releases.
|
||||
Users of APR 1.x can expect consistent interfaces and binary backwards
|
||||
compatibility throughout the entire APR 1.x release cycle, as defined
|
||||
in our versioning rules:
|
||||
|
||||
http://apr.apache.org/versioning.html
|
||||
|
||||
APR is already used extensively by the Apache HTTP Server
|
||||
version 2 and the Subversion revision control system, to
|
||||
name but a few. We list all known projects using APR at
|
||||
http://apr.apache.org/projects.html -- so please let us know
|
||||
if you find our libraries useful in your own projects!
|
||||
|
||||
|
||||
Using a Subversion Checkout on Unix
|
||||
===================================
|
||||
|
||||
If you are building APR from SVN, you need to perform a prerequisite
|
||||
step. You must have autoconf, libtool and python installed for this
|
||||
to work. The prerequisite is simply;
|
||||
|
||||
./buildconf
|
||||
|
||||
If you are building APR from a distribution tarball, buildconf is
|
||||
already run for you, and you do not need autoconf, libtool or python
|
||||
installed or to run buildconf unless you have patched APR's buildconf
|
||||
inputs (such as configure.in, build.conf, virtually any file within
|
||||
the build/ tree, or you add or remove source files).
|
||||
|
||||
Remember when updating from svn that you must rerun ./buildconf again
|
||||
to effect any changes made to the build schema in your fresh update.
|
||||
|
||||
|
||||
Configuring and Building APR on Unix
|
||||
====================================
|
||||
|
||||
Simply;
|
||||
|
||||
./configure --prefix=/desired/path/of/apr
|
||||
make
|
||||
make test
|
||||
make install
|
||||
|
||||
Configure has additional options, ./configure --help will offer you
|
||||
those choices. You may also add CC=compiler CFLAGS="compiler flags"
|
||||
etc. prior to the ./configure statement (on the same line). Please
|
||||
be warned, some flags must be passed as part of the CC command,
|
||||
itself, in order for autoconf to make the right determinations. Eg.;
|
||||
|
||||
CC="gcc -m64" ./configure --prefix=/desired/path/of/apr
|
||||
|
||||
will inform APR that you are compiling to a 64 bit CPU, and autoconf
|
||||
must consider that when setting up all of APR's internal and external
|
||||
type declarations.
|
||||
|
||||
For more verbose output from testall, you may wish to invoke testall
|
||||
with the flag;
|
||||
|
||||
cd test
|
||||
./testall -v
|
||||
|
||||
|
||||
Building APR RPM files on Linux
|
||||
===============================
|
||||
|
||||
Run the following to create SRPMs:
|
||||
|
||||
rpmbuild -ts apr-<version>.tar.bz2
|
||||
rpmbuild -ts apr-util-<version>.tar.bz2
|
||||
|
||||
Run the following to create RPMs (or build from the SRPMs):
|
||||
|
||||
rpmbuild -tb apr-<version>.tar.bz2
|
||||
rpmbuild -tb apr-util-<version>.tar.bz2
|
||||
|
||||
Resolve dependencies as appropriate.
|
||||
|
||||
|
||||
Configuring and Building APR on Windows
|
||||
=======================================
|
||||
|
||||
Using Visual Studio, you can build and run the test validation of APR.
|
||||
The Makefile.win make file has a bunch of documentation about it's
|
||||
options, but a trivial build is simply;
|
||||
|
||||
nmake -f Makefile.win
|
||||
nmake -f Makefile.win PREFIX=c:\desired\path\of\apr install
|
||||
|
||||
Note you must manually modify the include\apr.hw file before you
|
||||
build to change default options, see the #define APR_HAS_... or the
|
||||
#define APR_HAVE_... statements. Be careful, many of these aren't
|
||||
appropriate to be modified. The most common change is
|
||||
|
||||
#define APR_HAVE_IPV6 1
|
||||
|
||||
rather than 0 if this build of APR will be used strictly on machines
|
||||
with the IPv6 adapter support installed.
|
||||
|
||||
It's trivial to include the apr.dsp (for a static library) or the
|
||||
libapr.dsp (for a dynamic library) in your own build project, or you
|
||||
can load apr.dsw in Visual Studio 2002 (.NET) or later, which will
|
||||
convert these for you into apr.sln and associated .vcproj files.
|
||||
|
||||
When using APR as a dynamic library, nothing special is required,
|
||||
simply link to libapr.lib. To use it as a static library, simply
|
||||
define APR_DECLARE_STATIC before you include any apr header files
|
||||
in your source, and link to apr.lib instead.
|
||||
|
||||
|
||||
Generating Test Coverage information with gcc
|
||||
=============================================
|
||||
|
||||
If you want to generate test coverage data, use the following steps:
|
||||
|
||||
./buildconf
|
||||
CFLAGS="-fprofile-arcs -ftest-coverage" ./configure
|
||||
make
|
||||
cd test
|
||||
make
|
||||
./testall
|
||||
cd ..
|
||||
make gcov
|
||||
|
||||
|
251
apr-config.in
Normal file
251
apr-config.in
Normal file
@ -0,0 +1,251 @@
|
||||
#!/bin/sh
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
# (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
# APR script designed to allow easy command line access to APR configuration
|
||||
# parameters.
|
||||
|
||||
APR_MAJOR_VERSION="@APR_MAJOR_VERSION@"
|
||||
APR_DOTTED_VERSION="@APR_DOTTED_VERSION@"
|
||||
|
||||
prefix="@prefix@"
|
||||
exec_prefix="@exec_prefix@"
|
||||
bindir="@bindir@"
|
||||
libdir="@libdir@"
|
||||
datarootdir="@datadir@"
|
||||
datadir="@datadir@"
|
||||
installbuilddir="@installbuilddir@"
|
||||
includedir="@includedir@"
|
||||
|
||||
CC="@CC@"
|
||||
CPP="@CPP@"
|
||||
SHELL="@SHELL@"
|
||||
CPPFLAGS="@EXTRA_CPPFLAGS@"
|
||||
CFLAGS="@EXTRA_CFLAGS@"
|
||||
LDFLAGS="@EXTRA_LDFLAGS@"
|
||||
LIBS="@EXTRA_LIBS@"
|
||||
EXTRA_INCLUDES="@EXTRA_INCLUDES@"
|
||||
SHLIBPATH_VAR="@shlibpath_var@"
|
||||
APR_SOURCE_DIR="@apr_srcdir@"
|
||||
APR_BUILD_DIR="@apr_builddir@"
|
||||
APR_SO_EXT="@so_ext@"
|
||||
APR_LIB_TARGET="@export_lib_target@"
|
||||
APR_LIBNAME="@APR_LIBNAME@"
|
||||
|
||||
# NOTE: the following line is modified during 'make install': alter with care!
|
||||
location=@APR_CONFIG_LOCATION@
|
||||
|
||||
show_usage()
|
||||
{
|
||||
cat << EOF
|
||||
Usage: apr-$APR_MAJOR_VERSION-config [OPTION]
|
||||
|
||||
Known values for OPTION are:
|
||||
--prefix[=DIR] change prefix to DIR
|
||||
--bindir print location where binaries are installed
|
||||
--includedir print location where headers are installed
|
||||
--cc print C compiler name
|
||||
--cpp print C preprocessor name and any required options
|
||||
--cflags print C compiler flags
|
||||
--cppflags print C preprocessor flags
|
||||
--includes print include information
|
||||
--ldflags print linker flags
|
||||
--libs print additional libraries to link against
|
||||
--srcdir print APR source directory
|
||||
--installbuilddir print APR build helper directory
|
||||
--link-ld print link switch(es) for linking to APR
|
||||
--link-libtool print the libtool inputs for linking to APR
|
||||
--shlib-path-var print the name of the shared library path env var
|
||||
--apr-la-file print the path to the .la file, if available
|
||||
--apr-so-ext print the extensions of shared objects on this platform
|
||||
--apr-lib-target print the libtool target information
|
||||
--apr-libtool print the path to APR's libtool
|
||||
--version print the APR's version as a dotted triple
|
||||
--help print this help
|
||||
|
||||
When linking with libtool, an application should do something like:
|
||||
APR_LIBS="\`apr-$APR_MAJOR_VERSION-config --link-libtool --libs\`"
|
||||
or when linking directly:
|
||||
APR_LIBS="\`apr-$APR_MAJOR_VERSION-config --link-ld --libs\`"
|
||||
|
||||
An application should use the results of --cflags, --cppflags, --includes,
|
||||
and --ldflags in their build process.
|
||||
EOF
|
||||
}
|
||||
|
||||
if test $# -eq 0; then
|
||||
show_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test "$location" = "installed"; then
|
||||
LA_FILE="$libdir/lib${APR_LIBNAME}.la"
|
||||
else
|
||||
LA_FILE="$APR_BUILD_DIR/lib${APR_LIBNAME}.la"
|
||||
fi
|
||||
|
||||
flags=""
|
||||
|
||||
while test $# -gt 0; do
|
||||
# Normalize the prefix.
|
||||
case "$1" in
|
||||
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
|
||||
*) optarg= ;;
|
||||
esac
|
||||
|
||||
case "$1" in
|
||||
# It is possible for the user to override our prefix.
|
||||
--prefix=*)
|
||||
prefix=$optarg
|
||||
;;
|
||||
--prefix)
|
||||
echo $prefix
|
||||
exit 0
|
||||
;;
|
||||
--bindir)
|
||||
echo $bindir
|
||||
exit 0
|
||||
;;
|
||||
--includedir)
|
||||
if test "$location" = "installed"; then
|
||||
flags="$includedir"
|
||||
elif test "$location" = "source"; then
|
||||
flags="$APR_SOURCE_DIR/include"
|
||||
else
|
||||
# this is for VPATH builds
|
||||
flags="$APR_BUILD_DIR/include $APR_SOURCE_DIR/include"
|
||||
fi
|
||||
echo $flags
|
||||
exit 0
|
||||
;;
|
||||
--cc)
|
||||
echo $CC
|
||||
exit 0
|
||||
;;
|
||||
--cpp)
|
||||
echo $CPP
|
||||
exit 0
|
||||
;;
|
||||
--cflags)
|
||||
flags="$flags $CFLAGS"
|
||||
;;
|
||||
--cppflags)
|
||||
flags="$flags $CPPFLAGS"
|
||||
;;
|
||||
--libs)
|
||||
flags="$flags $LIBS"
|
||||
;;
|
||||
--ldflags)
|
||||
flags="$flags $LDFLAGS"
|
||||
;;
|
||||
--includes)
|
||||
if test "$location" = "installed"; then
|
||||
flags="$flags -I$includedir $EXTRA_INCLUDES"
|
||||
elif test "$location" = "source"; then
|
||||
flags="$flags -I$APR_SOURCE_DIR/include $EXTRA_INCLUDES"
|
||||
else
|
||||
# this is for VPATH builds
|
||||
flags="$flags -I$APR_BUILD_DIR/include -I$APR_SOURCE_DIR/include $EXTRA_INCLUDES"
|
||||
fi
|
||||
;;
|
||||
--srcdir)
|
||||
echo $APR_SOURCE_DIR
|
||||
exit 0
|
||||
;;
|
||||
--installbuilddir)
|
||||
if test "$location" = "installed"; then
|
||||
echo "${installbuilddir}"
|
||||
elif test "$location" = "source"; then
|
||||
echo "$APR_SOURCE_DIR/build"
|
||||
else
|
||||
# this is for VPATH builds
|
||||
echo "$APR_BUILD_DIR/build"
|
||||
fi
|
||||
exit 0
|
||||
;;
|
||||
--version)
|
||||
echo $APR_DOTTED_VERSION
|
||||
exit 0
|
||||
;;
|
||||
--link-ld)
|
||||
if test "$location" = "installed"; then
|
||||
### avoid using -L if libdir is a "standard" location like /usr/lib
|
||||
flags="$flags -L$libdir -l${APR_LIBNAME}"
|
||||
else
|
||||
### this surely can't work since the library is in .libs?
|
||||
flags="$flags -L$APR_BUILD_DIR -l${APR_LIBNAME}"
|
||||
fi
|
||||
;;
|
||||
--link-libtool)
|
||||
# If the LA_FILE exists where we think it should be, use it. If we're
|
||||
# installed and the LA_FILE does not exist, assume to use -L/-l
|
||||
# (the LA_FILE may not have been installed). If we're building ourselves,
|
||||
# we'll assume that at some point the .la file be created.
|
||||
if test -f "$LA_FILE"; then
|
||||
flags="$flags $LA_FILE"
|
||||
elif test "$location" = "installed"; then
|
||||
### avoid using -L if libdir is a "standard" location like /usr/lib
|
||||
# Since the user is specifying they are linking with libtool, we
|
||||
# *know* that -R will be recognized by libtool.
|
||||
flags="$flags -L$libdir -R$libdir -l${APR_LIBNAME}"
|
||||
else
|
||||
flags="$flags $LA_FILE"
|
||||
fi
|
||||
;;
|
||||
--shlib-path-var)
|
||||
echo "$SHLIBPATH_VAR"
|
||||
exit 0
|
||||
;;
|
||||
--apr-la-file)
|
||||
if test -f "$LA_FILE"; then
|
||||
flags="$flags $LA_FILE"
|
||||
fi
|
||||
;;
|
||||
--apr-so-ext)
|
||||
echo "$APR_SO_EXT"
|
||||
exit 0
|
||||
;;
|
||||
--apr-lib-target)
|
||||
echo "$APR_LIB_TARGET"
|
||||
exit 0
|
||||
;;
|
||||
--apr-libtool)
|
||||
if test "$location" = "installed"; then
|
||||
echo "${installbuilddir}/libtool"
|
||||
else
|
||||
echo "$APR_BUILD_DIR/libtool"
|
||||
fi
|
||||
exit 0
|
||||
;;
|
||||
--help)
|
||||
show_usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
show_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Next please.
|
||||
shift
|
||||
done
|
||||
|
||||
if test -n "$flags"; then
|
||||
echo "$flags"
|
||||
fi
|
||||
|
||||
exit 0
|
558
apr.dep
Normal file
558
apr.dep
Normal file
@ -0,0 +1,558 @@
|
||||
# Microsoft Developer Studio Generated Dependency File, included by apr.mak
|
||||
|
||||
.\atomic\win32\apr_atomic.c : \
|
||||
".\include\apr_atomic.h"\
|
||||
|
||||
|
||||
.\dso\win32\dso.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
".\include\arch\win32\apr_arch_dso.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\file_io\win32\buffer.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\file_io\unix\copy.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\file_io\win32\dir.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
".\include\arch\win32\apr_arch_atime.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\file_io\unix\fileacc.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\file_io\win32\filedup.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_inherit.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\file_io\win32\filepath.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\file_io\unix\filepath_util.c : \
|
||||
".\include\apr_strings.h"\
|
||||
|
||||
|
||||
.\file_io\win32\filestat.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
".\include\arch\win32\apr_arch_atime.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\file_io\win32\filesys.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\file_io\win32\flock.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\file_io\unix\fullrw.c : \
|
||||
|
||||
|
||||
.\file_io\unix\mktemp.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_inherit.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\file_io\win32\open.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_inherit.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\file_io\win32\pipe.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\file_io\win32\readwrite.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
".\include\arch\win32\apr_arch_atime.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\file_io\win32\seek.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\file_io\unix\tempdir.c : \
|
||||
".\include\apr_env.h"\
|
||||
".\include\apr_strings.h"\
|
||||
|
||||
|
||||
.\locks\win32\proc_mutex.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_proc_mutex.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\locks\win32\thread_cond.c : \
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
".\include\apr_thread_cond.h"\
|
||||
".\include\arch\win32\apr_arch_thread_cond.h"\
|
||||
".\include\arch\win32\apr_arch_thread_mutex.h"\
|
||||
|
||||
|
||||
.\locks\win32\thread_mutex.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
".\include\arch\win32\apr_arch_thread_mutex.h"\
|
||||
|
||||
|
||||
.\locks\win32\thread_rwlock.c : \
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
".\include\apr_thread_rwlock.h"\
|
||||
".\include\arch\win32\apr_arch_thread_rwlock.h"\
|
||||
|
||||
|
||||
.\memory\unix\apr_pools.c : \
|
||||
".\include\apr_atomic.h"\
|
||||
".\include\apr_env.h"\
|
||||
".\include\apr_hash.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
|
||||
|
||||
.\misc\win32\charset.c : \
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
|
||||
|
||||
.\misc\win32\env.c : \
|
||||
".\include\apr_env.h"\
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\misc\unix\errorcodes.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
|
||||
|
||||
.\misc\unix\getopt.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
|
||||
|
||||
.\misc\win32\internal.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\misc\win32\misc.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
".\include\arch\win32\apr_dbg_win32_handles.h"\
|
||||
|
||||
|
||||
.\misc\unix\otherchild.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_threadproc.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\misc\win32\rand.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_portable.h"\
|
||||
|
||||
|
||||
.\misc\win32\start.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_signal.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_threadproc.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\misc\win32\utf8.c : \
|
||||
".\include\apr_lib.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\misc\unix\version.c : \
|
||||
".\include\apr_version.h"\
|
||||
|
||||
|
||||
.\mmap\unix\common.c : \
|
||||
".\include\apr_mmap.h"\
|
||||
|
||||
|
||||
.\mmap\win32\mmap.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_mmap.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\network_io\unix\inet_ntop.c : \
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_strings.h"\
|
||||
".\include\arch\win32\apr_arch_networkio.h"\
|
||||
|
||||
|
||||
.\network_io\unix\inet_pton.c : \
|
||||
".\include\apr_poll.h"\
|
||||
".\include\arch\win32\apr_arch_networkio.h"\
|
||||
|
||||
|
||||
.\network_io\unix\multicast.c : \
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_support.h"\
|
||||
".\include\arch\win32\apr_arch_inherit.h"\
|
||||
".\include\arch\win32\apr_arch_networkio.h"\
|
||||
|
||||
|
||||
.\network_io\win32\sendrecv.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_networkio.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\network_io\unix\sockaddr.c : \
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_strings.h"\
|
||||
".\include\arch\win32\apr_arch_networkio.h"\
|
||||
|
||||
|
||||
.\network_io\unix\socket_util.c : \
|
||||
".\include\apr_poll.h"\
|
||||
|
||||
|
||||
.\network_io\win32\sockets.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
".\include\arch\win32\apr_arch_inherit.h"\
|
||||
".\include\arch\win32\apr_arch_networkio.h"\
|
||||
|
||||
|
||||
.\network_io\win32\sockopt.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
".\include\arch\win32\apr_arch_networkio.h"\
|
||||
|
||||
|
||||
.\passwd\apr_getpass.c : \
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_strings.h"\
|
||||
|
||||
|
||||
.\poll\unix\poll.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\arch\unix\apr_arch_poll_private.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_networkio.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\poll\unix\pollcb.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\arch\unix\apr_arch_poll_private.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_networkio.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\poll\unix\pollset.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\arch\unix\apr_arch_poll_private.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_inherit.h"\
|
||||
".\include\arch\win32\apr_arch_networkio.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\poll\unix\select.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\arch\unix\apr_arch_poll_private.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_networkio.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\random\unix\apr_random.c : \
|
||||
".\include\apr_random.h"\
|
||||
|
||||
|
||||
.\random\unix\sha2.c : \
|
||||
".\random\unix\sha2.h"\
|
||||
|
||||
|
||||
.\random\unix\sha2_glue.c : \
|
||||
".\include\apr_random.h"\
|
||||
".\random\unix\sha2.h"\
|
||||
|
||||
|
||||
.\shmem\win32\shm.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\strings\apr_cpystrn.c : \
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_strings.h"\
|
||||
|
||||
|
||||
.\strings\apr_fnmatch.c : \
|
||||
".\include\apr_fnmatch.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_strings.h"\
|
||||
|
||||
|
||||
.\strings\apr_snprintf.c : \
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
|
||||
|
||||
.\strings\apr_strings.c : \
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_strings.h"\
|
||||
|
||||
|
||||
.\strings\apr_strnatcmp.c : \
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_strings.h"\
|
||||
|
||||
|
||||
.\strings\apr_strtok.c : \
|
||||
".\include\apr_strings.h"\
|
||||
|
||||
|
||||
.\tables\apr_hash.c : \
|
||||
".\include\apr_hash.h"\
|
||||
|
||||
|
||||
.\tables\apr_tables.c : \
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_strings.h"\
|
||||
|
||||
|
||||
.\threadproc\win32\proc.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_threadproc.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\threadproc\win32\signals.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_signal.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_threadproc.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
.\threadproc\win32\thread.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\arch\win32\apr_arch_threadproc.h"\
|
||||
|
||||
|
||||
.\threadproc\win32\threadpriv.c : \
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\arch\win32\apr_arch_threadproc.h"\
|
||||
|
||||
|
||||
.\time\win32\time.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\arch\win32\apr_arch_atime.h"\
|
||||
|
||||
|
||||
.\time\win32\timestr.c : \
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
".\include\arch\win32\apr_arch_atime.h"\
|
||||
|
||||
|
||||
.\user\win32\groupinfo.c : \
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
|
||||
|
||||
.\user\win32\userinfo.c : \
|
||||
".\include\apr_getopt.h"\
|
||||
".\include\apr_lib.h"\
|
||||
".\include\apr_poll.h"\
|
||||
".\include\apr_portable.h"\
|
||||
".\include\apr_strings.h"\
|
||||
".\include\arch\win32\apr_arch_file_io.h"\
|
||||
".\include\arch\win32\apr_arch_utf8.h"\
|
||||
|
||||
|
||||
!IF "$(CFG)" == "apr - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "apr - Win32 Debug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "apr - Win32 Release9x"
|
||||
|
||||
!ELSEIF "$(CFG)" == "apr - Win32 Debug9x"
|
||||
|
||||
!ELSEIF "$(CFG)" == "apr - x64 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "apr - x64 Debug"
|
||||
|
||||
!ENDIF
|
||||
|
817
apr.dsp
Normal file
817
apr.dsp
Normal file
@ -0,0 +1,817 @@
|
||||
# Microsoft Developer Studio Project File - Name="apr" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=apr - Win32 Release
|
||||
!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 "apr.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 "apr.mak" CFG="apr - Win32 Release"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "apr - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "apr - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "apr - Win32 Release9x" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "apr - Win32 Debug9x" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "apr - x64 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "apr - x64 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "apr - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "LibR"
|
||||
# PROP BASE Intermediate_Dir "LibR"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "LibR"
|
||||
# PROP Intermediate_Dir "LibR"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "NDEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\" /Fd"$(OUTDIR)\apr-1" /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"LibR\apr-1.lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "apr - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "LibD"
|
||||
# PROP BASE Intermediate_Dir "LibD"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "LibD"
|
||||
# PROP Intermediate_Dir "LibD"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MDd /W3 /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /EHsc /c
|
||||
# ADD CPP /nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "_DEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\" /Fd"$(OUTDIR)\apr-1" /FD /EHsc /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"LibD\apr-1.lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "apr - Win32 Release9x"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "9x\LibR"
|
||||
# PROP BASE Intermediate_Dir "9x\LibR"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "9x\LibR"
|
||||
# PROP Intermediate_Dir "9x\LibR"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "NDEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "_WINDOWS" /Fo"$(INTDIR)\" /Fd"$(OUTDIR)\apr-1" /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"9x\LibR\apr-1.lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "apr - Win32 Debug9x"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "9x\LibD"
|
||||
# PROP BASE Intermediate_Dir "9x\LibD"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "9x\LibD"
|
||||
# PROP Intermediate_Dir "9x\LibD"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MDd /W3 /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /EHsc /c
|
||||
# ADD CPP /nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "_DEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "_WINDOWS" /Fo"$(INTDIR)\" /Fd"$(OUTDIR)\apr-1" /FD /EHsc /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"9x\LibD\apr-1.lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "apr - x64 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "x64\LibR"
|
||||
# PROP BASE Intermediate_Dir "x64\LibR"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "x64\LibR"
|
||||
# PROP Intermediate_Dir "x64\LibR"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "NDEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\" /Fd"$(OUTDIR)\apr-1" /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"x64\LibR\apr-1.lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "apr - x64 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "x64\LibD"
|
||||
# PROP BASE Intermediate_Dir "x64\LibD"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "x64\LibD"
|
||||
# PROP Intermediate_Dir "x64\LibD"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MDd /W3 /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /EHsc /c
|
||||
# ADD CPP /nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "_DEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\" /Fd"$(OUTDIR)\apr-1" /FD /EHsc /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"x64\LibD\apr-1.lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "apr - Win32 Release"
|
||||
# Name "apr - Win32 Debug"
|
||||
# Name "apr - Win32 Release9x"
|
||||
# Name "apr - Win32 Debug9x"
|
||||
# Name "apr - x64 Release"
|
||||
# Name "apr - x64 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter ".c"
|
||||
# Begin Group "atomic"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\atomic\win32\apr_atomic.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "dso"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\dso\win32\dso.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "file_io"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\file_io\win32\buffer.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\file_io\unix\copy.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\file_io\win32\dir.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\file_io\unix\fileacc.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\file_io\win32\filedup.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\file_io\win32\filepath.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\file_io\unix\filepath_util.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\file_io\win32\filestat.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\file_io\win32\filesys.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\file_io\win32\flock.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\file_io\unix\fullrw.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\file_io\unix\mktemp.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=.\file_io\win32\readwrite.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\file_io\win32\seek.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\file_io\unix\tempdir.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "locks"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\locks\win32\proc_mutex.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\locks\win32\thread_cond.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\locks\win32\thread_mutex.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\locks\win32\thread_rwlock.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "memory"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\memory\unix\apr_pools.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "misc"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\misc\win32\apr_app.c
|
||||
# PROP Exclude_From_Build 1
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\misc\win32\charset.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\misc\win32\env.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\misc\unix\errorcodes.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\misc\unix\getopt.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\misc\win32\internal.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\misc\win32\misc.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\misc\unix\otherchild.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\misc\win32\rand.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\misc\win32\start.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\misc\win32\utf8.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\misc\unix\version.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "mmap"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\mmap\unix\common.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\mmap\win32\mmap.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "network_io"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\network_io\unix\inet_ntop.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\network_io\unix\inet_pton.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\network_io\unix\multicast.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\network_io\win32\sendrecv.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\network_io\unix\sockaddr.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\network_io\win32\sockets.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\network_io\unix\socket_util.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\network_io\win32\sockopt.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "passwd"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\passwd\apr_getpass.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "poll"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\poll\unix\poll.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\poll\unix\pollcb.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\poll\unix\pollset.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\poll\unix\select.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "random"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\random\unix\apr_random.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\random\unix\sha2.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\random\unix\sha2_glue.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "shmem"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\shmem\win32\shm.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "strings"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\strings\apr_cpystrn.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\strings\apr_fnmatch.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\strings\apr_snprintf.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\strings\apr_strings.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\strings\apr_strnatcmp.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\strings\apr_strtok.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "tables"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tables\apr_hash.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tables\apr_tables.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "threadproc"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\threadproc\win32\proc.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\threadproc\win32\signals.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\threadproc\win32\thread.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\threadproc\win32\threadpriv.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "time"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# 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 "user"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\user\win32\groupinfo.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\user\win32\userinfo.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Group
|
||||
# Begin Group "Private Header Files"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\arch\win32\apr_arch_atime.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\arch\win32\apr_arch_dso.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\arch\win32\apr_arch_file_io.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\arch\win32\apr_arch_inherit.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\arch\win32\apr_arch_misc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\arch\win32\apr_arch_networkio.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\arch\win32\apr_arch_thread_mutex.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\arch\win32\apr_arch_thread_rwlock.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\arch\win32\apr_arch_threadproc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\arch\win32\apr_arch_utf8.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\arch\win32\apr_private.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\arch\apr_private_common.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Public Header Files"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr.h.in
|
||||
# PROP Exclude_From_Build 1
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr.hnw
|
||||
# PROP Exclude_From_Build 1
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr.hw
|
||||
|
||||
!IF "$(CFG)" == "apr - Win32 Release"
|
||||
|
||||
# Begin Custom Build - Creating apr.h from apr.hw
|
||||
InputPath=.\include\apr.hw
|
||||
|
||||
".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
type .\include\apr.hw > .\include\apr.h
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "apr - Win32 Debug"
|
||||
|
||||
# Begin Custom Build - Creating apr.h from apr.hw
|
||||
InputPath=.\include\apr.hw
|
||||
|
||||
".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
type .\include\apr.hw > .\include\apr.h
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "apr - Win32 Release9x"
|
||||
|
||||
# Begin Custom Build - Creating apr.h from apr.hw
|
||||
InputPath=.\include\apr.hw
|
||||
|
||||
".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
type .\include\apr.hw > .\include\apr.h
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "apr - Win32 Debug9x"
|
||||
|
||||
# Begin Custom Build - Creating apr.h from apr.hw
|
||||
InputPath=.\include\apr.hw
|
||||
|
||||
".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
type .\include\apr.hw > .\include\apr.h
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "apr - x64 Release"
|
||||
|
||||
# Begin Custom Build - Creating apr.h from apr.hw
|
||||
InputPath=.\include\apr.hw
|
||||
|
||||
".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
type .\include\apr.hw > .\include\apr.h
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "apr - x64 Debug"
|
||||
|
||||
# Begin Custom Build - Creating apr.h from apr.hw
|
||||
InputPath=.\include\apr.hw
|
||||
|
||||
".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
type .\include\apr.hw > .\include\apr.h
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_allocator.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_atomic.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_dso.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_env.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_errno.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_file_info.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_getopt.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_global_mutex.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_hash.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_inherit.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_lib.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_mmap.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_network_io.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_poll.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_pools.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_portable.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_proc_mutex.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_random.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_ring.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_shm.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_signal.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_strings.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_support.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_tables.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_thread_cond.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_thread_mutex.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_thread_proc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_thread_rwlock.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_time.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_user.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_version.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\include\apr_want.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
101
apr.dsw
Normal file
101
apr.dsw
Normal file
@ -0,0 +1,101 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "apr"=".\apr.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "aprapp"=".\build\aprapp.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name preaprapp
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "libapr"=".\libapr.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "libaprapp"=".\build\libaprapp.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name prelibaprapp
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "preaprapp"=".\build\preaprapp.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name apr
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "prelibaprapp"=".\build\prelibaprapp.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name libapr
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
11
apr.pc.in
Normal file
11
apr.pc.in
Normal file
@ -0,0 +1,11 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
APR_MAJOR_VERSION=@APR_MAJOR_VERSION@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: APR
|
||||
Description: The Apache Portable Runtime library
|
||||
Version: @APR_DOTTED_VERSION@
|
||||
Libs: -L${libdir} -l@APR_LIBNAME@ @EXTRA_LIBS@
|
||||
Cflags: @EXTRA_CPPFLAGS@ @EXTRA_CFLAGS@ -I${includedir}
|
100
apr.spec
Normal file
100
apr.spec
Normal file
@ -0,0 +1,100 @@
|
||||
|
||||
%define aprver 1
|
||||
|
||||
Summary: Apache Portable Runtime library
|
||||
Name: apr
|
||||
Version: 1.4.6
|
||||
Release: 1
|
||||
License: Apache Software License
|
||||
Group: System Environment/Libraries
|
||||
URL: http://apr.apache.org/
|
||||
Source0: http://www.apache.org/dist/apr/%{name}-%{version}.tar.bz2
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
|
||||
BuildRequires: autoconf, libtool, doxygen, python
|
||||
|
||||
%description
|
||||
The mission of the Apache Portable Runtime (APR) is to provide a
|
||||
free library of C data structures and routines, forming a system
|
||||
portability layer to as many operating systems as possible,
|
||||
including Unices, MS Win32, BeOS and OS/2.
|
||||
|
||||
%package devel
|
||||
Group: Development/Libraries
|
||||
Summary: APR library development kit
|
||||
Requires: apr = %{version}
|
||||
|
||||
%description devel
|
||||
This package provides the support files which can be used to
|
||||
build applications using the APR library. The mission of the
|
||||
Apache Portable Runtime (APR) is to provide a free library of
|
||||
C data structures and routines.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
# regenerate configure script etc.
|
||||
./buildconf
|
||||
%configure \
|
||||
--prefix=/usr \
|
||||
--includedir=%{_includedir}/apr-%{aprver} \
|
||||
--with-installbuilddir=%{_libdir}/apr/build-%{aprver} \
|
||||
--with-devrandom=/dev/urandom \
|
||||
CC=gcc CXX=g++
|
||||
make %{?_smp_mflags} && make dox
|
||||
|
||||
%check
|
||||
# Run non-interactive tests
|
||||
pushd test
|
||||
make %{?_smp_mflags} all CFLAGS=-fno-strict-aliasing
|
||||
make check || exit 1
|
||||
popd
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
make install DESTDIR=$RPM_BUILD_ROOT
|
||||
|
||||
# Move docs to more convenient location
|
||||
mv docs/dox/html html
|
||||
|
||||
# Unpackaged files:
|
||||
rm -f $RPM_BUILD_ROOT%{_libdir}/apr.exp
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%post -p /sbin/ldconfig
|
||||
|
||||
%postun -p /sbin/ldconfig
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%doc CHANGES LICENSE NOTICE
|
||||
%{_libdir}/libapr-%{aprver}.so.*
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root,-)
|
||||
%doc docs/APRDesign.html docs/canonical_filenames.html
|
||||
%doc docs/incomplete_types docs/non_apr_programs
|
||||
%doc --parents html
|
||||
%{_bindir}/apr*config
|
||||
%{_libdir}/libapr-%{aprver}.*a
|
||||
%{_libdir}/libapr-%{aprver}.so
|
||||
%dir %{_libdir}/apr
|
||||
%dir %{_libdir}/apr/build-%{aprver}
|
||||
%{_libdir}/apr/build-%{aprver}/*
|
||||
%{_libdir}/pkgconfig/apr-%{aprver}.pc
|
||||
%dir %{_includedir}/apr-%{aprver}
|
||||
%{_includedir}/apr-%{aprver}/*.h
|
||||
|
||||
%changelog
|
||||
* Sat Aug 30 2008 Graham Leggett <minfrin@sharp.fm> 1.3.3
|
||||
- update to depend on the bzip2 binary
|
||||
- build depends on python
|
||||
|
||||
* Tue Jun 22 2004 Graham Leggett <minfrin@sharp.fm> 1.0.0-1
|
||||
- update to support v1.0.0 of APR
|
||||
|
||||
* Tue Jun 22 2004 Graham Leggett <minfrin@sharp.fm> 1.0.0-1
|
||||
- derived from Fedora Core apr.spec
|
||||
|
81
atomic/unix/builtins.c
Normal file
81
atomic/unix/builtins.c
Normal file
@ -0,0 +1,81 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "apr_arch_atomic.h"
|
||||
|
||||
#ifdef USE_ATOMICS_BUILTINS
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p)
|
||||
{
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem)
|
||||
{
|
||||
return *mem;
|
||||
}
|
||||
|
||||
APR_DECLARE(void) apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val)
|
||||
{
|
||||
*mem = val;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val)
|
||||
{
|
||||
return __sync_fetch_and_add(mem, val);
|
||||
}
|
||||
|
||||
APR_DECLARE(void) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val)
|
||||
{
|
||||
__sync_fetch_and_sub(mem, val);
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_inc32(volatile apr_uint32_t *mem)
|
||||
{
|
||||
return __sync_fetch_and_add(mem, 1);
|
||||
}
|
||||
|
||||
APR_DECLARE(int) apr_atomic_dec32(volatile apr_uint32_t *mem)
|
||||
{
|
||||
return __sync_sub_and_fetch(mem, 1);
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t with,
|
||||
apr_uint32_t cmp)
|
||||
{
|
||||
return __sync_val_compare_and_swap(mem, cmp, with);
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val)
|
||||
{
|
||||
__sync_synchronize();
|
||||
|
||||
return __sync_lock_test_and_set(mem, val);
|
||||
}
|
||||
|
||||
APR_DECLARE(void*) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp)
|
||||
{
|
||||
return (void*) __sync_val_compare_and_swap(mem, cmp, with);
|
||||
}
|
||||
|
||||
APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem, void *with)
|
||||
{
|
||||
__sync_synchronize();
|
||||
|
||||
return (void*) __sync_lock_test_and_set(mem, with);
|
||||
}
|
||||
|
||||
#endif /* USE_ATOMICS_BUILTINS */
|
127
atomic/unix/ia32.c
Normal file
127
atomic/unix/ia32.c
Normal file
@ -0,0 +1,127 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "apr_arch_atomic.h"
|
||||
|
||||
#ifdef USE_ATOMICS_IA32
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p)
|
||||
{
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem)
|
||||
{
|
||||
return *mem;
|
||||
}
|
||||
|
||||
APR_DECLARE(void) apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val)
|
||||
{
|
||||
*mem = val;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val)
|
||||
{
|
||||
asm volatile ("lock; xaddl %0,%1"
|
||||
: "=r" (val), "=m" (*mem)
|
||||
: "0" (val), "m" (*mem)
|
||||
: "memory", "cc");
|
||||
return val;
|
||||
}
|
||||
|
||||
APR_DECLARE(void) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val)
|
||||
{
|
||||
asm volatile ("lock; subl %1, %0"
|
||||
: /* no output */
|
||||
: "m" (*(mem)), "r" (val)
|
||||
: "memory", "cc");
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_inc32(volatile apr_uint32_t *mem)
|
||||
{
|
||||
return apr_atomic_add32(mem, 1);
|
||||
}
|
||||
|
||||
APR_DECLARE(int) apr_atomic_dec32(volatile apr_uint32_t *mem)
|
||||
{
|
||||
unsigned char prev;
|
||||
|
||||
asm volatile ("lock; decl %0; setnz %1"
|
||||
: "=m" (*mem), "=qm" (prev)
|
||||
: "m" (*mem)
|
||||
: "memory");
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t with,
|
||||
apr_uint32_t cmp)
|
||||
{
|
||||
apr_uint32_t prev;
|
||||
|
||||
asm volatile ("lock; cmpxchgl %1, %2"
|
||||
: "=a" (prev)
|
||||
: "r" (with), "m" (*(mem)), "0"(cmp)
|
||||
: "memory", "cc");
|
||||
return prev;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val)
|
||||
{
|
||||
apr_uint32_t prev = val;
|
||||
|
||||
asm volatile ("xchgl %0, %1"
|
||||
: "=r" (prev), "+m" (*mem)
|
||||
: "0" (prev));
|
||||
return prev;
|
||||
}
|
||||
|
||||
APR_DECLARE(void*) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp)
|
||||
{
|
||||
void *prev;
|
||||
#if APR_SIZEOF_VOIDP == 4
|
||||
asm volatile ("lock; cmpxchgl %2, %1"
|
||||
: "=a" (prev), "=m" (*mem)
|
||||
: "r" (with), "m" (*mem), "0" (cmp));
|
||||
#elif APR_SIZEOF_VOIDP == 8
|
||||
asm volatile ("lock; cmpxchgq %q2, %1"
|
||||
: "=a" (prev), "=m" (*mem)
|
||||
: "r" ((unsigned long)with), "m" (*mem),
|
||||
"0" ((unsigned long)cmp));
|
||||
#else
|
||||
#error APR_SIZEOF_VOIDP value not supported
|
||||
#endif
|
||||
return prev;
|
||||
}
|
||||
|
||||
APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem, void *with)
|
||||
{
|
||||
void *prev;
|
||||
#if APR_SIZEOF_VOIDP == 4
|
||||
asm volatile ("xchgl %2, %1"
|
||||
: "=a" (prev), "+m" (*mem)
|
||||
: "0" (with));
|
||||
#elif APR_SIZEOF_VOIDP == 8
|
||||
asm volatile ("xchgq %q2, %1"
|
||||
: "=a" (prev), "+m" (*mem)
|
||||
: "r" ((unsigned long)with));
|
||||
#else
|
||||
#error APR_SIZEOF_VOIDP value not supported
|
||||
#endif
|
||||
return prev;
|
||||
}
|
||||
|
||||
#endif /* USE_ATOMICS_IA32 */
|
205
atomic/unix/mutex.c
Normal file
205
atomic/unix/mutex.c
Normal file
@ -0,0 +1,205 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "apr_arch_atomic.h"
|
||||
|
||||
#ifdef USE_ATOMICS_GENERIC
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#if APR_HAS_THREADS
|
||||
# define DECLARE_MUTEX_LOCKED(name, mem) \
|
||||
apr_thread_mutex_t *name = mutex_hash(mem)
|
||||
# define MUTEX_UNLOCK(name) \
|
||||
do { \
|
||||
if (apr_thread_mutex_unlock(name) != APR_SUCCESS) \
|
||||
abort(); \
|
||||
} while (0)
|
||||
#else
|
||||
# define DECLARE_MUTEX_LOCKED(name, mem)
|
||||
# define MUTEX_UNLOCK(name)
|
||||
# warning Be warned: using stubs for all atomic operations
|
||||
#endif
|
||||
|
||||
#if APR_HAS_THREADS
|
||||
|
||||
static apr_thread_mutex_t **hash_mutex;
|
||||
|
||||
#define NUM_ATOMIC_HASH 7
|
||||
/* shift by 2 to get rid of alignment issues */
|
||||
#define ATOMIC_HASH(x) (unsigned int)(((unsigned long)(x)>>2)%(unsigned int)NUM_ATOMIC_HASH)
|
||||
|
||||
static apr_status_t atomic_cleanup(void *data)
|
||||
{
|
||||
if (hash_mutex == data)
|
||||
hash_mutex = NULL;
|
||||
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p)
|
||||
{
|
||||
int i;
|
||||
apr_status_t rv;
|
||||
|
||||
if (hash_mutex != NULL)
|
||||
return APR_SUCCESS;
|
||||
|
||||
hash_mutex = apr_palloc(p, sizeof(apr_thread_mutex_t*) * NUM_ATOMIC_HASH);
|
||||
apr_pool_cleanup_register(p, hash_mutex, atomic_cleanup,
|
||||
apr_pool_cleanup_null);
|
||||
|
||||
for (i = 0; i < NUM_ATOMIC_HASH; i++) {
|
||||
rv = apr_thread_mutex_create(&(hash_mutex[i]),
|
||||
APR_THREAD_MUTEX_DEFAULT, p);
|
||||
if (rv != APR_SUCCESS) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
static APR_INLINE apr_thread_mutex_t *mutex_hash(volatile apr_uint32_t *mem)
|
||||
{
|
||||
apr_thread_mutex_t *mutex = hash_mutex[ATOMIC_HASH(mem)];
|
||||
|
||||
if (apr_thread_mutex_lock(mutex) != APR_SUCCESS) {
|
||||
abort();
|
||||
}
|
||||
|
||||
return mutex;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p)
|
||||
{
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
#endif /* APR_HAS_THREADS */
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem)
|
||||
{
|
||||
return *mem;
|
||||
}
|
||||
|
||||
APR_DECLARE(void) apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val)
|
||||
{
|
||||
DECLARE_MUTEX_LOCKED(mutex, mem);
|
||||
|
||||
*mem = val;
|
||||
|
||||
MUTEX_UNLOCK(mutex);
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val)
|
||||
{
|
||||
apr_uint32_t old_value;
|
||||
DECLARE_MUTEX_LOCKED(mutex, mem);
|
||||
|
||||
old_value = *mem;
|
||||
*mem += val;
|
||||
|
||||
MUTEX_UNLOCK(mutex);
|
||||
|
||||
return old_value;
|
||||
}
|
||||
|
||||
APR_DECLARE(void) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val)
|
||||
{
|
||||
DECLARE_MUTEX_LOCKED(mutex, mem);
|
||||
*mem -= val;
|
||||
MUTEX_UNLOCK(mutex);
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_inc32(volatile apr_uint32_t *mem)
|
||||
{
|
||||
return apr_atomic_add32(mem, 1);
|
||||
}
|
||||
|
||||
APR_DECLARE(int) apr_atomic_dec32(volatile apr_uint32_t *mem)
|
||||
{
|
||||
apr_uint32_t new;
|
||||
DECLARE_MUTEX_LOCKED(mutex, mem);
|
||||
|
||||
(*mem)--;
|
||||
new = *mem;
|
||||
|
||||
MUTEX_UNLOCK(mutex);
|
||||
|
||||
return new;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t with,
|
||||
apr_uint32_t cmp)
|
||||
{
|
||||
apr_uint32_t prev;
|
||||
DECLARE_MUTEX_LOCKED(mutex, mem);
|
||||
|
||||
prev = *mem;
|
||||
if (prev == cmp) {
|
||||
*mem = with;
|
||||
}
|
||||
|
||||
MUTEX_UNLOCK(mutex);
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val)
|
||||
{
|
||||
apr_uint32_t prev;
|
||||
DECLARE_MUTEX_LOCKED(mutex, mem);
|
||||
|
||||
prev = *mem;
|
||||
*mem = val;
|
||||
|
||||
MUTEX_UNLOCK(mutex);
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
APR_DECLARE(void*) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp)
|
||||
{
|
||||
void *prev;
|
||||
DECLARE_MUTEX_LOCKED(mutex, *mem);
|
||||
|
||||
prev = *(void **)mem;
|
||||
if (prev == cmp) {
|
||||
*mem = with;
|
||||
}
|
||||
|
||||
MUTEX_UNLOCK(mutex);
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem, void *with)
|
||||
{
|
||||
void *prev;
|
||||
DECLARE_MUTEX_LOCKED(mutex, *mem);
|
||||
|
||||
prev = *(void **)mem;
|
||||
*mem = with;
|
||||
|
||||
MUTEX_UNLOCK(mutex);
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
#endif /* USE_ATOMICS_GENERIC */
|
207
atomic/unix/ppc.c
Normal file
207
atomic/unix/ppc.c
Normal file
@ -0,0 +1,207 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "apr_arch_atomic.h"
|
||||
|
||||
#ifdef USE_ATOMICS_PPC
|
||||
|
||||
#ifdef PPC405_ERRATA
|
||||
# define PPC405_ERR77_SYNC " sync\n"
|
||||
#else
|
||||
# define PPC405_ERR77_SYNC
|
||||
#endif
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p)
|
||||
{
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem)
|
||||
{
|
||||
return *mem;
|
||||
}
|
||||
|
||||
APR_DECLARE(void) apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val)
|
||||
{
|
||||
*mem = val;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val)
|
||||
{
|
||||
apr_uint32_t prev, temp;
|
||||
|
||||
asm volatile ("loop_%=:\n" /* lost reservation */
|
||||
" lwarx %0,0,%3\n" /* load and reserve */
|
||||
" add %1,%0,%4\n" /* add val and prev */
|
||||
PPC405_ERR77_SYNC /* ppc405 Erratum 77 */
|
||||
" stwcx. %1,0,%3\n" /* store new value */
|
||||
" bne- loop_%=\n" /* loop if lost */
|
||||
: "=&r" (prev), "=&r" (temp), "=m" (*mem)
|
||||
: "b" (mem), "r" (val)
|
||||
: "cc", "memory");
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
APR_DECLARE(void) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val)
|
||||
{
|
||||
apr_uint32_t temp;
|
||||
|
||||
asm volatile ("loop_%=:\n" /* lost reservation */
|
||||
" lwarx %0,0,%2\n" /* load and reserve */
|
||||
" subf %0,%3,%0\n" /* subtract val */
|
||||
PPC405_ERR77_SYNC /* ppc405 Erratum 77 */
|
||||
" stwcx. %0,0,%2\n" /* store new value */
|
||||
" bne- loop_%=\n" /* loop if lost */
|
||||
: "=&r" (temp), "=m" (*mem)
|
||||
: "b" (mem), "r" (val)
|
||||
: "cc", "memory");
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_inc32(volatile apr_uint32_t *mem)
|
||||
{
|
||||
apr_uint32_t prev;
|
||||
|
||||
asm volatile ("loop_%=:\n" /* lost reservation */
|
||||
" lwarx %0,0,%2\n" /* load and reserve */
|
||||
" addi %0,%0,1\n" /* add immediate */
|
||||
PPC405_ERR77_SYNC /* ppc405 Erratum 77 */
|
||||
" stwcx. %0,0,%2\n" /* store new value */
|
||||
" bne- loop_%=\n" /* loop if lost */
|
||||
" subi %0,%0,1\n" /* return old value */
|
||||
: "=&b" (prev), "=m" (*mem)
|
||||
: "b" (mem), "m" (*mem)
|
||||
: "cc", "memory");
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
APR_DECLARE(int) apr_atomic_dec32(volatile apr_uint32_t *mem)
|
||||
{
|
||||
apr_uint32_t prev;
|
||||
|
||||
asm volatile ("loop_%=:\n" /* lost reservation */
|
||||
" lwarx %0,0,%2\n" /* load and reserve */
|
||||
" subi %0,%0,1\n" /* subtract immediate */
|
||||
PPC405_ERR77_SYNC /* ppc405 Erratum 77 */
|
||||
" stwcx. %0,0,%2\n" /* store new value */
|
||||
" bne- loop_%=\n" /* loop if lost */
|
||||
: "=&b" (prev), "=m" (*mem)
|
||||
: "b" (mem), "m" (*mem)
|
||||
: "cc", "memory");
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t with,
|
||||
apr_uint32_t cmp)
|
||||
{
|
||||
apr_uint32_t prev;
|
||||
|
||||
asm volatile ("loop_%=:\n" /* lost reservation */
|
||||
" lwarx %0,0,%1\n" /* load and reserve */
|
||||
" cmpw %0,%3\n" /* compare operands */
|
||||
" bne- exit_%=\n" /* skip if not equal */
|
||||
PPC405_ERR77_SYNC /* ppc405 Erratum 77 */
|
||||
" stwcx. %2,0,%1\n" /* store new value */
|
||||
" bne- loop_%=\n" /* loop if lost */
|
||||
"exit_%=:\n" /* not equal */
|
||||
: "=&r" (prev)
|
||||
: "b" (mem), "r" (with), "r" (cmp)
|
||||
: "cc", "memory");
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val)
|
||||
{
|
||||
apr_uint32_t prev;
|
||||
|
||||
asm volatile ("loop_%=:\n" /* lost reservation */
|
||||
" lwarx %0,0,%1\n" /* load and reserve */
|
||||
PPC405_ERR77_SYNC /* ppc405 Erratum 77 */
|
||||
" stwcx. %2,0,%1\n" /* store new value */
|
||||
" bne- loop_%=" /* loop if lost */
|
||||
: "=&r" (prev)
|
||||
: "b" (mem), "r" (val)
|
||||
: "cc", "memory");
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
APR_DECLARE(void*) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp)
|
||||
{
|
||||
void *prev;
|
||||
#if APR_SIZEOF_VOIDP == 4
|
||||
asm volatile ("loop_%=:\n" /* lost reservation */
|
||||
" lwarx %0,0,%1\n" /* load and reserve */
|
||||
" cmpw %0,%3\n" /* compare operands */
|
||||
" bne- exit_%=\n" /* skip if not equal */
|
||||
PPC405_ERR77_SYNC /* ppc405 Erratum 77 */
|
||||
" stwcx. %2,0,%1\n" /* store new value */
|
||||
" bne- loop_%=\n" /* loop if lost */
|
||||
"exit_%=:\n" /* not equal */
|
||||
: "=&r" (prev)
|
||||
: "b" (mem), "r" (with), "r" (cmp)
|
||||
: "cc", "memory");
|
||||
#elif APR_SIZEOF_VOIDP == 8
|
||||
asm volatile ("loop_%=:\n" /* lost reservation */
|
||||
" ldarx %0,0,%1\n" /* load and reserve */
|
||||
" cmpd %0,%3\n" /* compare operands */
|
||||
" bne- exit_%=\n" /* skip if not equal */
|
||||
PPC405_ERR77_SYNC /* ppc405 Erratum 77 */
|
||||
" stdcx. %2,0,%1\n" /* store new value */
|
||||
" bne- loop_%=\n" /* loop if lost */
|
||||
"exit_%=:\n" /* not equal */
|
||||
: "=&r" (prev)
|
||||
: "b" (mem), "r" (with), "r" (cmp)
|
||||
: "cc", "memory");
|
||||
#else
|
||||
#error APR_SIZEOF_VOIDP value not supported
|
||||
#endif
|
||||
return prev;
|
||||
}
|
||||
|
||||
APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem, void *with)
|
||||
{
|
||||
void *prev;
|
||||
#if APR_SIZEOF_VOIDP == 4
|
||||
asm volatile ("loop_%=:\n" /* lost reservation */
|
||||
" lwarx %0,0,%1\n" /* load and reserve */
|
||||
PPC405_ERR77_SYNC /* ppc405 Erratum 77 */
|
||||
" stwcx. %2,0,%1\n" /* store new value */
|
||||
" bne- loop_%=\n" /* loop if lost */
|
||||
" isync\n" /* memory barrier */
|
||||
: "=&r" (prev)
|
||||
: "b" (mem), "r" (with)
|
||||
: "cc", "memory");
|
||||
#elif APR_SIZEOF_VOIDP == 8
|
||||
asm volatile ("loop_%=:\n" /* lost reservation */
|
||||
" ldarx %0,0,%1\n" /* load and reserve */
|
||||
PPC405_ERR77_SYNC /* ppc405 Erratum 77 */
|
||||
" stdcx. %2,0,%1\n" /* store new value */
|
||||
" bne- loop_%=\n" /* loop if lost */
|
||||
" isync\n" /* memory barrier */
|
||||
: "=&r" (prev)
|
||||
: "b" (mem), "r" (with)
|
||||
: "cc", "memory");
|
||||
#else
|
||||
#error APR_SIZEOF_VOIDP value not supported
|
||||
#endif
|
||||
return prev;
|
||||
}
|
||||
|
||||
#endif /* USE_ATOMICS_PPC */
|
155
atomic/unix/s390.c
Normal file
155
atomic/unix/s390.c
Normal file
@ -0,0 +1,155 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "apr_arch_atomic.h"
|
||||
|
||||
#ifdef USE_ATOMICS_S390
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p)
|
||||
{
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem)
|
||||
{
|
||||
return *mem;
|
||||
}
|
||||
|
||||
APR_DECLARE(void) apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val)
|
||||
{
|
||||
*mem = val;
|
||||
}
|
||||
|
||||
static APR_INLINE apr_uint32_t atomic_add(volatile apr_uint32_t *mem, apr_uint32_t val)
|
||||
{
|
||||
apr_uint32_t prev = *mem, temp;
|
||||
|
||||
asm volatile ("loop_%=:\n"
|
||||
" lr %1,%0\n"
|
||||
" alr %1,%3\n"
|
||||
" cs %0,%1,%2\n"
|
||||
" jl loop_%=\n"
|
||||
: "+d" (prev), "+d" (temp), "=Q" (*mem)
|
||||
: "d" (val), "m" (*mem)
|
||||
: "cc", "memory");
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val)
|
||||
{
|
||||
return atomic_add(mem, val);
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_inc32(volatile apr_uint32_t *mem)
|
||||
{
|
||||
return atomic_add(mem, 1);
|
||||
}
|
||||
|
||||
static APR_INLINE apr_uint32_t atomic_sub(volatile apr_uint32_t *mem, apr_uint32_t val)
|
||||
{
|
||||
apr_uint32_t prev = *mem, temp;
|
||||
|
||||
asm volatile ("loop_%=:\n"
|
||||
" lr %1,%0\n"
|
||||
" slr %1,%3\n"
|
||||
" cs %0,%1,%2\n"
|
||||
" jl loop_%=\n"
|
||||
: "+d" (prev), "+d" (temp), "=Q" (*mem)
|
||||
: "d" (val), "m" (*mem)
|
||||
: "cc", "memory");
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
APR_DECLARE(void) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val)
|
||||
{
|
||||
atomic_sub(mem, val);
|
||||
}
|
||||
|
||||
APR_DECLARE(int) apr_atomic_dec32(volatile apr_uint32_t *mem)
|
||||
{
|
||||
return atomic_sub(mem, 1);
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t with,
|
||||
apr_uint32_t cmp)
|
||||
{
|
||||
asm volatile (" cs %0,%2,%1\n"
|
||||
: "+d" (cmp), "=Q" (*mem)
|
||||
: "d" (with), "m" (*mem)
|
||||
: "cc", "memory");
|
||||
|
||||
return cmp;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val)
|
||||
{
|
||||
apr_uint32_t prev = *mem;
|
||||
|
||||
asm volatile ("loop_%=:\n"
|
||||
" cs %0,%2,%1\n"
|
||||
" jl loop_%=\n"
|
||||
: "+d" (prev), "=Q" (*mem)
|
||||
: "d" (val), "m" (*mem)
|
||||
: "cc", "memory");
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
APR_DECLARE(void*) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp)
|
||||
{
|
||||
void *prev = (void *) cmp;
|
||||
#if APR_SIZEOF_VOIDP == 4
|
||||
asm volatile (" cs %0,%2,%1\n"
|
||||
: "+d" (prev), "=Q" (*mem)
|
||||
: "d" (with), "m" (*mem)
|
||||
: "cc", "memory");
|
||||
#elif APR_SIZEOF_VOIDP == 8
|
||||
asm volatile (" csg %0,%2,%1\n"
|
||||
: "+d" (prev), "=Q" (*mem)
|
||||
: "d" (with), "m" (*mem)
|
||||
: "cc", "memory");
|
||||
#else
|
||||
#error APR_SIZEOF_VOIDP value not supported
|
||||
#endif
|
||||
return prev;
|
||||
}
|
||||
|
||||
APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem, void *with)
|
||||
{
|
||||
void *prev = (void *) *mem;
|
||||
#if APR_SIZEOF_VOIDP == 4
|
||||
asm volatile ("loop_%=:\n"
|
||||
" cs %0,%2,%1\n"
|
||||
" jl loop_%=\n"
|
||||
: "+d" (prev), "=Q" (*mem)
|
||||
: "d" (with), "m" (*mem)
|
||||
: "cc", "memory");
|
||||
#elif APR_SIZEOF_VOIDP == 8
|
||||
asm volatile ("loop_%=:\n"
|
||||
" csg %0,%2,%1\n"
|
||||
" jl loop_%=\n"
|
||||
: "+d" (prev), "=Q" (*mem)
|
||||
: "d" (with), "m" (*mem)
|
||||
: "cc", "memory");
|
||||
#else
|
||||
#error APR_SIZEOF_VOIDP value not supported
|
||||
#endif
|
||||
return prev;
|
||||
}
|
||||
|
||||
#endif /* USE_ATOMICS_S390 */
|
79
atomic/unix/solaris.c
Normal file
79
atomic/unix/solaris.c
Normal file
@ -0,0 +1,79 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "apr_arch_atomic.h"
|
||||
|
||||
#ifdef USE_ATOMICS_SOLARIS
|
||||
|
||||
#include <atomic.h>
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p)
|
||||
{
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem)
|
||||
{
|
||||
return *mem;
|
||||
}
|
||||
|
||||
APR_DECLARE(void) apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val)
|
||||
{
|
||||
*mem = val;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val)
|
||||
{
|
||||
return atomic_add_32_nv(mem, val) - val;
|
||||
}
|
||||
|
||||
APR_DECLARE(void) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val)
|
||||
{
|
||||
atomic_add_32(mem, -val);
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_inc32(volatile apr_uint32_t *mem)
|
||||
{
|
||||
return atomic_inc_32_nv(mem) - 1;
|
||||
}
|
||||
|
||||
APR_DECLARE(int) apr_atomic_dec32(volatile apr_uint32_t *mem)
|
||||
{
|
||||
return atomic_dec_32_nv(mem);
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t with,
|
||||
apr_uint32_t cmp)
|
||||
{
|
||||
return atomic_cas_32(mem, cmp, with);
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val)
|
||||
{
|
||||
return atomic_swap_32(mem, val);
|
||||
}
|
||||
|
||||
APR_DECLARE(void*) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp)
|
||||
{
|
||||
return atomic_cas_ptr(mem, (void*) cmp, with);
|
||||
}
|
||||
|
||||
APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem, void *with)
|
||||
{
|
||||
return atomic_swap_ptr(mem, with);
|
||||
}
|
||||
|
||||
#endif /* USE_ATOMICS_SOLARIS */
|
319
build-outputs.mk
Normal file
319
build-outputs.mk
Normal file
@ -0,0 +1,319 @@
|
||||
# DO NOT EDIT. AUTOMATICALLY GENERATED.
|
||||
|
||||
passwd/apr_getpass.lo: passwd/apr_getpass.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
|
||||
strings/apr_cpystrn.lo: strings/apr_cpystrn.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
|
||||
strings/apr_fnmatch.lo: strings/apr_fnmatch.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_fnmatch.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
strings/apr_snprintf.lo: strings/apr_snprintf.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
strings/apr_strings.lo: strings/apr_strings.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
|
||||
strings/apr_strnatcmp.lo: strings/apr_strnatcmp.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
|
||||
strings/apr_strtok.lo: strings/apr_strtok.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
|
||||
tables/apr_hash.lo: tables/apr_hash.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_hash.h include/apr_pools.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
|
||||
tables/apr_tables.lo: tables/apr_tables.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_want.h
|
||||
|
||||
OBJECTS_all = passwd/apr_getpass.lo strings/apr_cpystrn.lo strings/apr_fnmatch.lo strings/apr_snprintf.lo strings/apr_strings.lo strings/apr_strnatcmp.lo strings/apr_strtok.lo tables/apr_hash.lo tables/apr_tables.lo
|
||||
|
||||
dso/unix/dso.lo: dso/unix/dso.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_dso_unix = dso/unix/dso.lo
|
||||
|
||||
file_io/unix/buffer.lo: file_io/unix/buffer.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_thread_mutex.h include/apr_want.h
|
||||
file_io/unix/copy.lo: file_io/unix/copy.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_pools.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
file_io/unix/dir.lo: file_io/unix/dir.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
file_io/unix/fileacc.lo: file_io/unix/fileacc.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
|
||||
file_io/unix/filedup.lo: file_io/unix/filedup.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
file_io/unix/filepath.lo: file_io/unix/filepath.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
file_io/unix/filepath_util.lo: file_io/unix/filepath_util.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_want.h
|
||||
file_io/unix/filestat.lo: file_io/unix/filestat.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
file_io/unix/flock.lo: file_io/unix/flock.c .make.dirs
|
||||
file_io/unix/fullrw.lo: file_io/unix/fullrw.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_pools.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
file_io/unix/mktemp.lo: file_io/unix/mktemp.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
file_io/unix/open.lo: file_io/unix/open.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_hash.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
file_io/unix/pipe.lo: file_io/unix/pipe.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
file_io/unix/readwrite.lo: file_io/unix/readwrite.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_strings.h include/apr_support.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
file_io/unix/seek.lo: file_io/unix/seek.c .make.dirs
|
||||
file_io/unix/tempdir.lo: file_io/unix/tempdir.c .make.dirs include/apr_allocator.h include/apr_env.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_file_io_unix = file_io/unix/buffer.lo file_io/unix/copy.lo file_io/unix/dir.lo file_io/unix/fileacc.lo file_io/unix/filedup.lo file_io/unix/filepath.lo file_io/unix/filepath_util.lo file_io/unix/filestat.lo file_io/unix/flock.lo file_io/unix/fullrw.lo file_io/unix/mktemp.lo file_io/unix/open.lo file_io/unix/pipe.lo file_io/unix/readwrite.lo file_io/unix/seek.lo file_io/unix/tempdir.lo
|
||||
|
||||
locks/unix/global_mutex.lo: locks/unix/global_mutex.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
locks/unix/proc_mutex.lo: locks/unix/proc_mutex.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_hash.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
|
||||
locks/unix/thread_cond.lo: locks/unix/thread_cond.c .make.dirs
|
||||
locks/unix/thread_mutex.lo: locks/unix/thread_mutex.c .make.dirs include/apr_want.h
|
||||
locks/unix/thread_rwlock.lo: locks/unix/thread_rwlock.c .make.dirs
|
||||
|
||||
OBJECTS_locks_unix = locks/unix/global_mutex.lo locks/unix/proc_mutex.lo locks/unix/thread_cond.lo locks/unix/thread_mutex.lo locks/unix/thread_rwlock.lo
|
||||
|
||||
memory/unix/apr_pools.lo: memory/unix/apr_pools.c .make.dirs include/apr_allocator.h include/apr_atomic.h include/apr_dso.h include/apr_env.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_hash.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_memory_unix = memory/unix/apr_pools.lo
|
||||
|
||||
misc/unix/charset.lo: misc/unix/charset.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
misc/unix/env.lo: misc/unix/env.c .make.dirs include/apr_allocator.h include/apr_env.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
|
||||
misc/unix/errorcodes.lo: misc/unix/errorcodes.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
|
||||
misc/unix/getopt.lo: misc/unix/getopt.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
|
||||
misc/unix/otherchild.lo: misc/unix/otherchild.c .make.dirs
|
||||
misc/unix/rand.lo: misc/unix/rand.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_thread_mutex.h include/apr_want.h
|
||||
misc/unix/start.lo: misc/unix/start.c .make.dirs include/apr_allocator.h include/apr_atomic.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_signal.h include/apr_thread_mutex.h include/apr_want.h
|
||||
misc/unix/version.lo: misc/unix/version.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_thread_mutex.h include/apr_version.h include/apr_want.h
|
||||
|
||||
OBJECTS_misc_unix = misc/unix/charset.lo misc/unix/env.lo misc/unix/errorcodes.lo misc/unix/getopt.lo misc/unix/otherchild.lo misc/unix/rand.lo misc/unix/start.lo misc/unix/version.lo
|
||||
|
||||
mmap/unix/common.lo: mmap/unix/common.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_mmap.h include/apr_pools.h include/apr_ring.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
mmap/unix/mmap.lo: mmap/unix/mmap.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_mmap.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_ring.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_mmap_unix = mmap/unix/common.lo mmap/unix/mmap.lo
|
||||
|
||||
network_io/unix/inet_ntop.lo: network_io/unix/inet_ntop.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
|
||||
network_io/unix/inet_pton.lo: network_io/unix/inet_pton.c .make.dirs
|
||||
network_io/unix/multicast.lo: network_io/unix/multicast.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_support.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
network_io/unix/sendrecv.lo: network_io/unix/sendrecv.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_support.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
network_io/unix/sockaddr.lo: network_io/unix/sockaddr.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
|
||||
network_io/unix/socket_util.lo: network_io/unix/socket_util.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_network_io.h include/apr_poll.h include/apr_pools.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
network_io/unix/sockets.lo: network_io/unix/sockets.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_support.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
network_io/unix/sockopt.lo: network_io/unix/sockopt.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
|
||||
|
||||
OBJECTS_network_io_unix = network_io/unix/inet_ntop.lo network_io/unix/inet_pton.lo network_io/unix/multicast.lo network_io/unix/sendrecv.lo network_io/unix/sockaddr.lo network_io/unix/socket_util.lo network_io/unix/sockets.lo network_io/unix/sockopt.lo
|
||||
|
||||
poll/unix/epoll.lo: poll/unix/epoll.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_poll.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
poll/unix/kqueue.lo: poll/unix/kqueue.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_poll.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
poll/unix/poll.lo: poll/unix/poll.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_poll.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
poll/unix/pollcb.lo: poll/unix/pollcb.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_poll.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
poll/unix/pollset.lo: poll/unix/pollset.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_poll.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
poll/unix/port.lo: poll/unix/port.c .make.dirs include/apr_allocator.h include/apr_atomic.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_poll.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
poll/unix/select.lo: poll/unix/select.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_poll.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_poll_unix = poll/unix/epoll.lo poll/unix/kqueue.lo poll/unix/poll.lo poll/unix/pollcb.lo poll/unix/pollset.lo poll/unix/port.lo poll/unix/select.lo
|
||||
|
||||
random/unix/apr_random.lo: random/unix/apr_random.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_pools.h include/apr_random.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
random/unix/sha2.lo: random/unix/sha2.c .make.dirs
|
||||
random/unix/sha2_glue.lo: random/unix/sha2_glue.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_pools.h include/apr_random.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_random_unix = random/unix/apr_random.lo random/unix/sha2.lo random/unix/sha2_glue.lo
|
||||
|
||||
shmem/unix/shm.lo: shmem/unix/shm.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_shmem_unix = shmem/unix/shm.lo
|
||||
|
||||
support/unix/waitio.lo: support/unix/waitio.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_network_io.h include/apr_poll.h include/apr_pools.h include/apr_support.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_support_unix = support/unix/waitio.lo
|
||||
|
||||
threadproc/unix/proc.lo: threadproc/unix/proc.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_random.h include/apr_shm.h include/apr_signal.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
threadproc/unix/procsup.lo: threadproc/unix/procsup.c .make.dirs
|
||||
threadproc/unix/signals.lo: threadproc/unix/signals.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_signal.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
|
||||
threadproc/unix/thread.lo: threadproc/unix/thread.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
threadproc/unix/threadpriv.lo: threadproc/unix/threadpriv.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_threadproc_unix = threadproc/unix/proc.lo threadproc/unix/procsup.lo threadproc/unix/signals.lo threadproc/unix/thread.lo threadproc/unix/threadpriv.lo
|
||||
|
||||
time/unix/time.lo: time/unix/time.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
time/unix/timestr.lo: time/unix/timestr.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_time_unix = time/unix/time.lo time/unix/timestr.lo
|
||||
|
||||
user/unix/groupinfo.lo: user/unix/groupinfo.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
user/unix/userinfo.lo: user/unix/userinfo.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_user_unix = user/unix/groupinfo.lo user/unix/userinfo.lo
|
||||
|
||||
atomic/unix/builtins.lo: atomic/unix/builtins.c .make.dirs
|
||||
atomic/unix/ia32.lo: atomic/unix/ia32.c .make.dirs
|
||||
atomic/unix/mutex.lo: atomic/unix/mutex.c .make.dirs
|
||||
atomic/unix/ppc.lo: atomic/unix/ppc.c .make.dirs
|
||||
atomic/unix/s390.lo: atomic/unix/s390.c .make.dirs
|
||||
atomic/unix/solaris.lo: atomic/unix/solaris.c .make.dirs
|
||||
|
||||
OBJECTS_atomic_unix = atomic/unix/builtins.lo atomic/unix/ia32.lo atomic/unix/mutex.lo atomic/unix/ppc.lo atomic/unix/s390.lo atomic/unix/solaris.lo
|
||||
|
||||
OBJECTS_unix = $(OBJECTS_all) $(OBJECTS_atomic_unix) $(OBJECTS_dso_unix) $(OBJECTS_file_io_unix) $(OBJECTS_locks_unix) $(OBJECTS_memory_unix) $(OBJECTS_misc_unix) $(OBJECTS_mmap_unix) $(OBJECTS_network_io_unix) $(OBJECTS_poll_unix) $(OBJECTS_random_unix) $(OBJECTS_shmem_unix) $(OBJECTS_support_unix) $(OBJECTS_threadproc_unix) $(OBJECTS_time_unix) $(OBJECTS_user_unix)
|
||||
|
||||
dso/aix/dso.lo: dso/aix/dso.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_dso_aix = dso/aix/dso.lo
|
||||
|
||||
OBJECTS_aix = $(OBJECTS_all) $(OBJECTS_atomic_unix) $(OBJECTS_dso_aix) $(OBJECTS_file_io_unix) $(OBJECTS_locks_unix) $(OBJECTS_memory_unix) $(OBJECTS_misc_unix) $(OBJECTS_mmap_unix) $(OBJECTS_network_io_unix) $(OBJECTS_poll_unix) $(OBJECTS_random_unix) $(OBJECTS_shmem_unix) $(OBJECTS_support_unix) $(OBJECTS_threadproc_unix) $(OBJECTS_time_unix) $(OBJECTS_user_unix)
|
||||
|
||||
dso/beos/dso.lo: dso/beos/dso.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_dso_beos = dso/beos/dso.lo
|
||||
|
||||
locks/beos/proc_mutex.lo: locks/beos/proc_mutex.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
locks/beos/thread_cond.lo: locks/beos/thread_cond.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
locks/beos/thread_mutex.lo: locks/beos/thread_mutex.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
locks/beos/thread_rwlock.lo: locks/beos/thread_rwlock.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_locks_beos = locks/beos/proc_mutex.lo locks/beos/thread_cond.lo locks/beos/thread_mutex.lo locks/beos/thread_rwlock.lo
|
||||
|
||||
network_io/beos/sendrecv.lo: network_io/beos/sendrecv.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
|
||||
network_io/beos/socketcommon.lo: network_io/beos/socketcommon.c .make.dirs
|
||||
|
||||
OBJECTS_network_io_beos = network_io/beos/sendrecv.lo network_io/beos/socketcommon.lo
|
||||
|
||||
shmem/beos/shm.lo: shmem/beos/shm.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_shmem_beos = shmem/beos/shm.lo
|
||||
|
||||
threadproc/beos/apr_proc_stub.lo: threadproc/beos/apr_proc_stub.c .make.dirs
|
||||
threadproc/beos/proc.lo: threadproc/beos/proc.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
|
||||
threadproc/beos/thread.lo: threadproc/beos/thread.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
threadproc/beos/threadpriv.lo: threadproc/beos/threadpriv.c .make.dirs
|
||||
threadproc/beos/threadproc_common.lo: threadproc/beos/threadproc_common.c .make.dirs
|
||||
|
||||
OBJECTS_threadproc_beos = threadproc/beos/apr_proc_stub.lo threadproc/beos/proc.lo threadproc/beos/thread.lo threadproc/beos/threadpriv.lo threadproc/beos/threadproc_common.lo
|
||||
|
||||
OBJECTS_beos = $(OBJECTS_all) $(OBJECTS_atomic_unix) $(OBJECTS_dso_beos) $(OBJECTS_file_io_unix) $(OBJECTS_locks_beos) $(OBJECTS_memory_unix) $(OBJECTS_misc_unix) $(OBJECTS_mmap_unix) $(OBJECTS_network_io_beos) $(OBJECTS_poll_unix) $(OBJECTS_random_unix) $(OBJECTS_shmem_beos) $(OBJECTS_support_unix) $(OBJECTS_threadproc_beos) $(OBJECTS_time_unix) $(OBJECTS_user_unix)
|
||||
|
||||
dso/os2/dso.lo: dso/os2/dso.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_dso_os2 = dso/os2/dso.lo
|
||||
|
||||
file_io/os2/buffer.lo: file_io/os2/buffer.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_thread_mutex.h include/apr_want.h
|
||||
file_io/os2/copy.lo: file_io/os2/copy.c .make.dirs
|
||||
file_io/os2/dir.lo: file_io/os2/dir.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
file_io/os2/dir_make_recurse.lo: file_io/os2/dir_make_recurse.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
file_io/os2/fileacc.lo: file_io/os2/fileacc.c .make.dirs
|
||||
file_io/os2/filedup.lo: file_io/os2/filedup.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
file_io/os2/filepath.lo: file_io/os2/filepath.c .make.dirs
|
||||
file_io/os2/filepath_util.lo: file_io/os2/filepath_util.c .make.dirs
|
||||
file_io/os2/filestat.lo: file_io/os2/filestat.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
file_io/os2/filesys.lo: file_io/os2/filesys.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
|
||||
file_io/os2/flock.lo: file_io/os2/flock.c .make.dirs
|
||||
file_io/os2/fullrw.lo: file_io/os2/fullrw.c .make.dirs
|
||||
file_io/os2/maperrorcode.lo: file_io/os2/maperrorcode.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_pools.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
file_io/os2/mktemp.lo: file_io/os2/mktemp.c .make.dirs
|
||||
file_io/os2/open.lo: file_io/os2/open.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
file_io/os2/pipe.lo: file_io/os2/pipe.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
file_io/os2/readwrite.lo: file_io/os2/readwrite.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
file_io/os2/seek.lo: file_io/os2/seek.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_lib.h include/apr_pools.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
file_io/os2/tempdir.lo: file_io/os2/tempdir.c .make.dirs
|
||||
|
||||
OBJECTS_file_io_os2 = file_io/os2/buffer.lo file_io/os2/copy.lo file_io/os2/dir.lo file_io/os2/dir_make_recurse.lo file_io/os2/fileacc.lo file_io/os2/filedup.lo file_io/os2/filepath.lo file_io/os2/filepath_util.lo file_io/os2/filestat.lo file_io/os2/filesys.lo file_io/os2/flock.lo file_io/os2/fullrw.lo file_io/os2/maperrorcode.lo file_io/os2/mktemp.lo file_io/os2/open.lo file_io/os2/pipe.lo file_io/os2/readwrite.lo file_io/os2/seek.lo file_io/os2/tempdir.lo
|
||||
|
||||
locks/os2/proc_mutex.lo: locks/os2/proc_mutex.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
locks/os2/thread_cond.lo: locks/os2/thread_cond.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
locks/os2/thread_mutex.lo: locks/os2/thread_mutex.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
locks/os2/thread_rwlock.lo: locks/os2/thread_rwlock.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_locks_os2 = locks/os2/proc_mutex.lo locks/os2/thread_cond.lo locks/os2/thread_mutex.lo locks/os2/thread_rwlock.lo
|
||||
|
||||
network_io/os2/inet_ntop.lo: network_io/os2/inet_ntop.c .make.dirs
|
||||
network_io/os2/inet_pton.lo: network_io/os2/inet_pton.c .make.dirs
|
||||
network_io/os2/os2calls.lo: network_io/os2/os2calls.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
network_io/os2/sendrecv.lo: network_io/os2/sendrecv.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_pools.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
network_io/os2/sendrecv_udp.lo: network_io/os2/sendrecv_udp.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_pools.h include/apr_support.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
network_io/os2/sockaddr.lo: network_io/os2/sockaddr.c .make.dirs
|
||||
network_io/os2/socket_util.lo: network_io/os2/socket_util.c .make.dirs
|
||||
network_io/os2/sockets.lo: network_io/os2/sockets.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
network_io/os2/sockopt.lo: network_io/os2/sockopt.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_network_io_os2 = network_io/os2/inet_ntop.lo network_io/os2/inet_pton.lo network_io/os2/os2calls.lo network_io/os2/sendrecv.lo network_io/os2/sendrecv_udp.lo network_io/os2/sockaddr.lo network_io/os2/socket_util.lo network_io/os2/sockets.lo network_io/os2/sockopt.lo
|
||||
|
||||
poll/os2/poll.lo: poll/os2/poll.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_network_io.h include/apr_poll.h include/apr_pools.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
poll/os2/pollset.lo: poll/os2/pollset.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_network_io.h include/apr_poll.h include/apr_pools.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_poll_os2 = poll/os2/poll.lo poll/os2/pollset.lo
|
||||
|
||||
shmem/os2/shm.lo: shmem/os2/shm.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_shmem_os2 = shmem/os2/shm.lo
|
||||
|
||||
threadproc/os2/proc.lo: threadproc/os2/proc.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_signal.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
threadproc/os2/signals.lo: threadproc/os2/signals.c .make.dirs
|
||||
threadproc/os2/thread.lo: threadproc/os2/thread.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
threadproc/os2/threadpriv.lo: threadproc/os2/threadpriv.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_threadproc_os2 = threadproc/os2/proc.lo threadproc/os2/signals.lo threadproc/os2/thread.lo threadproc/os2/threadpriv.lo
|
||||
|
||||
OBJECTS_os2 = $(OBJECTS_all) $(OBJECTS_atomic_unix) $(OBJECTS_dso_os2) $(OBJECTS_file_io_os2) $(OBJECTS_locks_os2) $(OBJECTS_memory_unix) $(OBJECTS_misc_unix) $(OBJECTS_mmap_unix) $(OBJECTS_network_io_os2) $(OBJECTS_poll_os2) $(OBJECTS_random_unix) $(OBJECTS_shmem_os2) $(OBJECTS_support_unix) $(OBJECTS_threadproc_os2) $(OBJECTS_time_unix) $(OBJECTS_user_unix)
|
||||
|
||||
dso/os390/dso.lo: dso/os390/dso.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_dso_os390 = dso/os390/dso.lo
|
||||
|
||||
atomic/os390/atomic.lo: atomic/os390/atomic.c .make.dirs include/apr_allocator.h include/apr_atomic.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_thread_mutex.h include/apr_want.h
|
||||
|
||||
OBJECTS_atomic_os390 = atomic/os390/atomic.lo
|
||||
|
||||
OBJECTS_os390 = $(OBJECTS_all) $(OBJECTS_atomic_os390) $(OBJECTS_dso_os390) $(OBJECTS_file_io_unix) $(OBJECTS_locks_unix) $(OBJECTS_memory_unix) $(OBJECTS_misc_unix) $(OBJECTS_mmap_unix) $(OBJECTS_network_io_unix) $(OBJECTS_poll_unix) $(OBJECTS_random_unix) $(OBJECTS_shmem_unix) $(OBJECTS_support_unix) $(OBJECTS_threadproc_unix) $(OBJECTS_time_unix) $(OBJECTS_user_unix)
|
||||
|
||||
dso/win32/dso.lo: dso/win32/dso.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
|
||||
|
||||
OBJECTS_dso_win32 = dso/win32/dso.lo
|
||||
|
||||
file_io/win32/buffer.lo: file_io/win32/buffer.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_thread_mutex.h include/apr_want.h
|
||||
file_io/win32/dir.lo: file_io/win32/dir.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
file_io/win32/filedup.lo: file_io/win32/filedup.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
file_io/win32/filepath.lo: file_io/win32/filepath.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
|
||||
file_io/win32/filestat.lo: file_io/win32/filestat.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
file_io/win32/filesys.lo: file_io/win32/filesys.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
|
||||
file_io/win32/flock.lo: file_io/win32/flock.c .make.dirs
|
||||
file_io/win32/open.lo: file_io/win32/open.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
file_io/win32/pipe.lo: file_io/win32/pipe.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
file_io/win32/readwrite.lo: file_io/win32/readwrite.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
file_io/win32/seek.lo: file_io/win32/seek.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_pools.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_file_io_win32 = file_io/unix/copy.lo file_io/unix/fileacc.lo file_io/unix/filepath_util.lo file_io/unix/fullrw.lo file_io/unix/mktemp.lo file_io/unix/tempdir.lo file_io/win32/buffer.lo file_io/win32/dir.lo file_io/win32/filedup.lo file_io/win32/filepath.lo file_io/win32/filestat.lo file_io/win32/filesys.lo file_io/win32/flock.lo file_io/win32/open.lo file_io/win32/pipe.lo file_io/win32/readwrite.lo file_io/win32/seek.lo
|
||||
|
||||
locks/win32/proc_mutex.lo: locks/win32/proc_mutex.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
locks/win32/thread_cond.lo: locks/win32/thread_cond.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
locks/win32/thread_mutex.lo: locks/win32/thread_mutex.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
locks/win32/thread_rwlock.lo: locks/win32/thread_rwlock.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_locks_win32 = locks/win32/proc_mutex.lo locks/win32/thread_cond.lo locks/win32/thread_mutex.lo locks/win32/thread_rwlock.lo
|
||||
|
||||
misc/win32/charset.lo: misc/win32/charset.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
misc/win32/env.lo: misc/win32/env.c .make.dirs include/apr_allocator.h include/apr_env.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
|
||||
misc/win32/internal.lo: misc/win32/internal.c .make.dirs
|
||||
misc/win32/misc.lo: misc/win32/misc.c .make.dirs include/apr_errno.h include/apr_lib.h
|
||||
misc/win32/rand.lo: misc/win32/rand.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
misc/win32/start.lo: misc/win32/start.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_signal.h include/apr_thread_mutex.h include/apr_want.h
|
||||
misc/win32/utf8.lo: misc/win32/utf8.c .make.dirs include/apr_errno.h
|
||||
|
||||
OBJECTS_misc_win32 = misc/unix/errorcodes.lo misc/unix/getopt.lo misc/unix/otherchild.lo misc/unix/version.lo misc/win32/charset.lo misc/win32/env.lo misc/win32/internal.lo misc/win32/misc.lo misc/win32/rand.lo misc/win32/start.lo misc/win32/utf8.lo
|
||||
|
||||
mmap/win32/mmap.lo: mmap/win32/mmap.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_mmap.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_ring.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_mmap_win32 = mmap/unix/common.lo mmap/win32/mmap.lo
|
||||
|
||||
network_io/win32/sendrecv.lo: network_io/win32/sendrecv.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_pools.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
network_io/win32/sockets.lo: network_io/win32/sockets.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
network_io/win32/sockopt.lo: network_io/win32/sockopt.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_network_io_win32 = network_io/unix/inet_ntop.lo network_io/unix/inet_pton.lo network_io/unix/multicast.lo network_io/unix/sockaddr.lo network_io/unix/socket_util.lo network_io/win32/sendrecv.lo network_io/win32/sockets.lo network_io/win32/sockopt.lo
|
||||
|
||||
shmem/win32/shm.lo: shmem/win32/shm.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_pools.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_shmem_win32 = shmem/win32/shm.lo
|
||||
|
||||
threadproc/win32/proc.lo: threadproc/win32/proc.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
threadproc/win32/signals.lo: threadproc/win32/signals.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_pools.h include/apr_signal.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
threadproc/win32/thread.lo: threadproc/win32/thread.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
threadproc/win32/threadpriv.lo: threadproc/win32/threadpriv.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_threadproc_win32 = threadproc/win32/proc.lo threadproc/win32/signals.lo threadproc/win32/thread.lo threadproc/win32/threadpriv.lo
|
||||
|
||||
time/win32/time.lo: time/win32/time.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
time/win32/timestr.lo: time/win32/timestr.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_time_win32 = time/win32/time.lo time/win32/timestr.lo
|
||||
|
||||
user/win32/groupinfo.lo: user/win32/groupinfo.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
user/win32/userinfo.lo: user/win32/userinfo.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
|
||||
|
||||
OBJECTS_user_win32 = user/win32/groupinfo.lo user/win32/userinfo.lo
|
||||
|
||||
atomic/win32/apr_atomic.lo: atomic/win32/apr_atomic.c .make.dirs include/apr_allocator.h include/apr_atomic.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_thread_mutex.h include/apr_want.h
|
||||
|
||||
OBJECTS_atomic_win32 = atomic/win32/apr_atomic.lo
|
||||
|
||||
OBJECTS_win32 = $(OBJECTS_all) $(OBJECTS_atomic_win32) $(OBJECTS_dso_win32) $(OBJECTS_file_io_win32) $(OBJECTS_locks_win32) $(OBJECTS_memory_unix) $(OBJECTS_misc_win32) $(OBJECTS_mmap_win32) $(OBJECTS_network_io_win32) $(OBJECTS_poll_unix) $(OBJECTS_random_unix) $(OBJECTS_shmem_win32) $(OBJECTS_support_unix) $(OBJECTS_threadproc_win32) $(OBJECTS_time_win32) $(OBJECTS_user_win32)
|
||||
|
||||
HEADERS = $(top_srcdir)/include/apr_allocator.h $(top_srcdir)/include/apr_atomic.h $(top_srcdir)/include/apr_dso.h $(top_srcdir)/include/apr_env.h $(top_srcdir)/include/apr_errno.h $(top_srcdir)/include/apr_file_info.h $(top_srcdir)/include/apr_file_io.h $(top_srcdir)/include/apr_fnmatch.h $(top_srcdir)/include/apr_general.h $(top_srcdir)/include/apr_getopt.h $(top_srcdir)/include/apr_global_mutex.h $(top_srcdir)/include/apr_hash.h $(top_srcdir)/include/apr_inherit.h $(top_srcdir)/include/apr_lib.h $(top_srcdir)/include/apr_mmap.h $(top_srcdir)/include/apr_network_io.h $(top_srcdir)/include/apr_poll.h $(top_srcdir)/include/apr_pools.h $(top_srcdir)/include/apr_portable.h $(top_srcdir)/include/apr_proc_mutex.h $(top_srcdir)/include/apr_random.h $(top_srcdir)/include/apr_ring.h $(top_srcdir)/include/apr_shm.h $(top_srcdir)/include/apr_signal.h $(top_srcdir)/include/apr_strings.h $(top_srcdir)/include/apr_support.h $(top_srcdir)/include/apr_tables.h $(top_srcdir)/include/apr_thread_cond.h $(top_srcdir)/include/apr_thread_mutex.h $(top_srcdir)/include/apr_thread_proc.h $(top_srcdir)/include/apr_thread_rwlock.h $(top_srcdir)/include/apr_time.h $(top_srcdir)/include/apr_user.h $(top_srcdir)/include/apr_version.h $(top_srcdir)/include/apr_want.h
|
||||
|
||||
SOURCE_DIRS = random/unix misc/win32 mmap/win32 dso/os2 time/unix network_io/win32 dso/win32 locks/unix user/unix time/win32 locks/beos tables support/unix file_io/unix mmap/unix atomic/unix threadproc/win32 poll/os2 atomic/win32 dso/os390 atomic/os390 dso/beos poll/unix passwd network_io/beos threadproc/os2 network_io/os2 shmem/win32 threadproc/beos shmem/unix network_io/unix file_io/os2 dso/aix file_io/win32 threadproc/unix misc/unix locks/win32 shmem/beos dso/unix locks/os2 user/win32 shmem/os2 memory/unix strings $(EXTRA_SOURCE_DIRS)
|
||||
|
||||
BUILD_DIRS = atomic atomic/os390 atomic/unix atomic/win32 dso dso/aix dso/beos dso/os2 dso/os390 dso/unix dso/win32 file_io file_io/os2 file_io/unix file_io/win32 locks locks/beos locks/os2 locks/unix locks/win32 memory memory/unix misc misc/unix misc/win32 mmap mmap/unix mmap/win32 network_io network_io/beos network_io/os2 network_io/unix network_io/win32 passwd poll poll/os2 poll/unix random random/unix shmem shmem/beos shmem/os2 shmem/unix shmem/win32 strings support support/unix tables threadproc threadproc/beos threadproc/os2 threadproc/unix threadproc/win32 time time/unix time/win32 user user/unix user/win32
|
||||
|
||||
.make.dirs: $(srcdir)/build-outputs.mk
|
||||
@for d in $(BUILD_DIRS); do test -d $$d || mkdir $$d; done
|
||||
@echo timestamp > $@
|
28
build.conf
Normal file
28
build.conf
Normal file
@ -0,0 +1,28 @@
|
||||
#
|
||||
# Configuration file for APR. Used by APR/build/gen-build.py
|
||||
#
|
||||
|
||||
[options]
|
||||
|
||||
# paths to platform-independent .c files to build
|
||||
paths =
|
||||
passwd/*.c
|
||||
strings/*.c
|
||||
tables/*.c
|
||||
|
||||
# directories that have platform-specific code in them. the resulting
|
||||
# pattern will be: SUBDIR/PLATFORM/*.c
|
||||
platform_dirs =
|
||||
dso file_io locks memory misc mmap network_io poll random
|
||||
shmem support threadproc time user atomic
|
||||
|
||||
# all the public headers
|
||||
headers = include/*.h
|
||||
|
||||
# aplibtool is manually built by the configure process
|
||||
# build/aplibtool.c
|
||||
|
||||
# we have a recursive makefile for the test files (for now)
|
||||
# test/*.c
|
||||
|
||||
dsp = libapr.dsp
|
134
buildconf
Executable file
134
buildconf
Executable file
@ -0,0 +1,134 @@
|
||||
#!/bin/sh
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership.
|
||||
# The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
# (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
#
|
||||
|
||||
# buildconf: Build the support scripts needed to compile from a
|
||||
# checked-out version of the source code.
|
||||
|
||||
if [ "$1" = "--verbose" -o "$1" = "-v" ]; then
|
||||
verbose="--verbose"
|
||||
shift
|
||||
fi
|
||||
|
||||
# Verify that the builder has the right config tools installed
|
||||
#
|
||||
build/buildcheck.sh $verbose || exit 1
|
||||
|
||||
libtoolize=`build/PrintPath glibtoolize1 glibtoolize libtoolize15 libtoolize14 libtoolize`
|
||||
if [ "x$libtoolize" = "x" ]; then
|
||||
echo "libtoolize not found in path"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create the libtool helper files
|
||||
#
|
||||
# Note: we copy (rather than link) them to simplify distribution.
|
||||
# Note: APR supplies its own config.guess and config.sub -- we do not
|
||||
# rely on libtool's versions
|
||||
#
|
||||
echo "buildconf: copying libtool helper files using $libtoolize"
|
||||
|
||||
# Remove any libtool files so one can switch between libtool versions
|
||||
# by simply rerunning the buildconf script.
|
||||
rm -f aclocal.m4 libtool.m4
|
||||
(cd build ; rm -f ltconfig ltmain.sh argz.m4 libtool.m4 ltoptions.m4 ltsugar.m4 ltversion.m4 lt~obsolete.m4)
|
||||
|
||||
# Determine libtool version, because --copy behaves differently
|
||||
# w.r.t. copying libtool.m4
|
||||
lt_pversion=`$libtoolize --version 2>/dev/null|sed -e 's/([^)]*)//g;s/^[^0-9]*//;s/[- ].*//g;q'`
|
||||
lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'`
|
||||
IFS=.; set $lt_version; IFS=' '
|
||||
|
||||
# libtool 1
|
||||
if test "$1" = "1"; then
|
||||
$libtoolize --copy --automake
|
||||
# Unlikely, maybe for old versions the file exists
|
||||
if [ -f libtool.m4 ]; then
|
||||
ltfile=`pwd`/libtool.m4
|
||||
else
|
||||
|
||||
# Extract all lines setting variables from libtoolize up until
|
||||
# libtool_m4 gets set
|
||||
ltfindcmd="`sed -n \"/=[^\\\`]/p;/libtool_m4=/{s/.*=/echo /p;q;}\" \
|
||||
< $libtoolize`"
|
||||
|
||||
# Get path to libtool.m4 either from LIBTOOL_M4 env var or our libtoolize based script
|
||||
ltfile=${LIBTOOL_M4-`eval "$ltfindcmd"`}
|
||||
|
||||
# Expecting the code above to be very portable, but just in case...
|
||||
if [ -z "$ltfile" -o ! -f "$ltfile" ]; then
|
||||
ltpath=`dirname $libtoolize`
|
||||
ltfile=`cd $ltpath/../share/aclocal ; pwd`/libtool.m4
|
||||
fi
|
||||
fi
|
||||
if [ ! -f $ltfile ]; then
|
||||
echo "$ltfile not found"
|
||||
exit 1
|
||||
fi
|
||||
# Do we need this anymore?
|
||||
echo "buildconf: Using libtool.m4 at ${ltfile}."
|
||||
rm -f build/libtool.m4
|
||||
cp -p $ltfile build/libtool.m4
|
||||
|
||||
# libtool 2
|
||||
elif test "$1" = "2"; then
|
||||
$libtoolize --copy --quiet $verbose
|
||||
fi
|
||||
|
||||
# Replace top_builddir by apr_builddir.
|
||||
# Wouldn't it just be better to define top_builddir??
|
||||
# Not sure, would it interfere with httpd top_builddir when bundled?
|
||||
mv build/libtool.m4 build/libtool.m4.$$
|
||||
sed -e 's/\(LIBTOOL=.*\)top_build/\1apr_build/' < build/libtool.m4.$$ > build/libtool.m4
|
||||
rm -f build/libtool.m4.$$
|
||||
|
||||
# Clean up any leftovers
|
||||
rm -f aclocal.m4 libtool.m4
|
||||
|
||||
#
|
||||
# Generate the autoconf header and ./configure
|
||||
#
|
||||
echo "buildconf: creating include/arch/unix/apr_private.h.in ..."
|
||||
${AUTOHEADER:-autoheader} $verbose
|
||||
|
||||
echo "buildconf: creating configure ..."
|
||||
### do some work to toss config.cache?
|
||||
${AUTOCONF:-autoconf} $verbose
|
||||
|
||||
# Remove autoconf 2.5x's cache directory
|
||||
rm -rf autom4te*.cache
|
||||
|
||||
echo "buildconf: generating 'make' outputs ..."
|
||||
build/gen-build.py $verbose make
|
||||
|
||||
# Create RPM Spec file
|
||||
if [ -f `which cut` ]; then
|
||||
echo "buildconf: rebuilding rpm spec file"
|
||||
( REVISION=`build/get-version.sh all include/apr_version.h APR`
|
||||
VERSION=`echo $REVISION | cut -d- -s -f1`
|
||||
RELEASE=`echo $REVISION | cut -d- -s -f2`
|
||||
if [ "x$VERSION" = "x" ]; then
|
||||
VERSION=$REVISION
|
||||
RELEASE=1
|
||||
fi
|
||||
cat ./build/rpm/apr.spec.in | \
|
||||
sed -e "s/APR_VERSION/$VERSION/" \
|
||||
-e "s/APR_RELEASE/$RELEASE/" \
|
||||
> apr.spec )
|
||||
fi
|
||||
|
||||
exit 0
|
231
config.layout
Normal file
231
config.layout
Normal file
@ -0,0 +1,231 @@
|
||||
##
|
||||
## config.layout -- Pre-defined Installation Path Layouts
|
||||
##
|
||||
## Hints:
|
||||
## - layouts can be loaded with configure's --enable-layout=ID option
|
||||
## - when no --enable-layout option is given, the default layout is `apr'
|
||||
## - a trailing plus character (`+') on paths is replaced with a
|
||||
## `/<target>' suffix where <target> is currently hardcoded to 'apr'.
|
||||
## (This may become a configurable parameter at some point.)
|
||||
##
|
||||
|
||||
# Classical APR path layout designed for parallel installs.
|
||||
<Layout apr>
|
||||
prefix: /usr/local/apr
|
||||
exec_prefix: ${prefix}
|
||||
bindir: ${exec_prefix}/bin
|
||||
sbindir: ${exec_prefix}/bin
|
||||
libdir: ${exec_prefix}/lib
|
||||
libexecdir: ${exec_prefix}/modules
|
||||
mandir: ${prefix}/man
|
||||
sysconfdir: ${prefix}/conf
|
||||
datadir: ${prefix}
|
||||
installbuilddir: ${datadir}/build-${APR_MAJOR_VERSION}
|
||||
includedir: ${prefix}/include/apr-${APR_MAJOR_VERSION}
|
||||
localstatedir: ${prefix}
|
||||
libsuffix: -${APR_MAJOR_VERSION}
|
||||
</Layout>
|
||||
|
||||
# Classical single-installation APR path layout.
|
||||
<Layout classic>
|
||||
prefix: /usr/local/apr
|
||||
exec_prefix: ${prefix}
|
||||
bindir: ${exec_prefix}/bin
|
||||
sbindir: ${exec_prefix}/bin
|
||||
libdir: ${exec_prefix}/lib
|
||||
libexecdir: ${exec_prefix}/modules
|
||||
mandir: ${prefix}/man
|
||||
sysconfdir: ${prefix}/conf
|
||||
datadir: ${prefix}
|
||||
installbuilddir: ${datadir}/build
|
||||
includedir: ${prefix}/include
|
||||
localstatedir: ${prefix}
|
||||
</Layout>
|
||||
|
||||
# GNU standards conforming path layout.
|
||||
# See FSF's GNU project `make-stds' document for details.
|
||||
<Layout GNU>
|
||||
prefix: /usr/local
|
||||
exec_prefix: ${prefix}
|
||||
bindir: ${exec_prefix}/bin
|
||||
sbindir: ${exec_prefix}/sbin
|
||||
libdir: ${exec_prefix}/lib
|
||||
libexecdir: ${exec_prefix}/libexec
|
||||
mandir: ${prefix}/man
|
||||
sysconfdir: ${prefix}/etc+
|
||||
datadir: ${prefix}/share+
|
||||
installbuilddir: ${datadir}/build
|
||||
includedir: ${prefix}/include+
|
||||
localstatedir: ${prefix}/var+
|
||||
runtimedir: ${localstatedir}/run
|
||||
</Layout>
|
||||
|
||||
# Mac OS X Server (Rhapsody)
|
||||
<Layout Mac OS X Server>
|
||||
prefix: /Local/Library/WebServer
|
||||
exec_prefix: /usr
|
||||
bindir: ${exec_prefix}/bin
|
||||
sbindir: ${exec_prefix}/sbin
|
||||
libdir: ${exec_prefix}/lib
|
||||
libexecdir: /System/Library/apr/Modules
|
||||
mandir: ${exec_prefix}/share/man
|
||||
sysconfdir: ${prefix}/Configuration
|
||||
datadir: ${prefix}
|
||||
installbuilddir: /System/Library/apr/Build
|
||||
includedir: /System/Library/Frameworks/apr.framework/Versions/2.0/Headers
|
||||
localstatedir: /var
|
||||
runtimedir: ${prefix}/Logs
|
||||
</Layout>
|
||||
|
||||
# Darwin/Mac OS Layout
|
||||
<Layout Darwin>
|
||||
prefix: /usr
|
||||
exec_prefix: ${prefix}
|
||||
bindir: ${exec_prefix}/bin
|
||||
sbindir: ${exec_prefix}/sbin
|
||||
libdir: ${exec_prefix}/lib
|
||||
libexecdir: ${exec_prefix}/libexec+
|
||||
mandir: ${prefix}/share/man
|
||||
datadir: /Library/WebServer
|
||||
sysconfdir: /etc+
|
||||
installbuilddir: ${prefix}/share/httpd/build
|
||||
includedir: ${prefix}/include+
|
||||
localstatedir: /var
|
||||
runtimedir: ${localstatedir}/run
|
||||
</Layout>
|
||||
|
||||
# Red Hat Linux 7.x layout
|
||||
<Layout RedHat>
|
||||
prefix: /usr
|
||||
exec_prefix: ${prefix}
|
||||
bindir: ${prefix}/bin
|
||||
sbindir: ${prefix}/sbin
|
||||
libdir: ${prefix}/lib
|
||||
libexecdir: ${prefix}/lib/apr
|
||||
mandir: ${prefix}/man
|
||||
sysconfdir: /etc/httpd/conf
|
||||
datadir: /var/www
|
||||
installbuilddir: ${datadir}/build
|
||||
includedir: ${prefix}/include/apr
|
||||
localstatedir: /var
|
||||
runtimedir: ${localstatedir}/run
|
||||
</Layout>
|
||||
|
||||
# According to the /opt filesystem conventions
|
||||
<Layout opt>
|
||||
prefix: /opt/apr
|
||||
exec_prefix: ${prefix}
|
||||
bindir: ${exec_prefix}/bin
|
||||
sbindir: ${exec_prefix}/sbin
|
||||
libdir: ${exec_prefix}/lib
|
||||
libexecdir: ${exec_prefix}/libexec
|
||||
mandir: ${prefix}/man
|
||||
sysconfdir: /etc${prefix}
|
||||
datadir: ${prefix}/share
|
||||
installbuilddir: ${datadir}/build
|
||||
includedir: ${prefix}/include
|
||||
localstatedir: /var${prefix}
|
||||
runtimedir: ${localstatedir}/run
|
||||
</Layout>
|
||||
|
||||
# BeOS layout...
|
||||
<Layout beos>
|
||||
prefix: /boot/home/apr
|
||||
exec_prefix: ${prefix}
|
||||
bindir: ${exec_prefix}/bin
|
||||
sbindir: ${exec_prefix}/bin
|
||||
libdir: ${exec_prefix}/lib
|
||||
libexecdir: ${exec_prefix}/libexec
|
||||
mandir: ${prefix}/man
|
||||
sysconfdir: ${prefix}/conf
|
||||
datadir: ${prefix}
|
||||
installbuilddir: ${datadir}/build
|
||||
includedir: ${prefix}/include
|
||||
localstatedir: ${prefix}
|
||||
runtimedir: ${localstatedir}/logs
|
||||
</Layout>
|
||||
|
||||
# SuSE 6.x layout
|
||||
<Layout SuSE>
|
||||
prefix: /usr
|
||||
exec_prefix: ${prefix}
|
||||
bindir: ${prefix}/bin
|
||||
sbindir: ${prefix}/sbin
|
||||
libdir: ${prefix}/lib
|
||||
libexecdir: ${prefix}/lib/apr
|
||||
mandir: ${prefix}/share/man
|
||||
sysconfdir: /etc/httpd
|
||||
datadir: /usr/local/httpd
|
||||
installbuilddir: ${datadir}/build
|
||||
includedir: ${prefix}/include/apr
|
||||
localstatedir: /var/lib/httpd
|
||||
runtimedir: /var/run
|
||||
</Layout>
|
||||
|
||||
# BSD/OS layout
|
||||
<Layout BSDI>
|
||||
prefix: /var/www
|
||||
exec_prefix: /usr/contrib
|
||||
bindir: ${exec_prefix}/bin
|
||||
sbindir: ${exec_prefix}/bin
|
||||
libdir: ${exec_prefix}/lib
|
||||
libexecdir: ${exec_prefix}/libexec/apr
|
||||
mandir: ${exec_prefix}/man
|
||||
sysconfdir: ${prefix}/conf
|
||||
datadir: ${prefix}
|
||||
installbuilddir: ${datadir}/build
|
||||
includedir: ${exec_prefix}/include/apr
|
||||
localstatedir: /var
|
||||
runtimedir: ${localstatedir}/run
|
||||
</Layout>
|
||||
|
||||
# Solaris 8 Layout
|
||||
<Layout Solaris>
|
||||
prefix: /usr/apr
|
||||
exec_prefix: ${prefix}
|
||||
bindir: ${exec_prefix}/bin
|
||||
sbindir: ${exec_prefix}/bin
|
||||
libdir: ${exec_prefix}/lib
|
||||
libexecdir: ${exec_prefix}/libexec
|
||||
mandir: ${exec_prefix}/man
|
||||
sysconfdir: /etc/apr
|
||||
datadir: /var/apr
|
||||
installbuilddir: ${datadir}/build
|
||||
includedir: ${exec_prefix}/include
|
||||
localstatedir: ${prefix}
|
||||
runtimedir: /var/run
|
||||
</Layout>
|
||||
|
||||
# OpenBSD Layout
|
||||
<Layout OpenBSD>
|
||||
prefix: /var/www
|
||||
exec_prefix: /usr
|
||||
bindir: ${exec_prefix}/bin
|
||||
sbindir: ${exec_prefix}/sbin
|
||||
libdir: ${exec_prefix}/lib
|
||||
libexecdir: ${exec_prefix}/lib/apr/modules
|
||||
mandir: ${exec_prefix}/share/man
|
||||
sysconfdir: ${prefix}/conf
|
||||
datadir: ${prefix}
|
||||
installbuilddir: ${prefix}/build
|
||||
includedir: ${exec_prefix}/lib/apr/include
|
||||
localstatedir: ${prefix}
|
||||
runtimedir: ${prefix}/logs
|
||||
</Layout>
|
||||
|
||||
# Debian layout
|
||||
<Layout Debian>
|
||||
prefix:
|
||||
exec_prefix: ${prefix}/usr
|
||||
bindir: ${exec_prefix}/bin
|
||||
sbindir: ${exec_prefix}/sbin
|
||||
libdir: ${exec_prefix}/lib
|
||||
libexecdir: ${exec_prefix}/lib/apr/modules
|
||||
mandir: ${exec_prefix}/share/man
|
||||
datadir: ${exec_prefix}/share/apr
|
||||
includedir: ${exec_prefix}/include/apr-${APR_MAJOR_VERSION}
|
||||
localstatedir: ${prefix}/var/run
|
||||
runtimedir: ${prefix}/var/run
|
||||
infodir: ${exec_prefix}/share/info
|
||||
libsuffix: -${APR_MAJOR_VERSION}
|
||||
</Layout>
|
2809
configure.in
Normal file
2809
configure.in
Normal file
File diff suppressed because it is too large
Load Diff
399
docs/APRDesign.html
Normal file
399
docs/APRDesign.html
Normal file
@ -0,0 +1,399 @@
|
||||
<HTML>
|
||||
<HEAD><TITLE>APR Design Document</TITLE></HEAD>
|
||||
<BODY>
|
||||
<h1>Design of APR</h1>
|
||||
|
||||
<p>The Apache Portable Run-time libraries have been designed to provide a common
|
||||
interface to low level routines across any platform. The original goal of APR
|
||||
was to combine all code in Apache to one common code base. This is not the
|
||||
correct approach however, so the goal of APR has changed. There are places
|
||||
where common code is not a good thing. For example, how to map requests
|
||||
to either threads or processes should be platform specific. APR's place
|
||||
is now to combine any code that can be safely combined without sacrificing
|
||||
performance.</p>
|
||||
|
||||
<p>To this end we have created a set of operations that are required for cross
|
||||
platform development. There may be other types that are desired and those
|
||||
will be implemented in the future.</p>
|
||||
|
||||
<p>This document will discuss the structure of APR, and how best to contribute
|
||||
code to the effort.</p>
|
||||
|
||||
<h2>APR On Windows and Netware</h2>
|
||||
|
||||
<p>APR on Windows and Netware is different from APR on all other systems,
|
||||
because those platforms don't use autoconf. On Unix, apr_private.h (private to
|
||||
APR) and apr.h (public, used by applications that use APR) are generated by
|
||||
autoconf from acconfig.h and apr.h.in respectively. On Windows (and Netware),
|
||||
apr_private.h and apr.h are created from apr_private.hw (apr_private.hwn)
|
||||
and apr.hw (apr.hwn) respectively.</p>
|
||||
|
||||
<p> <strong>
|
||||
If you add code to acconfig.h or tests to configure.in or aclocal.m4,
|
||||
please give some thought to whether or not Windows and Netware need
|
||||
these additions as well. A general rule of thumb, is that if it is
|
||||
a feature macro, such as APR_HAS_THREADS, Windows and Netware need it.
|
||||
In other words, if the definition is going to be used in a public APR
|
||||
header file, such as apr_general.h, Windows needs it.
|
||||
|
||||
The only time it is safe to add a macro or test without also adding
|
||||
the macro to apr*.h[n]w, is if the macro tells APR how to build. For
|
||||
example, a test for a header file does not need to be added to Windows.
|
||||
</strong></p>
|
||||
|
||||
<h2>APR Features</h2>
|
||||
|
||||
<p>One of the goals of APR is to provide a common set of features across all
|
||||
platforms. This is an admirable goal, it is also not realistic. We cannot
|
||||
expect to be able to implement ALL features on ALL platforms. So we are
|
||||
going to do the next best thing. Provide a common interface to ALL APR
|
||||
features on MOST platforms.</p>
|
||||
|
||||
<p>APR developers should create FEATURE MACROS for any feature that is not
|
||||
available on ALL platforms. This should be a simple definition which has
|
||||
the form:</p>
|
||||
|
||||
<code>APR_HAS_FEATURE</code>
|
||||
|
||||
<p>This macro should evaluate to true if APR has this feature on this platform.
|
||||
For example, Linux and Windows have mmap'ed files, and APR is providing an
|
||||
interface for mmapp'ing a file. On both Linux and Windows, APR_HAS_MMAP
|
||||
should evaluate to one, and the ap_mmap_* functions should map files into
|
||||
memory and return the appropriate status codes.</p>
|
||||
|
||||
<p>If your OS of choice does not have mmap'ed files, APR_HAS_MMAP should
|
||||
evaluate to zero, and all ap_mmap_* functions should not be defined. The
|
||||
second step is a precaution that will allow us to break at compile time if a
|
||||
programmer tries to use unsupported functions.</p>
|
||||
|
||||
<h2>APR types</h2>
|
||||
|
||||
<p>The base types in APR</p>
|
||||
|
||||
<ul>
|
||||
<li>dso<br>
|
||||
Shared library routines
|
||||
<li>mmap<br>
|
||||
Memory-mapped files
|
||||
<li>poll<br>
|
||||
Polling I/O
|
||||
<li>time<br>
|
||||
Time
|
||||
<li>user<br>
|
||||
Users and groups
|
||||
<li>locks<br>
|
||||
Process and thread locks (critical sections)
|
||||
<li>shmem<br>
|
||||
Shared memory
|
||||
<li>file_io<br>
|
||||
File I/O, including pipes
|
||||
<li>atomic<br>
|
||||
Atomic integer operations
|
||||
<li>strings<br>
|
||||
String handling routines
|
||||
<li>memory<br>
|
||||
Pool-based memory allocation
|
||||
<li>passwd<br>
|
||||
Reading passwords from the terminal
|
||||
<li>tables<br>
|
||||
Tables and hashes
|
||||
<li>network_io<br>
|
||||
Network I/O
|
||||
<li>threadproc<br>
|
||||
Threads and processes
|
||||
<li>misc<br>
|
||||
Any APR type which doesn't have any other place to belong. This
|
||||
should be used sparingly.
|
||||
<li>support<br>
|
||||
Functions meant to be used across multiple APR types. This area
|
||||
is for internal functions only. If a function is exposed, it should
|
||||
not be put here.
|
||||
</ul>
|
||||
|
||||
<h2>Directory Structure</h2>
|
||||
|
||||
<p>Each type has a base directory. Inside this base directory, are
|
||||
subdirectories, which contain the actual code. These subdirectories are named
|
||||
after the platforms the are compiled on. Unix is also used as a common
|
||||
directory. If the code you are writing is POSIX based, you should look at the
|
||||
code in the unix directory. A good rule of thumb, is that if more than half
|
||||
your code needs to be ifdef'ed out, and the structures required for your code
|
||||
are substantively different from the POSIX code, you should create a new
|
||||
directory.</p>
|
||||
|
||||
<p>Currently, the APR code is written for Unix, BeOS, Windows, and OS/2. An
|
||||
example of the directory structure is the file I/O directory:</p>
|
||||
|
||||
<pre>
|
||||
apr
|
||||
|
|
||||
-> file_io
|
||||
|
|
||||
-> unix The Unix and common base code
|
||||
|
|
||||
-> win32 The Windows code
|
||||
|
|
||||
-> os2 The OS/2 code
|
||||
</pre>
|
||||
|
||||
<p>Obviously, BeOS does not have a directory. This is because BeOS is currently
|
||||
using the Unix directory for it's file_io.</p>
|
||||
|
||||
<p>There are a few special top level directories. These are test and include.
|
||||
Test is a directory which stores all test programs. It is expected
|
||||
that if a new type is developed, there will also be a new test program, to
|
||||
help people port this new type to different platforms. A small document
|
||||
describing how to create new tests that integrate with the test suite can be
|
||||
found in the test/ directory. Include is a directory which stores all
|
||||
required APR header files for external use.</p>
|
||||
|
||||
<h2>Creating an APR Type</h2>
|
||||
|
||||
<p>The current design of APR requires that most APR types be incomplete.
|
||||
It is not possible to write flexible portable code if programs can access
|
||||
the internals of APR types. This is because different platforms are
|
||||
likely to define different native types. There are only two execptions to
|
||||
this rule:</p>
|
||||
|
||||
<ul>
|
||||
<li>The first exception to this rule is if the type can only reasonably be
|
||||
implemented one way. For example, time is a complete type because there
|
||||
is only one reasonable time implementation.
|
||||
|
||||
<li>The second exception to the incomplete type rule can be found in
|
||||
apr_portable.h. This file defines the native types for each platform.
|
||||
Using these types, it is possible to extract native types for any APR type.</p>
|
||||
</ul>
|
||||
|
||||
<p>For this reason, each platform defines a structure in their own directories.
|
||||
Those structures are then typedef'ed in an external header file. For example
|
||||
in file_io/unix/fileio.h:</p>
|
||||
|
||||
<pre>
|
||||
struct ap_file_t {
|
||||
apr_pool_t *cntxt;
|
||||
int filedes;
|
||||
FILE *filehand;
|
||||
...
|
||||
}
|
||||
</pre>
|
||||
|
||||
<p>In include/apr_file_io.h:</p>
|
||||
</pre>
|
||||
typedef struct ap_file_t ap_file_t;
|
||||
</pre>
|
||||
|
||||
<p> This will cause a compiler error if somebody tries to access the filedes
|
||||
field in this structure. Windows does not have a filedes field, so obviously,
|
||||
it is important that programs not be able to access these.</p>
|
||||
|
||||
<p>You may notice the apr_pool_t field. Most APR types have this field. This
|
||||
type is used to allocate memory within APR. Because every APR type has a pool,
|
||||
any APR function can allocate memory if it needs to. This is very important
|
||||
and it is one of the reasons that APR works. If you create a new type, you
|
||||
must add a pool to it. If you do not, then all functions that operate on that
|
||||
type will need a pool argument.</p>
|
||||
|
||||
<h2>New Function</h2>
|
||||
|
||||
<p>When creating a new function, please try to adhere to these rules.</p>
|
||||
|
||||
<ul>
|
||||
<li> Result arguments should be the first arguments.
|
||||
<li> If a function needs a pool, it should be the last argument.
|
||||
<li> These rules are flexible, especially if it makes the code easier
|
||||
to understand because it mimics a standard function.
|
||||
</ul>
|
||||
|
||||
<h2>Documentation</h2>
|
||||
|
||||
<p>Whenever a new function is added to APR, it MUST be documented. New
|
||||
functions will not be committed unless there are docs to go along with them.
|
||||
The documentation should be a comment block above the function in the header
|
||||
file.</p>
|
||||
|
||||
<p>The format for the comment block is:</p>
|
||||
|
||||
<pre>
|
||||
/**
|
||||
* Brief description of the function
|
||||
* @param parma_1_name explanation
|
||||
* @param parma_2_name explanation
|
||||
* @param parma_n_name explanation
|
||||
* @tip Any extra information people should know.
|
||||
* @deffunc function prototype if required
|
||||
*/
|
||||
</pre>
|
||||
|
||||
<p>For an actual example, look at any file in the include directory. The
|
||||
reason the docs are in the header files is to ensure that the docs always
|
||||
reflect the current code. If you change paramters or return values for a
|
||||
function, please be sure to update the documentation.</p>
|
||||
|
||||
<h2>APR Error reporting</h2>
|
||||
|
||||
<p>Most APR functions should return an ap_status_t type. The only time an
|
||||
APR function does not return an ap_status_t is if it absolutely CAN NOT
|
||||
fail. Examples of this would be filling out an array when you know you are
|
||||
not beyond the array's range. If it cannot fail on your platform, but it
|
||||
could conceivably fail on another platform, it should return an ap_status_t.
|
||||
Unless you are sure, return an ap_status_t.</p>
|
||||
|
||||
<strong>
|
||||
This includes functions that return TRUE/FALSE values. How that
|
||||
is handled is discussed below
|
||||
</strong>
|
||||
|
||||
<p>All platforms return errno values unchanged. Each platform can also have
|
||||
one system error type, which can be returned after an offset is added.
|
||||
There are five types of error values in APR, each with it's own offset.</p>
|
||||
|
||||
<!-- This should be turned into a table, but I am lazy today -->
|
||||
<pre>
|
||||
Name Purpose
|
||||
0) This is 0 for all platforms and isn't really defined
|
||||
anywhere, but it is the offset for errno values.
|
||||
(This has no name because it isn't actually defined,
|
||||
but for completeness we are discussing it here).
|
||||
|
||||
1) APR_OS_START_ERROR This is platform dependent, and is the offset at which
|
||||
APR errors start to be defined. Error values are
|
||||
defined as anything which caused the APR function to
|
||||
fail. APR errors in this range should be named
|
||||
APR_E* (i.e. APR_ENOSOCKET)
|
||||
|
||||
2) APR_OS_START_STATUS This is platform dependent, and is the offset at which
|
||||
APR status values start. Status values do not indicate
|
||||
success or failure, and should be returned if
|
||||
APR_SUCCESS does not make sense. APR status codes in
|
||||
this range should be name APR_* (i.e. APR_DETACH)
|
||||
|
||||
4) APR_OS_START_USEERR This is platform dependent, and is the offset at which
|
||||
APR apps can begin to add their own error codes.
|
||||
|
||||
3) APR_OS_START_SYSERR This is platform dependent, and is the offset at which
|
||||
system error values begin.
|
||||
</pre>
|
||||
|
||||
<strong>The difference in naming between APR_OS_START_ERROR and
|
||||
APR_OS_START_STATUS mentioned above allows programmers to easily determine if
|
||||
the error code indicates an error condition or a status codition.</strong>
|
||||
|
||||
<p>If your function has multiple return codes that all indicate success, but
|
||||
with different results, or if your function can only return PASS/FAIL, you
|
||||
should still return an apr_status_t. In the first case, define one
|
||||
APR status code for each return value, an example of this is
|
||||
<code>apr_proc_wait</code>, which can only return APR_CHILDDONE,
|
||||
APR_CHILDNOTDONE, or an error code. In the second case, please return
|
||||
APR_SUCCESS for PASS, and define a new APR status code for failure, an
|
||||
example of this is <code>apr_compare_users</code>, which can only return
|
||||
APR_SUCCESS, APR_EMISMATCH, or an error code.</p>
|
||||
|
||||
<p>All of these definitions can be found in apr_errno.h for all platforms. When
|
||||
an error occurs in an APR function, the function must return an error code.
|
||||
If the error occurred in a system call and that system call uses errno to
|
||||
report an error, then the code is returned unchanged. For example: </p>
|
||||
|
||||
<pre>
|
||||
if (open(fname, oflags, 0777) < 0)
|
||||
return errno;
|
||||
</pre>
|
||||
|
||||
<p>The next place an error can occur is a system call that uses some error value
|
||||
other than the primary error value on a platform. This can also be handled
|
||||
by APR applications. For example:</p>
|
||||
|
||||
<pre>
|
||||
if (CreateFile(fname, oflags, sharemod, NULL,
|
||||
createflags, attributes, 0) == INVALID_HANDLE_VALUE
|
||||
return (GetLAstError() + APR_OS_START_SYSERR);
|
||||
</pre>
|
||||
|
||||
<p>These two examples implement the same function for two different platforms.
|
||||
Obviously even if the underlying problem is the same on both platforms, this
|
||||
will result in two different error codes being returned. This is OKAY, and
|
||||
is correct for APR. APR relies on the fact that most of the time an error
|
||||
occurs, the program logs the error and continues, it does not try to
|
||||
programatically solve the problem. This does not mean we have not provided
|
||||
support for programmatically solving the problem, it just isn't the default
|
||||
case. We'll get to how this problem is solved in a little while.</p>
|
||||
|
||||
<p>If the error occurs in an APR function but it is not due to a system call,
|
||||
but it is actually an APR error or just a status code from APR, then the
|
||||
appropriate code should be returned. These codes are defined in apr_errno.h
|
||||
and should be self explanatory.</p>
|
||||
|
||||
<p>No APR code should ever return a code between APR_OS_START_USEERR and
|
||||
APR_OS_START_SYSERR, those codes are reserved for APR applications.</p>
|
||||
|
||||
<p>To programmatically correct an error in a running application, the error
|
||||
codes need to be consistent across platforms. This should make sense. APR
|
||||
has provided macros to test for status code equivalency. For example, to
|
||||
determine if the code that you received from the APR function means EOF, you
|
||||
would use the macro APR_STATUS_IS_EOF().</p>
|
||||
|
||||
<p>Why did APR take this approach? There are two ways to deal with error
|
||||
codes portably.</p>
|
||||
|
||||
<ol type=1>
|
||||
<li> Return the same error code across all platforms.
|
||||
<li> Return platform specific error codes and convert them when necessary.
|
||||
</ol>
|
||||
|
||||
<p>The problem with option number one is that it takes time to convert error
|
||||
codes to a common code, and most of the time programs want to just output
|
||||
an error string. If we convert all errors to a common subset, we have four
|
||||
steps to output an error string:</p>
|
||||
|
||||
<p>The seocnd problem with option 1, is that it is a lossy conversion. For
|
||||
example, Windows and OS/2 have a couple hundred error codes, but POSIX errno
|
||||
only defines about 50 errno values. This means that if we convert to a
|
||||
canonical error value immediately, there is no way for the programmer to
|
||||
get the actual system error.</p>
|
||||
|
||||
<pre>
|
||||
make syscall that fails
|
||||
convert to common error code step 1
|
||||
return common error code
|
||||
check for success
|
||||
call error output function step 2
|
||||
convert back to system error step 3
|
||||
output error string step 4
|
||||
</pre>
|
||||
|
||||
<p>By keeping the errors platform specific, we can output error strings in two
|
||||
steps.</p>
|
||||
|
||||
<pre>
|
||||
make syscall that fails
|
||||
return error code
|
||||
check for success
|
||||
call error output function step 1
|
||||
output error string step 2
|
||||
</pre>
|
||||
|
||||
<p>Less often, programs change their execution based on what error was returned.
|
||||
This is no more expensive using option 2 than it is using option 1, but we
|
||||
put the onus of converting the error code on the programmer themselves.
|
||||
For example, using option 1:</p>
|
||||
|
||||
<pre>
|
||||
make syscall that fails
|
||||
convert to common error code
|
||||
return common error code
|
||||
decide execution based on common error code
|
||||
</pre>
|
||||
|
||||
<p>Using option 2:</p>
|
||||
|
||||
<pre>
|
||||
make syscall that fails
|
||||
return error code
|
||||
convert to common error code (using ap_canonical_error)
|
||||
decide execution based on common error code
|
||||
</pre>
|
||||
|
||||
<p>Finally, there is one more operation on error codes. You can get a string
|
||||
that explains in human readable form what has happened. To do this using
|
||||
APR, call ap_strerror().</p>
|
||||
|
156
docs/canonical_filenames.html
Normal file
156
docs/canonical_filenames.html
Normal file
@ -0,0 +1,156 @@
|
||||
<HTML>
|
||||
<HEAD><TITLE>APR Canonical Filenames</TITLE></HEAD>
|
||||
<BODY>
|
||||
<h1>APR Canonical Filename</h1>
|
||||
|
||||
<h2>Requirements</h2>
|
||||
|
||||
<p>APR porters need to address the underlying discrepancies between
|
||||
file systems. To achieve a reasonable degree of security, the
|
||||
program depending upon APR needs to know that two paths may be
|
||||
compared, and that a mismatch is guarenteed to reflect that the
|
||||
two paths do not return the same resource</p>.
|
||||
|
||||
<p>The first discrepancy is in volume roots. Unix and pure deriviates
|
||||
have only one root path, "/". Win32 and OS2 share root paths of
|
||||
the form "D:/", D: is the volume designation. However, this can
|
||||
be specified as "//./D:/" as well, indicating D: volume of the
|
||||
'this' machine. Win32 and OS2 also may employ a UNC root path,
|
||||
of the form "//server/share/" where share is a share-point of the
|
||||
specified network server. Finally, NetWare root paths are of the
|
||||
form "server/volume:/", or the simpler "volume:/" syntax for 'this'
|
||||
machine. All these non-Unix file systems accept volume:path,
|
||||
without a slash following the colon, as a path relative to the
|
||||
current working directory, which APR will treat as ambigious, that
|
||||
is, neither an absolute nor a relative path per se.</p>
|
||||
|
||||
<p>The second discrepancy is in the meaning of the 'this' directory.
|
||||
In general, 'this' must be eliminated from the path where it occurs.
|
||||
The syntax "path/./" and "path/" are both aliases to path. However,
|
||||
this isn't file system independent, since the double slash "//" has
|
||||
a special meaning on OS2 and Win32 at the start of the path name,
|
||||
and is invalid on those platforms before the "//server/share/" UNC
|
||||
root path is completed. Finally, as noted above, "//./volume/" is
|
||||
legal root syntax on WinNT, and perhaps others.</p>
|
||||
|
||||
<p>The third discrepancy is in the context of the 'parent' directory.
|
||||
When "parent/path/.." occurs, the path must be unwound to "parent".
|
||||
It's also critical to simply truncate leading "/../" paths to "/",
|
||||
since the parent of the root is root. This gets tricky on the
|
||||
Win32 and OS2 platforms, since the ".." element is invalid before
|
||||
the "//server/share/" is complete, and the "//server/share/../"
|
||||
seqence is the complete UNC root "//server/share/". In relative
|
||||
paths, leading ".." elements are significant, until they are merged
|
||||
with an absolute path. The relative form must only retain the ".."
|
||||
segments as leading segments, to be resolved once merged to another
|
||||
relative or an absolute path.</p>
|
||||
|
||||
<p>The fourth discrepancy occurs with acceptance of alternate character
|
||||
codes for the same element. Path seperators are not retained within
|
||||
the APR canonical forms. The OS filesystem and APR (slashed) forms
|
||||
can both be returned as strings, to be used in the proper context.
|
||||
Unix, Win32 and Netware all accept slashes and backslashes as the
|
||||
same path seperator symbol, although unix strictly accepts slashes.
|
||||
While the APR form of the name strictly uses slashes, always consider
|
||||
that there could be a platform that actually accepts slashes as a
|
||||
character within a segment name.</p>
|
||||
|
||||
<p>The fifth and worst discrepancy plauges Win32, OS2, Netware, and some
|
||||
filesystems mounted in Unix. Case insensitivity can permit the same
|
||||
file to slip through in both it's proper case and alternate cases.
|
||||
Simply changing the case is insufficient for any character set beyond
|
||||
ASCII, since various dilectic forms of characters suffer from one to
|
||||
many or many to one translations. An example would be u-umlaut, which
|
||||
might be accepted as a single character u-umlaut, a two character
|
||||
sequence u and the zero-width umlaut, the upper case form of the same,
|
||||
or perhaps even a captial U alone. This can be handled in different
|
||||
ways depending on the purposes of the APR based program, but the one
|
||||
requirement is that the path must be absolute in order to resolve these
|
||||
ambiguities. Methods employed include comparison of device and inode
|
||||
file uniqifiers, which is a fairly fast operation, or quering the OS
|
||||
for the true form of the name, which can be much slower. Only the
|
||||
acknowledgement of the file names by the OS can validate the equality
|
||||
of two different cases of the same filename.</p>
|
||||
|
||||
<p>The sixth discrepancy, illegal or insignificant characters, is especially
|
||||
significant in non-unix file systems. Trailing periods are accepted
|
||||
but never stored, therefore trailing periods must be ignored for any
|
||||
form of comparison. And all OS's have certain expectations of what
|
||||
characters are illegal (or undesireable due to confusion.)</p>
|
||||
|
||||
<p>A final warning, canonical functions don't transform or resolve case
|
||||
or character ambiguity issues until they are resolved into an absolute
|
||||
path. The relative canonical path, while useful, while useful for URL
|
||||
or similar identifiers, cannot be used for testing or comparison of file
|
||||
system objects.</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>Canonical API</h2>
|
||||
|
||||
Functions to manipulate the apr_canon_file_t (an opaque type) include:
|
||||
|
||||
<ul>
|
||||
<li>Create canon_file_t (from char* path and canon_file_t parent path)
|
||||
<li>Merged canon_file_t (from path and parent, both canon_file_t)
|
||||
<li>Get char* path of all or some segments
|
||||
<li>Get path flags of IsRelative, IsVirtualRoot, and IsAbsolute
|
||||
<li>Compare two canon_file_t structures for file equality
|
||||
</ul>
|
||||
|
||||
<p>The path is corrected to the file system case only if is in absolute
|
||||
form. The apr_canon_file_t should be preserved as long as possible and
|
||||
used as the parent to create child entries to reduce the number of expensive
|
||||
stat and case canonicalization calls to the OS.</p>
|
||||
|
||||
<p>The comparison operation provides that the APR can postpone correction
|
||||
of case by simply relying upon the device and inode for equivilance. The
|
||||
stat implementation provides that two files are the same, while their
|
||||
strings are not equivilant, and eliminates the need for the operating
|
||||
system to return the proper form of the name.</p>
|
||||
|
||||
<p>In any case, returning the char* path, with a flag to request the proper
|
||||
case, forces the OS calls to resolve the true names of each segment. Where
|
||||
there is a penality for this operation and the stat device and inode test
|
||||
is faster, case correction is postponed until the char* result is requested.
|
||||
On platforms that identify the inode, device, or proper name interchangably
|
||||
with no penalities, this may occur when the name is initially processed.</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<h2>Unix Example</h2>
|
||||
|
||||
<p>First the simplest case:</p>
|
||||
|
||||
<pre>
|
||||
Parse Canonical Name
|
||||
accepts parent path as canonical_t
|
||||
this path as string
|
||||
|
||||
Split this path Segments on '/'
|
||||
|
||||
For each of this path Segments
|
||||
If first Segment
|
||||
If this Segment is Empty ([nothing]/)
|
||||
Append this Root Segment (don't merge)
|
||||
Continue to next Segment
|
||||
Else is relative
|
||||
Append parent Segments (to merge)
|
||||
Continue with this Segment
|
||||
If Segment is '.' or empty (2 slashes)
|
||||
Discard this Segment
|
||||
Continue with next Segment
|
||||
If Segment is '..'
|
||||
If no previous Segment or previous Segment is '..'
|
||||
Append this Segment
|
||||
Continue with next Segment
|
||||
If previous Segment and previous is not Root Segment
|
||||
Discard previous Segment
|
||||
Discard this Segment
|
||||
Continue with next Segment
|
||||
Append this Relative Segment
|
||||
Continue with next Segment
|
||||
</pre>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
38
docs/doxygen.conf
Normal file
38
docs/doxygen.conf
Normal file
@ -0,0 +1,38 @@
|
||||
PROJECT_NAME="Apache Portable Runtime"
|
||||
|
||||
INPUT=.
|
||||
QUIET=YES
|
||||
RECURSIVE=YES
|
||||
FILE_PATTERNS=*.h
|
||||
|
||||
OUTPUT_DIRECTORY=docs/dox
|
||||
|
||||
MACRO_EXPANSION=YES
|
||||
EXPAND_ONLY_PREDEF=YES
|
||||
#EXPAND_AS_DEFINED=
|
||||
# not sure why this doesn't work as EXPAND_AS_DEFINED, it should!
|
||||
PREDEFINED="APR_DECLARE(x)=x" \
|
||||
"APR_DECLARE_NONSTD(x)=x" \
|
||||
"APR_DECLARE_DATA" \
|
||||
"APR_POOL_DECLARE_ACCESSOR(x)=apr_pool_t* apr_##x##_pool_get (const apr_##x##_t *the##x)" \
|
||||
"APR_DECLARE_INHERIT_SET(x)=apr_status_t apr_##x##_inherit_set(apr_##x##_t *the##x)" \
|
||||
"APR_DECLARE_INHERIT_UNSET(x)=apr_status_t apr_##x##_inherit_unset(apr_##x##_t *the##x)" \
|
||||
"APR_HAS_THREADS" \
|
||||
"__attribute__(x)=" \
|
||||
DOXYGEN=
|
||||
|
||||
OPTIMIZE_OUTPUT_FOR_C=YES
|
||||
STRIP_CODE_COMMENTS=NO
|
||||
|
||||
FULL_PATH_NAMES=NO
|
||||
CASE_SENSE_NAMES=NO
|
||||
# some autoconf guru needs to make configure set this correctly...
|
||||
# in the meantime, simply listing the headers should be alright
|
||||
#STRIP_FROM_PATH=/buildpath/apr
|
||||
|
||||
EXCLUDE_PATTERNS="*/acconfig.h" \
|
||||
"*/test/*" \
|
||||
"*/arch/*"
|
||||
|
||||
GENERATE_TAGFILE=docs/dox/apr.tag
|
||||
|
84
docs/incomplete_types
Normal file
84
docs/incomplete_types
Normal file
@ -0,0 +1,84 @@
|
||||
The question has been asked multiple times, "Why is APR using Incomplete
|
||||
types?" This document will try to explain that.
|
||||
|
||||
Incomplete types are used in APR because they can enforce portability, and
|
||||
they make the APR developers job easier, as well as allowing APR to use native
|
||||
types on all platforms. Imagine a scenario where APR wasn't using incomplete
|
||||
types. The ap_file_t type would have to be defined as:
|
||||
|
||||
typedef struct ap_file_t {
|
||||
ap_pool_t *pool
|
||||
char *fname;
|
||||
int eof_hit;
|
||||
int pipe;
|
||||
ap_interval_time_t timeout;
|
||||
#ifdef WIN32
|
||||
HANDLE file_handle;
|
||||
DWORD dwFileAttributes;
|
||||
#elif defined(OS2)
|
||||
HFILE filedes;
|
||||
HEV PipeSem
|
||||
#else
|
||||
int filedes;
|
||||
int ungetchar;
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
int buffered;
|
||||
ap_int32_flags
|
||||
int isopen;
|
||||
|
||||
/* Stuff for buffered mode */
|
||||
char *buffer;
|
||||
int bufpos;
|
||||
unsigned long dataRead;
|
||||
int direction;
|
||||
unsigned long filePtr;
|
||||
ap_lock_t *mutex;
|
||||
#endif
|
||||
} ap_file_t;
|
||||
|
||||
This captures the essense of what is currently being defined for ap_file_t
|
||||
using incomplete types. However, using this structure leads developers to
|
||||
believe that they are safe accessing any of the fields in this structure.
|
||||
This is not true. On some platforms, such as Windows, about half of the
|
||||
structure disappears. We could combine some of these definitions with
|
||||
macros, for example:
|
||||
|
||||
#ifdef WIN32
|
||||
#define filetype HANDLE
|
||||
#elif OS2
|
||||
#define filetype HFILE
|
||||
#else
|
||||
#define filetype int
|
||||
#endif
|
||||
|
||||
And then in the defintion for ap_file_t, we could say:
|
||||
filetype filedes;
|
||||
|
||||
This gets rid of some of the complexity, by moving it off to the side, but
|
||||
it is still not safe for a programmers to access the filedes field directly
|
||||
outside of APR, because the programmer has no way of knowing what the actual
|
||||
type is. So for example printing the filedes using printf would yield wildly
|
||||
varying results on Windows and OS2 when compared to Unix.
|
||||
|
||||
Another option also presents itself. Stick strictly to POSIX. This means
|
||||
that all code can be shared on any POSIX compliant platform. The problem
|
||||
with this is performance. One of the benefits to APR, is that it allows
|
||||
developers to easily use native types on all platforms with the same code.
|
||||
This has proven to provide a substantial performance boost on most non-Unix
|
||||
platforms.
|
||||
|
||||
Having said all of that, sometimes incomplete types just don't make sense.
|
||||
For example, the first implementation of time functions used incomplete types,
|
||||
which added a layer of complexity that turned out to be unnecessary. If
|
||||
a platform cannot provide a simple number that represents the number of seconds
|
||||
elapsed since a specifed date and time, then APR doesn't really want to
|
||||
provide support for that platform.
|
||||
|
||||
APR is trying hard to provide a balance of incomplete and complete types,
|
||||
but like all things, sometimes the developers make mistakes. If you are
|
||||
using APR and find that there is an incomplete type that doesn't need to be
|
||||
an incomplete type, please let us know, we are more than willing to listen
|
||||
and design parts of APR that do not use incomplete types.
|
||||
|
47
docs/non_apr_programs
Normal file
47
docs/non_apr_programs
Normal file
@ -0,0 +1,47 @@
|
||||
How do I use APR'ized programs in connection with programs that don't
|
||||
use APR? These darn incomplete types don't let me fill out the APR types.
|
||||
|
||||
The APR developers acknowledge that most programs are not using APR, and
|
||||
we don't expect them to migrate to using APR just because APR has been
|
||||
released. So, we have provided a way for non-APR'ized programs to interact
|
||||
very cleanly with APR.
|
||||
|
||||
There are a set of functions, all documented in apr_portable.h, which allow
|
||||
a programmer to either get a native type from an APR type, or to setup an
|
||||
APR type from a native type.
|
||||
|
||||
For example, if you are writing an add-on to another program that does not use
|
||||
APR for file I/O, but you (in your infinite wisdom) want to use APR to make
|
||||
sure your section is portable. Assume the program provides a type foo_t with
|
||||
a file descriptor in it (fd).
|
||||
|
||||
void function_using_apr(foo_t non_apr_struct, ap_pool_t *p)
|
||||
{
|
||||
ap_file_t *apr_file = NULL;
|
||||
|
||||
ap_put_os_file(&apr_file, &non_apr_struct->fd, p);
|
||||
|
||||
...
|
||||
}
|
||||
|
||||
There are portable functions for each APR incomplete type. They are all
|
||||
called ap_put_os_foobar(), and they each take the same basic arguments, a
|
||||
pointer to a pointer to the incomplete type (the last pointer in that list
|
||||
should be NULL), a pointer to the native type, and a pool. Each of these can
|
||||
be found in apr_portable.h.
|
||||
|
||||
If you have to do the exact opposite (take an APR type and convert it to a
|
||||
native type, there are functions for that too. For example:
|
||||
|
||||
void function_not_using_apr(apr_file_t *apr_file)
|
||||
{
|
||||
int unix_file_desc;
|
||||
|
||||
ap_get_os_file(&unix_file_desc, apr_file);
|
||||
|
||||
...
|
||||
}
|
||||
|
||||
For each ap_put_os_foobar, there is a corresponding ap_get_os_file. These are
|
||||
also documented in apr_portable.h.
|
||||
|
100
docs/pool-design.html
Normal file
100
docs/pool-design.html
Normal file
@ -0,0 +1,100 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html><head>
|
||||
<title>Using APR Pools</title>
|
||||
</head>
|
||||
<body>
|
||||
<div align="right">
|
||||
Last modified at [$Date: 2004-11-25 09:51:51 +1100 (Thu, 25 Nov 2004) $]
|
||||
</div>
|
||||
|
||||
<h1>Using APR Pools</h1>
|
||||
|
||||
<p>
|
||||
From <a href="http://subversion.tigris.org/">Subversion</a>, we
|
||||
have learned a <em>lot</em> about how to use pools in a heavily
|
||||
structured/object-based environment.
|
||||
<a href="http://httpd.apache.org/">Apache httpd</a> is a
|
||||
completely different beast: "allocate a request pool. use
|
||||
it. destroy it."
|
||||
</p>
|
||||
|
||||
<p>
|
||||
In a complex app, that request-style of behavior is not
|
||||
present. Luckily, the "proper" use of pools can be described in
|
||||
just a few rules:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
Objects should not have their own pools. An object is
|
||||
allocated into a pool defined by the constructor's caller. The
|
||||
<strong>caller</strong> knows the lifetime of the object and
|
||||
will manage it via the pool. Generally, this also means that
|
||||
objects will not have a "close" or a "free" since those
|
||||
operations will happen implicitly as part of the destruction
|
||||
of the pool the objects live within.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>
|
||||
Functions should not create/destroy pools for their
|
||||
operation; they should use a pool provided by the
|
||||
caller. Again, the <strong>caller</strong> knows more about
|
||||
how the function will be used, how often, how many times,
|
||||
etc. Thus, it should be in charge of the function's memory
|
||||
usage.
|
||||
</p>
|
||||
<p>
|
||||
As an example, the caller might know that the app will exit
|
||||
upon the function's return. Thus, the function would be
|
||||
creating extra work if it built and destroyed a
|
||||
pool. Instead, it should use the passed-in pool, which the
|
||||
caller is going to be tossing as part of app-exit anyways.
|
||||
</p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>
|
||||
Whenever an unbounded iteration occurs, a subpool should be
|
||||
used. The general pattern is:
|
||||
</p>
|
||||
<blockquote>
|
||||
<pre>
|
||||
subpool = apr_create_subpool(pool);
|
||||
for (i = 0; i < n; ++i) {
|
||||
apr_pool_clear(subpool);
|
||||
|
||||
do_operation(..., subpool);
|
||||
}
|
||||
apr_pool_destroy(subpool);</pre>
|
||||
</blockquote>
|
||||
<p>
|
||||
This pattern prevents the 'pool' from growing unbounded and
|
||||
consuming all of memory. Note that it is slightly more
|
||||
optimal to clear the pool on loop-entry. This pattern also
|
||||
allows for a '<tt>continue</tt>' to occur within the loop,
|
||||
yet still ensure the pool will be cleared.
|
||||
</p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
Given all of the above, it is pretty well mandatory to pass a
|
||||
pool to <em>every</em> function. Since objects are not
|
||||
recording pools for themselves, and the caller is always
|
||||
supposed to be managing memory, then each function needs a
|
||||
pool, rather than relying on some hidden magic pool. In
|
||||
limited cases, objects may record the pool used for their
|
||||
construction so that they can construct sub-parts, but these
|
||||
cases should be examined carefully. Internal pools can lead to
|
||||
unbounded pool usage if the object is not careful.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
<address>Greg Stein</address>
|
||||
<!-- Created: Wed Jun 25 14:39:57 PDT 2003 -->
|
||||
<!-- hhmts start -->
|
||||
Last modified: Wed Jun 25 14:50:19 PDT 2003
|
||||
<!-- hhmts end -->
|
||||
|
||||
</body></html>
|
57
docs/win32_builds.html
Normal file
57
docs/win32_builds.html
Normal file
@ -0,0 +1,57 @@
|
||||
<HTML>
|
||||
<HEAD><TITLE>APR Win32 Builds and Debugging</TITLE></HEAD>
|
||||
<BODY>
|
||||
<h1>APR Win32 Builds and Debugging</h1>
|
||||
|
||||
<h2>Configuration and Flavors</h2>
|
||||
|
||||
<p>The Win32 APR Developer Studio projects consist of</p>
|
||||
|
||||
<dl>
|
||||
<dt>apr/apr.dsp</dt>
|
||||
<dd>Builds the static apr.lib library (-D APR_DECLARE_STATIC)</dd>
|
||||
<dt>apr/libapr.dsp</dt>
|
||||
<dd>Builds the dynamic libapr.dll library (no define required)</dd>
|
||||
<dt>apr-util/aprutil.dsp</dt>
|
||||
<dd>Builds the static aprutil.lib library (-D APU_DECLARE_STATIC)</dd>
|
||||
<dt>apr-util/libaprutil.dsp</dt>
|
||||
<dd>Builds the dynamic libaprutil.dll library (no define required)</dd>
|
||||
<dt>apr-iconv/apriconv.dsp</dt>
|
||||
<dd>Builds the static apriconv.lib library (-D API_DECLARE_STATIC)</dd>
|
||||
<dt>apr-iconv/libapriconv.dsp</dt>
|
||||
<dd>Builds the dynamic libapriconv.dll library (no define required)</dd>
|
||||
</dl>
|
||||
|
||||
<p>In order to prepare to use one of the <em>static</em> libraries above,
|
||||
your application must be compiled with the define shown above, so that the
|
||||
correct linkage is created. The APR authors intended the use of dynamic
|
||||
libraries by default, so application authors do not need any special
|
||||
defines in order to link to the dynamic library flavors.</p>
|
||||
|
||||
<p>In order to build APR, you must use the proper dependencies. A good
|
||||
example of those dependencies is given in the apr-util/aprutil.dsw
|
||||
Developer Studio workspace. You can borrow the parts of that structure
|
||||
your application needs, that workspace defines both the dynamic and static
|
||||
library dependencies.</p>
|
||||
|
||||
<p>The APR libraries (dynamic and static) are compiled with debugging symbols,
|
||||
even in Release builds. The dynamic library symbols are always usable,
|
||||
simply keep the correspond .pdb file in the same path as the library .dll.
|
||||
(E.g. both libapr.dll and libapr.pdb should be copied to the same path.)</p>
|
||||
|
||||
<p>The static symbols will only be fully usable if your application does <em>not<em>
|
||||
link with the /pdbtype:sept flag! At the time your application links to
|
||||
an APR library, the corresponding _src.pdb file should exist in the original
|
||||
path the library was built, or it may be sufficient to keep the _src.pdb file
|
||||
in the same path as the library file. (E.g. apr.lib and apr_src.pdb should
|
||||
reside together in your lib directory.) The later option is unconfirmed.</p>
|
||||
|
||||
<p>In order to keep the symbols compiled into the static library, your application
|
||||
must use the linker's /debug flag. If you do not want the application to be
|
||||
debuggable with its corresponding .pdb file, omit the /debug flag and all debug
|
||||
symbolic information is discarded. Note that your application can only be
|
||||
debugged with the corresponding .pdb file created by the linker, unless you use
|
||||
/debugtype:coff or /debugtype:both in your link options.</p>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
251
dso/unix/dso.c
Normal file
251
dso/unix/dso.c
Normal file
@ -0,0 +1,251 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "apr_arch_dso.h"
|
||||
#include "apr_strings.h"
|
||||
#include "apr_portable.h"
|
||||
|
||||
#if APR_HAS_DSO
|
||||
|
||||
#if !defined(DSO_USE_DLFCN) && !defined(DSO_USE_SHL) && !defined(DSO_USE_DYLD)
|
||||
#error No DSO implementation specified.
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDDEF_H
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
#if APR_HAVE_STDLIB_H
|
||||
#include <stdlib.h> /* malloc(), free() */
|
||||
#endif
|
||||
#if APR_HAVE_STRING_H
|
||||
#include <string.h> /* for strerror() on HP-UX */
|
||||
#endif
|
||||
|
||||
#if defined(DSO_USE_DYLD)
|
||||
#define DYLD_LIBRARY_HANDLE (void *)-1
|
||||
#endif
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_os_dso_handle_put(apr_dso_handle_t **aprdso,
|
||||
apr_os_dso_handle_t osdso,
|
||||
apr_pool_t *pool)
|
||||
{
|
||||
*aprdso = apr_pcalloc(pool, sizeof **aprdso);
|
||||
(*aprdso)->handle = osdso;
|
||||
(*aprdso)->pool = pool;
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_os_dso_handle_get(apr_os_dso_handle_t *osdso,
|
||||
apr_dso_handle_t *aprdso)
|
||||
{
|
||||
*osdso = aprdso->handle;
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
static apr_status_t dso_cleanup(void *thedso)
|
||||
{
|
||||
apr_dso_handle_t *dso = thedso;
|
||||
|
||||
if (dso->handle == NULL)
|
||||
return APR_SUCCESS;
|
||||
|
||||
#if defined(DSO_USE_SHL)
|
||||
shl_unload((shl_t)dso->handle);
|
||||
#elif defined(DSO_USE_DYLD)
|
||||
if (dso->handle != DYLD_LIBRARY_HANDLE) {
|
||||
NSUnLinkModule(dso->handle, FALSE);
|
||||
}
|
||||
#elif defined(DSO_USE_DLFCN)
|
||||
if (dlclose(dso->handle) != 0)
|
||||
return APR_EINIT;
|
||||
#endif
|
||||
dso->handle = NULL;
|
||||
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle,
|
||||
const char *path, apr_pool_t *pool)
|
||||
{
|
||||
#if defined(DSO_USE_SHL)
|
||||
shl_t os_handle = shl_load(path, BIND_IMMEDIATE, 0L);
|
||||
|
||||
#elif defined(DSO_USE_DYLD)
|
||||
NSObjectFileImage image;
|
||||
NSModule os_handle = NULL;
|
||||
NSObjectFileImageReturnCode dsoerr;
|
||||
const char* err_msg = NULL;
|
||||
dsoerr = NSCreateObjectFileImageFromFile(path, &image);
|
||||
|
||||
if (dsoerr == NSObjectFileImageSuccess) {
|
||||
#if defined(NSLINKMODULE_OPTION_RETURN_ON_ERROR) && defined(NSLINKMODULE_OPTION_NONE)
|
||||
os_handle = NSLinkModule(image, path,
|
||||
NSLINKMODULE_OPTION_RETURN_ON_ERROR |
|
||||
NSLINKMODULE_OPTION_NONE);
|
||||
/* If something went wrong, get the errors... */
|
||||
if (!os_handle) {
|
||||
NSLinkEditErrors errors;
|
||||
int errorNumber;
|
||||
const char *fileName;
|
||||
NSLinkEditError(&errors, &errorNumber, &fileName, &err_msg);
|
||||
}
|
||||
#else
|
||||
os_handle = NSLinkModule(image, path, FALSE);
|
||||
#endif
|
||||
NSDestroyObjectFileImage(image);
|
||||
}
|
||||
else if ((dsoerr == NSObjectFileImageFormat ||
|
||||
dsoerr == NSObjectFileImageInappropriateFile) &&
|
||||
NSAddLibrary(path) == TRUE) {
|
||||
os_handle = (NSModule)DYLD_LIBRARY_HANDLE;
|
||||
}
|
||||
else {
|
||||
err_msg = "cannot create object file image or add library";
|
||||
}
|
||||
|
||||
#elif defined(DSO_USE_DLFCN)
|
||||
#if defined(OSF1) || defined(SEQUENT) || defined(SNI) ||\
|
||||
(defined(__FreeBSD_version) && (__FreeBSD_version >= 220000)) ||\
|
||||
defined(__DragonFly__)
|
||||
void *os_handle = dlopen((char *)path, RTLD_NOW | RTLD_GLOBAL);
|
||||
|
||||
#else
|
||||
int flags = RTLD_NOW | RTLD_GLOBAL;
|
||||
void *os_handle;
|
||||
#ifdef _AIX
|
||||
if (strchr(path + 1, '(') && path[strlen(path) - 1] == ')')
|
||||
{
|
||||
/* This special archive.a(dso.so) syntax is required for
|
||||
* the way libtool likes to build shared libraries on AIX.
|
||||
* dlopen() support for such a library requires that the
|
||||
* RTLD_MEMBER flag be enabled.
|
||||
*/
|
||||
flags |= RTLD_MEMBER;
|
||||
}
|
||||
#endif
|
||||
os_handle = dlopen(path, flags);
|
||||
#endif
|
||||
#endif /* DSO_USE_x */
|
||||
|
||||
*res_handle = apr_pcalloc(pool, sizeof(**res_handle));
|
||||
|
||||
if(os_handle == NULL) {
|
||||
#if defined(DSO_USE_SHL)
|
||||
(*res_handle)->errormsg = strerror(errno);
|
||||
return APR_EDSOOPEN;
|
||||
#elif defined(DSO_USE_DYLD)
|
||||
(*res_handle)->errormsg = (err_msg) ? err_msg : "link failed";
|
||||
return APR_EDSOOPEN;
|
||||
#elif defined(DSO_USE_DLFCN)
|
||||
(*res_handle)->errormsg = dlerror();
|
||||
return APR_EDSOOPEN;
|
||||
#endif
|
||||
}
|
||||
|
||||
(*res_handle)->handle = (void*)os_handle;
|
||||
(*res_handle)->pool = pool;
|
||||
(*res_handle)->errormsg = NULL;
|
||||
|
||||
apr_pool_cleanup_register(pool, *res_handle, dso_cleanup, apr_pool_cleanup_null);
|
||||
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle)
|
||||
{
|
||||
return apr_pool_cleanup_run(handle->pool, handle, dso_cleanup);
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym,
|
||||
apr_dso_handle_t *handle,
|
||||
const char *symname)
|
||||
{
|
||||
#if defined(DSO_USE_SHL)
|
||||
void *symaddr = NULL;
|
||||
int status;
|
||||
|
||||
errno = 0;
|
||||
status = shl_findsym((void *)&handle->handle, symname, TYPE_PROCEDURE, &symaddr);
|
||||
if (status == -1 && errno == 0) /* try TYPE_DATA instead */
|
||||
status = shl_findsym((void *)&handle->handle, symname, TYPE_DATA, &symaddr);
|
||||
if (status == -1)
|
||||
return APR_ESYMNOTFOUND;
|
||||
*ressym = symaddr;
|
||||
return APR_SUCCESS;
|
||||
|
||||
#elif defined(DSO_USE_DYLD)
|
||||
void *retval = NULL;
|
||||
NSSymbol symbol;
|
||||
char *symname2 = (char*)malloc(sizeof(char)*(strlen(symname)+2));
|
||||
sprintf(symname2, "_%s", symname);
|
||||
#ifdef NSLINKMODULE_OPTION_PRIVATE
|
||||
if (handle->handle == DYLD_LIBRARY_HANDLE) {
|
||||
symbol = NSLookupAndBindSymbol(symname2);
|
||||
}
|
||||
else {
|
||||
symbol = NSLookupSymbolInModule((NSModule)handle->handle, symname2);
|
||||
}
|
||||
#else
|
||||
symbol = NSLookupAndBindSymbol(symname2);
|
||||
#endif
|
||||
free(symname2);
|
||||
if (symbol == NULL) {
|
||||
handle->errormsg = "undefined symbol";
|
||||
return APR_ESYMNOTFOUND;
|
||||
}
|
||||
retval = NSAddressOfSymbol(symbol);
|
||||
if (retval == NULL) {
|
||||
handle->errormsg = "cannot resolve symbol";
|
||||
return APR_ESYMNOTFOUND;
|
||||
}
|
||||
*ressym = retval;
|
||||
return APR_SUCCESS;
|
||||
#elif defined(DSO_USE_DLFCN)
|
||||
|
||||
#if defined(DLSYM_NEEDS_UNDERSCORE)
|
||||
void *retval;
|
||||
char *symbol = (char*)malloc(sizeof(char)*(strlen(symname)+2));
|
||||
sprintf(symbol, "_%s", symname);
|
||||
retval = dlsym(handle->handle, symbol);
|
||||
free(symbol);
|
||||
#elif defined(SEQUENT) || defined(SNI)
|
||||
void *retval = dlsym(handle->handle, (char *)symname);
|
||||
#else
|
||||
void *retval = dlsym(handle->handle, symname);
|
||||
#endif /* DLSYM_NEEDS_UNDERSCORE */
|
||||
|
||||
if (retval == NULL) {
|
||||
handle->errormsg = dlerror();
|
||||
return APR_ESYMNOTFOUND;
|
||||
}
|
||||
|
||||
*ressym = retval;
|
||||
|
||||
return APR_SUCCESS;
|
||||
#endif /* DSO_USE_x */
|
||||
}
|
||||
|
||||
APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buffer,
|
||||
apr_size_t buflen)
|
||||
{
|
||||
if (dso->errormsg) {
|
||||
apr_cpystrn(buffer, dso->errormsg, buflen);
|
||||
return dso->errormsg;
|
||||
}
|
||||
return "No Error";
|
||||
}
|
||||
|
||||
#endif
|
15
emacs-mode
Normal file
15
emacs-mode
Normal file
@ -0,0 +1,15 @@
|
||||
;; M-x load-file <this file>
|
||||
;; or emacs -l <this file>
|
||||
;; to use this style: C-c . apache
|
||||
(c-add-style "apache"
|
||||
'((inclass . ++)
|
||||
(defun-block-intro . ++)
|
||||
(statement-block-intro . ++)
|
||||
(substatement . ++)
|
||||
(brace-list-intro . ++)
|
||||
(statement-case-intro . ++)
|
||||
(inextern-lang . 0)
|
||||
))
|
||||
(setq-default indent-tabs-mode nil)
|
||||
;; if you forgot to do this at startup, then M-x eval-expression
|
||||
;; (setq indent-tabs-mode nil) on each buffer
|
60
file_io/unix/buffer.c
Normal file
60
file_io/unix/buffer.c
Normal file
@ -0,0 +1,60 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "apr_arch_file_io.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_thread_mutex.h"
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_buffer_set(apr_file_t *file,
|
||||
char * buffer,
|
||||
apr_size_t bufsize)
|
||||
{
|
||||
apr_status_t rv;
|
||||
|
||||
file_lock(file);
|
||||
|
||||
if(file->buffered) {
|
||||
/* Flush the existing buffer */
|
||||
rv = apr_file_flush_locked(file);
|
||||
if (rv != APR_SUCCESS) {
|
||||
file_unlock(file);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
file->buffer = buffer;
|
||||
file->bufsize = bufsize;
|
||||
file->buffered = 1;
|
||||
file->bufpos = 0;
|
||||
file->direction = 0;
|
||||
file->dataRead = 0;
|
||||
|
||||
if (file->bufsize == 0) {
|
||||
/* Setting the buffer size to zero is equivalent to turning
|
||||
* buffering off.
|
||||
*/
|
||||
file->buffered = 0;
|
||||
}
|
||||
|
||||
file_unlock(file);
|
||||
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_size_t) apr_file_buffer_size_get(apr_file_t *file)
|
||||
{
|
||||
return file->bufsize;
|
||||
}
|
118
file_io/unix/copy.c
Normal file
118
file_io/unix/copy.c
Normal file
@ -0,0 +1,118 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "apr_arch_file_io.h"
|
||||
#include "apr_file_io.h"
|
||||
|
||||
static apr_status_t apr_file_transfer_contents(const char *from_path,
|
||||
const char *to_path,
|
||||
apr_int32_t flags,
|
||||
apr_fileperms_t to_perms,
|
||||
apr_pool_t *pool)
|
||||
{
|
||||
apr_file_t *s, *d;
|
||||
apr_status_t status;
|
||||
apr_finfo_t finfo;
|
||||
apr_fileperms_t perms;
|
||||
|
||||
/* Open source file. */
|
||||
status = apr_file_open(&s, from_path, APR_FOPEN_READ, APR_OS_DEFAULT, pool);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
/* Maybe get its permissions. */
|
||||
if (to_perms == APR_FILE_SOURCE_PERMS) {
|
||||
status = apr_file_info_get(&finfo, APR_FINFO_PROT, s);
|
||||
if (status != APR_SUCCESS && status != APR_INCOMPLETE) {
|
||||
apr_file_close(s); /* toss any error */
|
||||
return status;
|
||||
}
|
||||
perms = finfo.protection;
|
||||
}
|
||||
else
|
||||
perms = to_perms;
|
||||
|
||||
/* Open dest file. */
|
||||
status = apr_file_open(&d, to_path, flags, perms, pool);
|
||||
if (status) {
|
||||
apr_file_close(s); /* toss any error */
|
||||
return status;
|
||||
}
|
||||
|
||||
#if BUFSIZ > APR_FILE_DEFAULT_BUFSIZE
|
||||
#define COPY_BUFSIZ BUFSIZ
|
||||
#else
|
||||
#define COPY_BUFSIZ APR_FILE_DEFAULT_BUFSIZE
|
||||
#endif
|
||||
|
||||
/* Copy bytes till the cows come home. */
|
||||
while (1) {
|
||||
char buf[COPY_BUFSIZ];
|
||||
apr_size_t bytes_this_time = sizeof(buf);
|
||||
apr_status_t read_err;
|
||||
apr_status_t write_err;
|
||||
|
||||
/* Read 'em. */
|
||||
read_err = apr_file_read(s, buf, &bytes_this_time);
|
||||
if (read_err && !APR_STATUS_IS_EOF(read_err)) {
|
||||
apr_file_close(s); /* toss any error */
|
||||
apr_file_close(d); /* toss any error */
|
||||
return read_err;
|
||||
}
|
||||
|
||||
/* Write 'em. */
|
||||
write_err = apr_file_write_full(d, buf, bytes_this_time, NULL);
|
||||
if (write_err) {
|
||||
apr_file_close(s); /* toss any error */
|
||||
apr_file_close(d); /* toss any error */
|
||||
return write_err;
|
||||
}
|
||||
|
||||
if (read_err && APR_STATUS_IS_EOF(read_err)) {
|
||||
status = apr_file_close(s);
|
||||
if (status) {
|
||||
apr_file_close(d); /* toss any error */
|
||||
return status;
|
||||
}
|
||||
|
||||
/* return the results of this close: an error, or success */
|
||||
return apr_file_close(d);
|
||||
}
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_copy(const char *from_path,
|
||||
const char *to_path,
|
||||
apr_fileperms_t perms,
|
||||
apr_pool_t *pool)
|
||||
{
|
||||
return apr_file_transfer_contents(from_path, to_path,
|
||||
(APR_FOPEN_WRITE | APR_FOPEN_CREATE | APR_FOPEN_TRUNCATE),
|
||||
perms,
|
||||
pool);
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_append(const char *from_path,
|
||||
const char *to_path,
|
||||
apr_fileperms_t perms,
|
||||
apr_pool_t *pool)
|
||||
{
|
||||
return apr_file_transfer_contents(from_path, to_path,
|
||||
(APR_FOPEN_WRITE | APR_FOPEN_CREATE | APR_FOPEN_APPEND),
|
||||
perms,
|
||||
pool);
|
||||
}
|
364
file_io/unix/dir.c
Normal file
364
file_io/unix/dir.c
Normal file
@ -0,0 +1,364 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "apr_arch_file_io.h"
|
||||
#include "apr_strings.h"
|
||||
#include "apr_portable.h"
|
||||
#if APR_HAVE_SYS_SYSLIMITS_H
|
||||
#include <sys/syslimits.h>
|
||||
#endif
|
||||
#if APR_HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
static apr_status_t dir_cleanup(void *thedir)
|
||||
{
|
||||
apr_dir_t *dir = thedir;
|
||||
if (closedir(dir->dirstruct) == 0) {
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
else {
|
||||
return errno;
|
||||
}
|
||||
}
|
||||
|
||||
#define PATH_SEPARATOR '/'
|
||||
|
||||
/* Remove trailing separators that don't affect the meaning of PATH. */
|
||||
static const char *path_canonicalize (const char *path, apr_pool_t *pool)
|
||||
{
|
||||
/* At some point this could eliminate redundant components. For
|
||||
* now, it just makes sure there is no trailing slash. */
|
||||
apr_size_t len = strlen (path);
|
||||
apr_size_t orig_len = len;
|
||||
|
||||
while ((len > 0) && (path[len - 1] == PATH_SEPARATOR))
|
||||
len--;
|
||||
|
||||
if (len != orig_len)
|
||||
return apr_pstrndup (pool, path, len);
|
||||
else
|
||||
return path;
|
||||
}
|
||||
|
||||
/* Remove one component off the end of PATH. */
|
||||
static char *path_remove_last_component (const char *path, apr_pool_t *pool)
|
||||
{
|
||||
const char *newpath = path_canonicalize (path, pool);
|
||||
int i;
|
||||
|
||||
for (i = (strlen(newpath) - 1); i >= 0; i--) {
|
||||
if (path[i] == PATH_SEPARATOR)
|
||||
break;
|
||||
}
|
||||
|
||||
return apr_pstrndup (pool, path, (i < 0) ? 0 : i);
|
||||
}
|
||||
|
||||
apr_status_t apr_dir_open(apr_dir_t **new, const char *dirname,
|
||||
apr_pool_t *pool)
|
||||
{
|
||||
/* On some platforms (e.g., Linux+GNU libc), d_name[] in struct
|
||||
* dirent is declared with enough storage for the name. On other
|
||||
* platforms (e.g., Solaris 8 for Intel), d_name is declared as a
|
||||
* one-byte array. Note: gcc evaluates this at compile time.
|
||||
*/
|
||||
apr_size_t dirent_size =
|
||||
sizeof(*(*new)->entry) +
|
||||
(sizeof((*new)->entry->d_name) > 1 ? 0 : 255);
|
||||
DIR *dir = opendir(dirname);
|
||||
|
||||
if (!dir) {
|
||||
return errno;
|
||||
}
|
||||
|
||||
(*new) = (apr_dir_t *)apr_palloc(pool, sizeof(apr_dir_t));
|
||||
|
||||
(*new)->pool = pool;
|
||||
(*new)->dirname = apr_pstrdup(pool, dirname);
|
||||
(*new)->dirstruct = dir;
|
||||
(*new)->entry = apr_pcalloc(pool, dirent_size);
|
||||
|
||||
apr_pool_cleanup_register((*new)->pool, *new, dir_cleanup,
|
||||
apr_pool_cleanup_null);
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
apr_status_t apr_dir_close(apr_dir_t *thedir)
|
||||
{
|
||||
return apr_pool_cleanup_run(thedir->pool, thedir, dir_cleanup);
|
||||
}
|
||||
|
||||
#ifdef DIRENT_TYPE
|
||||
static apr_filetype_e filetype_from_dirent_type(int type)
|
||||
{
|
||||
switch (type) {
|
||||
case DT_REG:
|
||||
return APR_REG;
|
||||
case DT_DIR:
|
||||
return APR_DIR;
|
||||
case DT_LNK:
|
||||
return APR_LNK;
|
||||
case DT_CHR:
|
||||
return APR_CHR;
|
||||
case DT_BLK:
|
||||
return APR_BLK;
|
||||
#if defined(DT_FIFO)
|
||||
case DT_FIFO:
|
||||
return APR_PIPE;
|
||||
#endif
|
||||
#if !defined(BEOS) && defined(DT_SOCK)
|
||||
case DT_SOCK:
|
||||
return APR_SOCK;
|
||||
#endif
|
||||
default:
|
||||
return APR_UNKFILE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
apr_status_t apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted,
|
||||
apr_dir_t *thedir)
|
||||
{
|
||||
apr_status_t ret = 0;
|
||||
#ifdef DIRENT_TYPE
|
||||
apr_filetype_e type;
|
||||
#endif
|
||||
#if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS) \
|
||||
&& !defined(READDIR_IS_THREAD_SAFE)
|
||||
#ifdef APR_USE_READDIR64_R
|
||||
struct dirent64 *retent;
|
||||
|
||||
/* If LFS is enabled and readdir64_r is available, readdir64_r is
|
||||
* used in preference to readdir_r. This allows directories to be
|
||||
* read which contain a (64-bit) inode number which doesn't fit
|
||||
* into the 32-bit apr_ino_t, iff the caller doesn't actually care
|
||||
* about the inode number (i.e. wanted & APR_FINFO_INODE == 0).
|
||||
* (such inodes may be seen in some wonky NFS environments)
|
||||
*
|
||||
* Similarly, if the d_off field cannot be reprented in a 32-bit
|
||||
* offset, the libc readdir_r() would barf; using readdir64_r
|
||||
* bypasses that case entirely since APR does not care about
|
||||
* d_off. */
|
||||
|
||||
ret = readdir64_r(thedir->dirstruct, thedir->entry, &retent);
|
||||
#else
|
||||
|
||||
struct dirent *retent;
|
||||
|
||||
ret = readdir_r(thedir->dirstruct, thedir->entry, &retent);
|
||||
#endif
|
||||
|
||||
/* POSIX treats "end of directory" as a non-error case, so ret
|
||||
* will be zero and retent will be set to NULL in that case. */
|
||||
if (!ret && retent == NULL) {
|
||||
ret = APR_ENOENT;
|
||||
}
|
||||
|
||||
/* Solaris is a bit strange, if there are no more entries in the
|
||||
* directory, it returns EINVAL. Since this is against POSIX, we
|
||||
* hack around the problem here. EINVAL is possible from other
|
||||
* readdir implementations, but only if the result buffer is too small.
|
||||
* since we control the size of that buffer, we should never have
|
||||
* that problem.
|
||||
*/
|
||||
if (ret == EINVAL) {
|
||||
ret = APR_ENOENT;
|
||||
}
|
||||
#else
|
||||
/* We're about to call a non-thread-safe readdir() that may
|
||||
possibly set `errno', and the logic below actually cares about
|
||||
errno after the call. Therefore we need to clear errno first. */
|
||||
errno = 0;
|
||||
thedir->entry = readdir(thedir->dirstruct);
|
||||
if (thedir->entry == NULL) {
|
||||
/* If NULL was returned, this can NEVER be a success. Can it?! */
|
||||
if (errno == APR_SUCCESS) {
|
||||
ret = APR_ENOENT;
|
||||
}
|
||||
else
|
||||
ret = errno;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* No valid bit flag to test here - do we want one? */
|
||||
finfo->fname = NULL;
|
||||
|
||||
if (ret) {
|
||||
finfo->valid = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef DIRENT_TYPE
|
||||
type = filetype_from_dirent_type(thedir->entry->DIRENT_TYPE);
|
||||
if (type != APR_UNKFILE) {
|
||||
wanted &= ~APR_FINFO_TYPE;
|
||||
}
|
||||
#endif
|
||||
#ifdef DIRENT_INODE
|
||||
if (thedir->entry->DIRENT_INODE && thedir->entry->DIRENT_INODE != -1) {
|
||||
#ifdef APR_USE_READDIR64_R
|
||||
/* If readdir64_r is used, check for the overflow case of trying
|
||||
* to fit a 64-bit integer into a 32-bit integer. */
|
||||
if (sizeof(apr_ino_t) >= sizeof(retent->DIRENT_INODE)
|
||||
|| (apr_ino_t)retent->DIRENT_INODE == retent->DIRENT_INODE) {
|
||||
wanted &= ~APR_FINFO_INODE;
|
||||
} else {
|
||||
/* Prevent the fallback code below from filling in the
|
||||
* inode if the stat call fails. */
|
||||
retent->DIRENT_INODE = 0;
|
||||
}
|
||||
#else
|
||||
wanted &= ~APR_FINFO_INODE;
|
||||
#endif /* APR_USE_READDIR64_R */
|
||||
}
|
||||
#endif /* DIRENT_INODE */
|
||||
|
||||
wanted &= ~APR_FINFO_NAME;
|
||||
|
||||
if (wanted)
|
||||
{
|
||||
char fspec[APR_PATH_MAX];
|
||||
char *end;
|
||||
|
||||
end = apr_cpystrn(fspec, thedir->dirname, sizeof fspec);
|
||||
|
||||
if (end > fspec && end[-1] != '/' && (end < fspec + APR_PATH_MAX))
|
||||
*end++ = '/';
|
||||
|
||||
apr_cpystrn(end, thedir->entry->d_name,
|
||||
sizeof fspec - (end - fspec));
|
||||
|
||||
ret = apr_stat(finfo, fspec, APR_FINFO_LINK | wanted, thedir->pool);
|
||||
/* We passed a stack name that will disappear */
|
||||
finfo->fname = NULL;
|
||||
}
|
||||
|
||||
if (wanted && (ret == APR_SUCCESS || ret == APR_INCOMPLETE)) {
|
||||
wanted &= ~finfo->valid;
|
||||
}
|
||||
else {
|
||||
/* We don't bail because we fail to stat, when we are only -required-
|
||||
* to readdir... but the result will be APR_INCOMPLETE
|
||||
*/
|
||||
finfo->pool = thedir->pool;
|
||||
finfo->valid = 0;
|
||||
#ifdef DIRENT_TYPE
|
||||
if (type != APR_UNKFILE) {
|
||||
finfo->filetype = type;
|
||||
finfo->valid |= APR_FINFO_TYPE;
|
||||
}
|
||||
#endif
|
||||
#ifdef DIRENT_INODE
|
||||
if (thedir->entry->DIRENT_INODE && thedir->entry->DIRENT_INODE != -1) {
|
||||
finfo->inode = thedir->entry->DIRENT_INODE;
|
||||
finfo->valid |= APR_FINFO_INODE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
finfo->name = apr_pstrdup(thedir->pool, thedir->entry->d_name);
|
||||
finfo->valid |= APR_FINFO_NAME;
|
||||
|
||||
if (wanted)
|
||||
return APR_INCOMPLETE;
|
||||
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
apr_status_t apr_dir_rewind(apr_dir_t *thedir)
|
||||
{
|
||||
rewinddir(thedir->dirstruct);
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
apr_status_t apr_dir_make(const char *path, apr_fileperms_t perm,
|
||||
apr_pool_t *pool)
|
||||
{
|
||||
mode_t mode = apr_unix_perms2mode(perm);
|
||||
|
||||
if (mkdir(path, mode) == 0) {
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
else {
|
||||
return errno;
|
||||
}
|
||||
}
|
||||
|
||||
apr_status_t apr_dir_make_recursive(const char *path, apr_fileperms_t perm,
|
||||
apr_pool_t *pool)
|
||||
{
|
||||
apr_status_t apr_err = 0;
|
||||
|
||||
apr_err = apr_dir_make (path, perm, pool); /* Try to make PATH right out */
|
||||
|
||||
if (apr_err == ENOENT) { /* Missing an intermediate dir */
|
||||
char *dir;
|
||||
|
||||
dir = path_remove_last_component(path, pool);
|
||||
/* If there is no path left, give up. */
|
||||
if (dir[0] == '\0') {
|
||||
return apr_err;
|
||||
}
|
||||
|
||||
apr_err = apr_dir_make_recursive(dir, perm, pool);
|
||||
|
||||
if (!apr_err)
|
||||
apr_err = apr_dir_make (path, perm, pool);
|
||||
}
|
||||
|
||||
/*
|
||||
* It's OK if PATH exists. Timing issues can lead to the second
|
||||
* apr_dir_make being called on existing dir, therefore this check
|
||||
* has to come last.
|
||||
*/
|
||||
if (APR_STATUS_IS_EEXIST(apr_err))
|
||||
return APR_SUCCESS;
|
||||
|
||||
return apr_err;
|
||||
}
|
||||
|
||||
apr_status_t apr_dir_remove(const char *path, apr_pool_t *pool)
|
||||
{
|
||||
if (rmdir(path) == 0) {
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
else {
|
||||
return errno;
|
||||
}
|
||||
}
|
||||
|
||||
apr_status_t apr_os_dir_get(apr_os_dir_t **thedir, apr_dir_t *dir)
|
||||
{
|
||||
if (dir == NULL) {
|
||||
return APR_ENODIR;
|
||||
}
|
||||
*thedir = dir->dirstruct;
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
apr_status_t apr_os_dir_put(apr_dir_t **dir, apr_os_dir_t *thedir,
|
||||
apr_pool_t *pool)
|
||||
{
|
||||
if ((*dir) == NULL) {
|
||||
(*dir) = (apr_dir_t *)apr_pcalloc(pool, sizeof(apr_dir_t));
|
||||
(*dir)->pool = pool;
|
||||
}
|
||||
(*dir)->dirstruct = thedir;
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
|
119
file_io/unix/fileacc.c
Normal file
119
file_io/unix/fileacc.c
Normal file
@ -0,0 +1,119 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "apr_strings.h"
|
||||
#include "apr_arch_file_io.h"
|
||||
|
||||
/* A file to put ALL of the accessor functions for apr_file_t types. */
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_name_get(const char **fname,
|
||||
apr_file_t *thefile)
|
||||
{
|
||||
*fname = thefile->fname;
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_int32_t) apr_file_flags_get(apr_file_t *f)
|
||||
{
|
||||
return f->flags;
|
||||
}
|
||||
|
||||
#if !defined(OS2) && !defined(WIN32)
|
||||
mode_t apr_unix_perms2mode(apr_fileperms_t perms)
|
||||
{
|
||||
mode_t mode = 0;
|
||||
|
||||
if (perms & APR_USETID)
|
||||
mode |= S_ISUID;
|
||||
if (perms & APR_UREAD)
|
||||
mode |= S_IRUSR;
|
||||
if (perms & APR_UWRITE)
|
||||
mode |= S_IWUSR;
|
||||
if (perms & APR_UEXECUTE)
|
||||
mode |= S_IXUSR;
|
||||
|
||||
if (perms & APR_GSETID)
|
||||
mode |= S_ISGID;
|
||||
if (perms & APR_GREAD)
|
||||
mode |= S_IRGRP;
|
||||
if (perms & APR_GWRITE)
|
||||
mode |= S_IWGRP;
|
||||
if (perms & APR_GEXECUTE)
|
||||
mode |= S_IXGRP;
|
||||
|
||||
#ifdef S_ISVTX
|
||||
if (perms & APR_WSTICKY)
|
||||
mode |= S_ISVTX;
|
||||
#endif
|
||||
if (perms & APR_WREAD)
|
||||
mode |= S_IROTH;
|
||||
if (perms & APR_WWRITE)
|
||||
mode |= S_IWOTH;
|
||||
if (perms & APR_WEXECUTE)
|
||||
mode |= S_IXOTH;
|
||||
|
||||
return mode;
|
||||
}
|
||||
|
||||
apr_fileperms_t apr_unix_mode2perms(mode_t mode)
|
||||
{
|
||||
apr_fileperms_t perms = 0;
|
||||
|
||||
if (mode & S_ISUID)
|
||||
perms |= APR_USETID;
|
||||
if (mode & S_IRUSR)
|
||||
perms |= APR_UREAD;
|
||||
if (mode & S_IWUSR)
|
||||
perms |= APR_UWRITE;
|
||||
if (mode & S_IXUSR)
|
||||
perms |= APR_UEXECUTE;
|
||||
|
||||
if (mode & S_ISGID)
|
||||
perms |= APR_GSETID;
|
||||
if (mode & S_IRGRP)
|
||||
perms |= APR_GREAD;
|
||||
if (mode & S_IWGRP)
|
||||
perms |= APR_GWRITE;
|
||||
if (mode & S_IXGRP)
|
||||
perms |= APR_GEXECUTE;
|
||||
|
||||
#ifdef S_ISVTX
|
||||
if (mode & S_ISVTX)
|
||||
perms |= APR_WSTICKY;
|
||||
#endif
|
||||
if (mode & S_IROTH)
|
||||
perms |= APR_WREAD;
|
||||
if (mode & S_IWOTH)
|
||||
perms |= APR_WWRITE;
|
||||
if (mode & S_IXOTH)
|
||||
perms |= APR_WEXECUTE;
|
||||
|
||||
return perms;
|
||||
}
|
||||
#endif
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_data_get(void **data, const char *key,
|
||||
apr_file_t *file)
|
||||
{
|
||||
return apr_pool_userdata_get(data, key, file->pool);
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_data_set(apr_file_t *file, void *data,
|
||||
const char *key,
|
||||
apr_status_t (*cleanup)(void *))
|
||||
{
|
||||
return apr_pool_userdata_set(data, key, cleanup, file->pool);
|
||||
}
|
182
file_io/unix/filedup.c
Normal file
182
file_io/unix/filedup.c
Normal file
@ -0,0 +1,182 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "apr_arch_file_io.h"
|
||||
#include "apr_strings.h"
|
||||
#include "apr_portable.h"
|
||||
#include "apr_thread_mutex.h"
|
||||
#include "apr_arch_inherit.h"
|
||||
|
||||
static apr_status_t file_dup(apr_file_t **new_file,
|
||||
apr_file_t *old_file, apr_pool_t *p,
|
||||
int which_dup)
|
||||
{
|
||||
int rv;
|
||||
#ifdef HAVE_DUP3
|
||||
int flags = 0;
|
||||
#endif
|
||||
|
||||
if (which_dup == 2) {
|
||||
if ((*new_file) == NULL) {
|
||||
/* We can't dup2 unless we have a valid new_file */
|
||||
return APR_EINVAL;
|
||||
}
|
||||
#ifdef HAVE_DUP3
|
||||
if (!((*new_file)->flags & (APR_FOPEN_NOCLEANUP|APR_INHERIT)))
|
||||
flags |= O_CLOEXEC;
|
||||
rv = dup3(old_file->filedes, (*new_file)->filedes, flags);
|
||||
#else
|
||||
rv = dup2(old_file->filedes, (*new_file)->filedes);
|
||||
if (!((*new_file)->flags & (APR_FOPEN_NOCLEANUP|APR_INHERIT))) {
|
||||
int flags;
|
||||
|
||||
if (rv == -1)
|
||||
return errno;
|
||||
|
||||
if ((flags = fcntl((*new_file)->filedes, F_GETFD)) == -1)
|
||||
return errno;
|
||||
|
||||
flags |= FD_CLOEXEC;
|
||||
if (fcntl((*new_file)->filedes, F_SETFD, flags) == -1)
|
||||
return errno;
|
||||
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
rv = dup(old_file->filedes);
|
||||
}
|
||||
|
||||
if (rv == -1)
|
||||
return errno;
|
||||
|
||||
if (which_dup == 1) {
|
||||
(*new_file) = (apr_file_t *)apr_pcalloc(p, sizeof(apr_file_t));
|
||||
(*new_file)->pool = p;
|
||||
(*new_file)->filedes = rv;
|
||||
}
|
||||
|
||||
(*new_file)->fname = apr_pstrdup(p, old_file->fname);
|
||||
(*new_file)->buffered = old_file->buffered;
|
||||
|
||||
/* If the existing socket in a dup2 is already buffered, we
|
||||
* have an existing and valid (hopefully) mutex, so we don't
|
||||
* want to create it again as we could leak!
|
||||
*/
|
||||
#if APR_HAS_THREADS
|
||||
if ((*new_file)->buffered && !(*new_file)->thlock && old_file->thlock) {
|
||||
apr_thread_mutex_create(&((*new_file)->thlock),
|
||||
APR_THREAD_MUTEX_DEFAULT, p);
|
||||
}
|
||||
#endif
|
||||
/* As above, only create the buffer if we haven't already
|
||||
* got one.
|
||||
*/
|
||||
if ((*new_file)->buffered && !(*new_file)->buffer) {
|
||||
(*new_file)->buffer = apr_palloc(p, old_file->bufsize);
|
||||
(*new_file)->bufsize = old_file->bufsize;
|
||||
}
|
||||
|
||||
/* this is the way dup() works */
|
||||
(*new_file)->blocking = old_file->blocking;
|
||||
|
||||
/* make sure unget behavior is consistent */
|
||||
(*new_file)->ungetchar = old_file->ungetchar;
|
||||
|
||||
/* apr_file_dup2() retains the original cleanup, reflecting
|
||||
* the existing inherit and nocleanup flags. This means,
|
||||
* that apr_file_dup2() cannot be called against an apr_file_t
|
||||
* already closed with apr_file_close, because the expected
|
||||
* cleanup was already killed.
|
||||
*/
|
||||
if (which_dup == 2) {
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
/* apr_file_dup() retains all old_file flags with the exceptions
|
||||
* of APR_INHERIT and APR_FOPEN_NOCLEANUP.
|
||||
* The user must call apr_file_inherit_set() on the dupped
|
||||
* apr_file_t when desired.
|
||||
*/
|
||||
(*new_file)->flags = old_file->flags
|
||||
& ~(APR_INHERIT | APR_FOPEN_NOCLEANUP);
|
||||
|
||||
apr_pool_cleanup_register((*new_file)->pool, (void *)(*new_file),
|
||||
apr_unix_file_cleanup,
|
||||
apr_unix_child_file_cleanup);
|
||||
#ifndef WAITIO_USES_POLL
|
||||
/* Start out with no pollset. apr_wait_for_io_or_timeout() will
|
||||
* initialize the pollset if needed.
|
||||
*/
|
||||
(*new_file)->pollset = NULL;
|
||||
#endif
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_dup(apr_file_t **new_file,
|
||||
apr_file_t *old_file, apr_pool_t *p)
|
||||
{
|
||||
return file_dup(new_file, old_file, p, 1);
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file,
|
||||
apr_file_t *old_file, apr_pool_t *p)
|
||||
{
|
||||
return file_dup(&new_file, old_file, p, 2);
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_setaside(apr_file_t **new_file,
|
||||
apr_file_t *old_file,
|
||||
apr_pool_t *p)
|
||||
{
|
||||
*new_file = (apr_file_t *)apr_palloc(p, sizeof(apr_file_t));
|
||||
memcpy(*new_file, old_file, sizeof(apr_file_t));
|
||||
(*new_file)->pool = p;
|
||||
if (old_file->buffered) {
|
||||
(*new_file)->buffer = apr_palloc(p, old_file->bufsize);
|
||||
(*new_file)->bufsize = old_file->bufsize;
|
||||
if (old_file->direction == 1) {
|
||||
memcpy((*new_file)->buffer, old_file->buffer, old_file->bufpos);
|
||||
}
|
||||
else {
|
||||
memcpy((*new_file)->buffer, old_file->buffer, old_file->dataRead);
|
||||
}
|
||||
#if APR_HAS_THREADS
|
||||
if (old_file->thlock) {
|
||||
apr_thread_mutex_create(&((*new_file)->thlock),
|
||||
APR_THREAD_MUTEX_DEFAULT, p);
|
||||
apr_thread_mutex_destroy(old_file->thlock);
|
||||
}
|
||||
#endif /* APR_HAS_THREADS */
|
||||
}
|
||||
if (old_file->fname) {
|
||||
(*new_file)->fname = apr_pstrdup(p, old_file->fname);
|
||||
}
|
||||
if (!(old_file->flags & APR_FOPEN_NOCLEANUP)) {
|
||||
apr_pool_cleanup_register(p, (void *)(*new_file),
|
||||
apr_unix_file_cleanup,
|
||||
((*new_file)->flags & APR_INHERIT)
|
||||
? apr_pool_cleanup_null
|
||||
: apr_unix_child_file_cleanup);
|
||||
}
|
||||
|
||||
old_file->filedes = -1;
|
||||
apr_pool_cleanup_kill(old_file->pool, (void *)old_file,
|
||||
apr_unix_file_cleanup);
|
||||
#ifndef WAITIO_USES_POLL
|
||||
(*new_file)->pollset = NULL;
|
||||
#endif
|
||||
return APR_SUCCESS;
|
||||
}
|
314
file_io/unix/filepath.c
Normal file
314
file_io/unix/filepath.c
Normal file
@ -0,0 +1,314 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_private.h"
|
||||
#include "apr_arch_file_io.h"
|
||||
#include "apr_file_io.h"
|
||||
#include "apr_strings.h"
|
||||
#define APR_WANT_STRFUNC
|
||||
#include "apr_want.h"
|
||||
#if APR_HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
/* Win32 malpropism that can go away once everyone believes this
|
||||
* code is golden, and I'm not testing it anymore :-)
|
||||
*/
|
||||
#if APR_HAVE_DIRENT_H
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
/* Any OS that requires/refuses trailing slashes should be dealt with here.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_filepath_get(char **defpath, apr_int32_t flags,
|
||||
apr_pool_t *p)
|
||||
{
|
||||
char path[APR_PATH_MAX];
|
||||
|
||||
if (!getcwd(path, sizeof(path))) {
|
||||
if (errno == ERANGE)
|
||||
return APR_ENAMETOOLONG;
|
||||
else
|
||||
return errno;
|
||||
}
|
||||
*defpath = apr_pstrdup(p, path);
|
||||
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* Any OS that requires/refuses trailing slashes should be dealt with here
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_filepath_set(const char *path, apr_pool_t *p)
|
||||
{
|
||||
if (chdir(path) != 0)
|
||||
return errno;
|
||||
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_filepath_root(const char **rootpath,
|
||||
const char **inpath,
|
||||
apr_int32_t flags,
|
||||
apr_pool_t *p)
|
||||
{
|
||||
if (**inpath == '/') {
|
||||
*rootpath = apr_pstrdup(p, "/");
|
||||
do {
|
||||
++(*inpath);
|
||||
} while (**inpath == '/');
|
||||
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
return APR_ERELATIVE;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath,
|
||||
const char *rootpath,
|
||||
const char *addpath,
|
||||
apr_int32_t flags,
|
||||
apr_pool_t *p)
|
||||
{
|
||||
char *path;
|
||||
apr_size_t rootlen; /* is the length of the src rootpath */
|
||||
apr_size_t maxlen; /* maximum total path length */
|
||||
apr_size_t keptlen; /* is the length of the retained rootpath */
|
||||
apr_size_t pathlen; /* is the length of the result path */
|
||||
apr_size_t seglen; /* is the end of the current segment */
|
||||
apr_status_t rv;
|
||||
|
||||
/* Treat null as an empty path.
|
||||
*/
|
||||
if (!addpath)
|
||||
addpath = "";
|
||||
|
||||
if (addpath[0] == '/') {
|
||||
/* If addpath is rooted, then rootpath is unused.
|
||||
* Ths violates any APR_FILEPATH_SECUREROOTTEST and
|
||||
* APR_FILEPATH_NOTABSOLUTE flags specified.
|
||||
*/
|
||||
if (flags & APR_FILEPATH_SECUREROOTTEST)
|
||||
return APR_EABOVEROOT;
|
||||
if (flags & APR_FILEPATH_NOTABSOLUTE)
|
||||
return APR_EABSOLUTE;
|
||||
|
||||
/* If APR_FILEPATH_NOTABOVEROOT wasn't specified,
|
||||
* we won't test the root again, it's ignored.
|
||||
* Waste no CPU retrieving the working path.
|
||||
*/
|
||||
if (!rootpath && !(flags & APR_FILEPATH_NOTABOVEROOT))
|
||||
rootpath = "";
|
||||
}
|
||||
else {
|
||||
/* If APR_FILEPATH_NOTABSOLUTE is specified, the caller
|
||||
* requires a relative result. If the rootpath is
|
||||
* ommitted, we do not retrieve the working path,
|
||||
* if rootpath was supplied as absolute then fail.
|
||||
*/
|
||||
if (flags & APR_FILEPATH_NOTABSOLUTE) {
|
||||
if (!rootpath)
|
||||
rootpath = "";
|
||||
else if (rootpath[0] == '/')
|
||||
return APR_EABSOLUTE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!rootpath) {
|
||||
/* Start with the current working path. This is bass akwards,
|
||||
* but required since the compiler (at least vc) doesn't like
|
||||
* passing the address of a char const* for a char** arg.
|
||||
*/
|
||||
char *getpath;
|
||||
rv = apr_filepath_get(&getpath, flags, p);
|
||||
rootpath = getpath;
|
||||
if (rv != APR_SUCCESS)
|
||||
return errno;
|
||||
|
||||
/* XXX: Any kernel subject to goofy, uncanonical results
|
||||
* must run the rootpath against the user's given flags.
|
||||
* Simplest would be a recursive call to apr_filepath_merge
|
||||
* with an empty (not null) rootpath and addpath of the cwd.
|
||||
*/
|
||||
}
|
||||
|
||||
rootlen = strlen(rootpath);
|
||||
maxlen = rootlen + strlen(addpath) + 4; /* 4 for slashes at start, after
|
||||
* root, and at end, plus trailing
|
||||
* null */
|
||||
if (maxlen > APR_PATH_MAX) {
|
||||
return APR_ENAMETOOLONG;
|
||||
}
|
||||
path = (char *)apr_palloc(p, maxlen);
|
||||
|
||||
if (addpath[0] == '/') {
|
||||
/* Ignore the given root path, strip off leading
|
||||
* '/'s to a single leading '/' from the addpath,
|
||||
* and leave addpath at the first non-'/' character.
|
||||
*/
|
||||
keptlen = 0;
|
||||
while (addpath[0] == '/')
|
||||
++addpath;
|
||||
path[0] = '/';
|
||||
pathlen = 1;
|
||||
}
|
||||
else {
|
||||
/* If both paths are relative, fail early
|
||||
*/
|
||||
if (rootpath[0] != '/' && (flags & APR_FILEPATH_NOTRELATIVE))
|
||||
return APR_ERELATIVE;
|
||||
|
||||
/* Base the result path on the rootpath
|
||||
*/
|
||||
keptlen = rootlen;
|
||||
memcpy(path, rootpath, rootlen);
|
||||
|
||||
/* Always '/' terminate the given root path
|
||||
*/
|
||||
if (keptlen && path[keptlen - 1] != '/') {
|
||||
path[keptlen++] = '/';
|
||||
}
|
||||
pathlen = keptlen;
|
||||
}
|
||||
|
||||
while (*addpath) {
|
||||
/* Parse each segment, find the closing '/'
|
||||
*/
|
||||
const char *next = addpath;
|
||||
while (*next && (*next != '/')) {
|
||||
++next;
|
||||
}
|
||||
seglen = next - addpath;
|
||||
|
||||
if (seglen == 0 || (seglen == 1 && addpath[0] == '.')) {
|
||||
/* noop segment (/ or ./) so skip it
|
||||
*/
|
||||
}
|
||||
else if (seglen == 2 && addpath[0] == '.' && addpath[1] == '.') {
|
||||
/* backpath (../) */
|
||||
if (pathlen == 1 && path[0] == '/') {
|
||||
/* Attempt to move above root. Always die if the
|
||||
* APR_FILEPATH_SECUREROOTTEST flag is specified.
|
||||
*/
|
||||
if (flags & APR_FILEPATH_SECUREROOTTEST) {
|
||||
return APR_EABOVEROOT;
|
||||
}
|
||||
|
||||
/* Otherwise this is simply a noop, above root is root.
|
||||
* Flag that rootpath was entirely replaced.
|
||||
*/
|
||||
keptlen = 0;
|
||||
}
|
||||
else if (pathlen == 0
|
||||
|| (pathlen == 3
|
||||
&& !memcmp(path + pathlen - 3, "../", 3))
|
||||
|| (pathlen > 3
|
||||
&& !memcmp(path + pathlen - 4, "/../", 4))) {
|
||||
/* Path is already backpathed or empty, if the
|
||||
* APR_FILEPATH_SECUREROOTTEST.was given die now.
|
||||
*/
|
||||
if (flags & APR_FILEPATH_SECUREROOTTEST) {
|
||||
return APR_EABOVEROOT;
|
||||
}
|
||||
|
||||
/* Otherwise append another backpath, including
|
||||
* trailing slash if present.
|
||||
*/
|
||||
memcpy(path + pathlen, "../", *next ? 3 : 2);
|
||||
pathlen += *next ? 3 : 2;
|
||||
}
|
||||
else {
|
||||
/* otherwise crop the prior segment
|
||||
*/
|
||||
do {
|
||||
--pathlen;
|
||||
} while (pathlen && path[pathlen - 1] != '/');
|
||||
}
|
||||
|
||||
/* Now test if we are above where we started and back up
|
||||
* the keptlen offset to reflect the added/altered path.
|
||||
*/
|
||||
if (pathlen < keptlen) {
|
||||
if (flags & APR_FILEPATH_SECUREROOTTEST) {
|
||||
return APR_EABOVEROOT;
|
||||
}
|
||||
keptlen = pathlen;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* An actual segment, append it to the destination path
|
||||
*/
|
||||
if (*next) {
|
||||
seglen++;
|
||||
}
|
||||
memcpy(path + pathlen, addpath, seglen);
|
||||
pathlen += seglen;
|
||||
}
|
||||
|
||||
/* Skip over trailing slash to the next segment
|
||||
*/
|
||||
if (*next) {
|
||||
++next;
|
||||
}
|
||||
|
||||
addpath = next;
|
||||
}
|
||||
path[pathlen] = '\0';
|
||||
|
||||
/* keptlen will be the rootlen unless the addpath contained
|
||||
* backpath elements. If so, and APR_FILEPATH_NOTABOVEROOT
|
||||
* is specified (APR_FILEPATH_SECUREROOTTEST was caught above),
|
||||
* compare the original root to assure the result path is
|
||||
* still within given root path.
|
||||
*/
|
||||
if ((flags & APR_FILEPATH_NOTABOVEROOT) && keptlen < rootlen) {
|
||||
if (strncmp(rootpath, path, rootlen)) {
|
||||
return APR_EABOVEROOT;
|
||||
}
|
||||
if (rootpath[rootlen - 1] != '/'
|
||||
&& path[rootlen] && path[rootlen] != '/') {
|
||||
return APR_EABOVEROOT;
|
||||
}
|
||||
}
|
||||
|
||||
*newpath = path;
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_filepath_list_split(apr_array_header_t **pathelts,
|
||||
const char *liststr,
|
||||
apr_pool_t *p)
|
||||
{
|
||||
return apr_filepath_list_split_impl(pathelts, liststr, ':', p);
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_filepath_list_merge(char **liststr,
|
||||
apr_array_header_t *pathelts,
|
||||
apr_pool_t *p)
|
||||
{
|
||||
return apr_filepath_list_merge_impl(liststr, pathelts, ':', p);
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_filepath_encoding(int *style, apr_pool_t *p)
|
||||
{
|
||||
#if defined(DARWIN)
|
||||
*style = APR_FILEPATH_ENCODING_UTF8;
|
||||
#else
|
||||
*style = APR_FILEPATH_ENCODING_LOCALE;
|
||||
#endif
|
||||
return APR_SUCCESS;
|
||||
}
|
111
file_io/unix/filepath_util.c
Normal file
111
file_io/unix/filepath_util.c
Normal file
@ -0,0 +1,111 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#define APR_WANT_STRFUNC
|
||||
#define APR_WANT_MEMFUNC
|
||||
#include "apr_want.h"
|
||||
|
||||
#include "apr_errno.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_strings.h"
|
||||
#include "apr_tables.h"
|
||||
|
||||
#include "apr_private.h"
|
||||
|
||||
apr_status_t apr_filepath_list_split_impl(apr_array_header_t **pathelts,
|
||||
const char *liststr,
|
||||
char separator,
|
||||
apr_pool_t *p)
|
||||
{
|
||||
char *path, *part, *ptr;
|
||||
char separator_string[2] = { '\0', '\0' };
|
||||
apr_array_header_t *elts;
|
||||
int nelts;
|
||||
|
||||
separator_string[0] = separator;
|
||||
/* Count the number of path elements. We know there'll be at least
|
||||
one even if path is an empty string. */
|
||||
path = apr_pstrdup(p, liststr);
|
||||
for (nelts = 0, ptr = path; ptr != NULL; ++nelts)
|
||||
{
|
||||
ptr = strchr(ptr, separator);
|
||||
if (ptr)
|
||||
++ptr;
|
||||
}
|
||||
|
||||
/* Split the path into the array. */
|
||||
elts = apr_array_make(p, nelts, sizeof(char*));
|
||||
while ((part = apr_strtok(path, separator_string, &ptr)) != NULL)
|
||||
{
|
||||
if (*part == '\0') /* Ignore empty path components. */
|
||||
continue;
|
||||
|
||||
*(char**)apr_array_push(elts) = part;
|
||||
path = NULL; /* For the next call to apr_strtok */
|
||||
}
|
||||
|
||||
*pathelts = elts;
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
apr_status_t apr_filepath_list_merge_impl(char **liststr,
|
||||
apr_array_header_t *pathelts,
|
||||
char separator,
|
||||
apr_pool_t *p)
|
||||
{
|
||||
apr_size_t path_size = 0;
|
||||
char *path;
|
||||
int i;
|
||||
|
||||
/* This test isn't 100% certain, but it'll catch at least some
|
||||
invalid uses... */
|
||||
if (pathelts->elt_size != sizeof(char*))
|
||||
return APR_EINVAL;
|
||||
|
||||
/* Calculate the size of the merged path */
|
||||
for (i = 0; i < pathelts->nelts; ++i)
|
||||
path_size += strlen(((char**)pathelts->elts)[i]);
|
||||
|
||||
if (path_size == 0)
|
||||
{
|
||||
*liststr = NULL;
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
if (i > 0) /* Add space for the separators */
|
||||
path_size += (i - 1);
|
||||
|
||||
/* Merge the path components */
|
||||
path = *liststr = apr_palloc(p, path_size + 1);
|
||||
for (i = 0; i < pathelts->nelts; ++i)
|
||||
{
|
||||
/* ### Hmmmm. Calling strlen twice on the same string. Yuck.
|
||||
But is is better than reallocation in apr_pstrcat? */
|
||||
const char *part = ((char**)pathelts->elts)[i];
|
||||
apr_size_t part_size = strlen(part);
|
||||
if (part_size == 0) /* Ignore empty path components. */
|
||||
continue;
|
||||
|
||||
if (i > 0)
|
||||
*path++ = separator;
|
||||
memcpy(path, part, part_size);
|
||||
path += part_size;
|
||||
}
|
||||
*path = '\0';
|
||||
return APR_SUCCESS;
|
||||
}
|
339
file_io/unix/filestat.c
Normal file
339
file_io/unix/filestat.c
Normal file
@ -0,0 +1,339 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "apr_arch_file_io.h"
|
||||
#include "apr_file_io.h"
|
||||
#include "apr_general.h"
|
||||
#include "apr_strings.h"
|
||||
#include "apr_errno.h"
|
||||
|
||||
#ifdef HAVE_UTIME
|
||||
#include <utime.h>
|
||||
#endif
|
||||
|
||||
static apr_filetype_e filetype_from_mode(mode_t mode)
|
||||
{
|
||||
apr_filetype_e type;
|
||||
|
||||
switch (mode & S_IFMT) {
|
||||
case S_IFREG:
|
||||
type = APR_REG; break;
|
||||
case S_IFDIR:
|
||||
type = APR_DIR; break;
|
||||
case S_IFLNK:
|
||||
type = APR_LNK; break;
|
||||
case S_IFCHR:
|
||||
type = APR_CHR; break;
|
||||
case S_IFBLK:
|
||||
type = APR_BLK; break;
|
||||
#if defined(S_IFFIFO)
|
||||
case S_IFFIFO:
|
||||
type = APR_PIPE; break;
|
||||
#endif
|
||||
#if !defined(BEOS) && defined(S_IFSOCK)
|
||||
case S_IFSOCK:
|
||||
type = APR_SOCK; break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
/* Work around missing S_IFxxx values above
|
||||
* for Linux et al.
|
||||
*/
|
||||
#if !defined(S_IFFIFO) && defined(S_ISFIFO)
|
||||
if (S_ISFIFO(mode)) {
|
||||
type = APR_PIPE;
|
||||
} else
|
||||
#endif
|
||||
#if !defined(BEOS) && !defined(S_IFSOCK) && defined(S_ISSOCK)
|
||||
if (S_ISSOCK(mode)) {
|
||||
type = APR_SOCK;
|
||||
} else
|
||||
#endif
|
||||
type = APR_UNKFILE;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
static void fill_out_finfo(apr_finfo_t *finfo, struct_stat *info,
|
||||
apr_int32_t wanted)
|
||||
{
|
||||
finfo->valid = APR_FINFO_MIN | APR_FINFO_IDENT | APR_FINFO_NLINK
|
||||
| APR_FINFO_OWNER | APR_FINFO_PROT;
|
||||
finfo->protection = apr_unix_mode2perms(info->st_mode);
|
||||
finfo->filetype = filetype_from_mode(info->st_mode);
|
||||
finfo->user = info->st_uid;
|
||||
finfo->group = info->st_gid;
|
||||
finfo->size = info->st_size;
|
||||
finfo->device = info->st_dev;
|
||||
finfo->nlink = info->st_nlink;
|
||||
|
||||
/* Check for overflow if storing a 64-bit st_ino in a 32-bit
|
||||
* apr_ino_t for LFS builds: */
|
||||
if (sizeof(apr_ino_t) >= sizeof(info->st_ino)
|
||||
|| (apr_ino_t)info->st_ino == info->st_ino) {
|
||||
finfo->inode = info->st_ino;
|
||||
} else {
|
||||
finfo->valid &= ~APR_FINFO_INODE;
|
||||
}
|
||||
|
||||
apr_time_ansi_put(&finfo->atime, info->st_atime);
|
||||
#ifdef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
|
||||
finfo->atime += info->st_atim.tv_nsec / APR_TIME_C(1000);
|
||||
#elif defined(HAVE_STRUCT_STAT_ST_ATIMENSEC)
|
||||
finfo->atime += info->st_atimensec / APR_TIME_C(1000);
|
||||
#elif defined(HAVE_STRUCT_STAT_ST_ATIME_N)
|
||||
finfo->ctime += info->st_atime_n / APR_TIME_C(1000);
|
||||
#endif
|
||||
|
||||
apr_time_ansi_put(&finfo->mtime, info->st_mtime);
|
||||
#ifdef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
|
||||
finfo->mtime += info->st_mtim.tv_nsec / APR_TIME_C(1000);
|
||||
#elif defined(HAVE_STRUCT_STAT_ST_MTIMENSEC)
|
||||
finfo->mtime += info->st_mtimensec / APR_TIME_C(1000);
|
||||
#elif defined(HAVE_STRUCT_STAT_ST_MTIME_N)
|
||||
finfo->ctime += info->st_mtime_n / APR_TIME_C(1000);
|
||||
#endif
|
||||
|
||||
apr_time_ansi_put(&finfo->ctime, info->st_ctime);
|
||||
#ifdef HAVE_STRUCT_STAT_ST_CTIM_TV_NSEC
|
||||
finfo->ctime += info->st_ctim.tv_nsec / APR_TIME_C(1000);
|
||||
#elif defined(HAVE_STRUCT_STAT_ST_CTIMENSEC)
|
||||
finfo->ctime += info->st_ctimensec / APR_TIME_C(1000);
|
||||
#elif defined(HAVE_STRUCT_STAT_ST_CTIME_N)
|
||||
finfo->ctime += info->st_ctime_n / APR_TIME_C(1000);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRUCT_STAT_ST_BLOCKS
|
||||
#ifdef DEV_BSIZE
|
||||
finfo->csize = (apr_off_t)info->st_blocks * (apr_off_t)DEV_BSIZE;
|
||||
#else
|
||||
finfo->csize = (apr_off_t)info->st_blocks * (apr_off_t)512;
|
||||
#endif
|
||||
finfo->valid |= APR_FINFO_CSIZE;
|
||||
#endif
|
||||
}
|
||||
|
||||
apr_status_t apr_file_info_get_locked(apr_finfo_t *finfo, apr_int32_t wanted,
|
||||
apr_file_t *thefile)
|
||||
{
|
||||
struct_stat info;
|
||||
|
||||
if (thefile->buffered) {
|
||||
apr_status_t rv = apr_file_flush_locked(thefile);
|
||||
if (rv != APR_SUCCESS)
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (fstat(thefile->filedes, &info) == 0) {
|
||||
finfo->pool = thefile->pool;
|
||||
finfo->fname = thefile->fname;
|
||||
fill_out_finfo(finfo, &info, wanted);
|
||||
return (wanted & ~finfo->valid) ? APR_INCOMPLETE : APR_SUCCESS;
|
||||
}
|
||||
else {
|
||||
return errno;
|
||||
}
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_info_get(apr_finfo_t *finfo,
|
||||
apr_int32_t wanted,
|
||||
apr_file_t *thefile)
|
||||
{
|
||||
struct_stat info;
|
||||
|
||||
if (thefile->buffered) {
|
||||
apr_status_t rv = apr_file_flush(thefile);
|
||||
if (rv != APR_SUCCESS)
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (fstat(thefile->filedes, &info) == 0) {
|
||||
finfo->pool = thefile->pool;
|
||||
finfo->fname = thefile->fname;
|
||||
fill_out_finfo(finfo, &info, wanted);
|
||||
return (wanted & ~finfo->valid) ? APR_INCOMPLETE : APR_SUCCESS;
|
||||
}
|
||||
else {
|
||||
return errno;
|
||||
}
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_perms_set(const char *fname,
|
||||
apr_fileperms_t perms)
|
||||
{
|
||||
mode_t mode = apr_unix_perms2mode(perms);
|
||||
|
||||
if (chmod(fname, mode) == -1)
|
||||
return errno;
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname,
|
||||
apr_fileattrs_t attributes,
|
||||
apr_fileattrs_t attr_mask,
|
||||
apr_pool_t *pool)
|
||||
{
|
||||
apr_status_t status;
|
||||
apr_finfo_t finfo;
|
||||
|
||||
/* Don't do anything if we can't handle the requested attributes */
|
||||
if (!(attr_mask & (APR_FILE_ATTR_READONLY
|
||||
| APR_FILE_ATTR_EXECUTABLE)))
|
||||
return APR_SUCCESS;
|
||||
|
||||
status = apr_stat(&finfo, fname, APR_FINFO_PROT, pool);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
/* ### TODO: should added bits be umask'd? */
|
||||
if (attr_mask & APR_FILE_ATTR_READONLY)
|
||||
{
|
||||
if (attributes & APR_FILE_ATTR_READONLY)
|
||||
{
|
||||
finfo.protection &= ~APR_UWRITE;
|
||||
finfo.protection &= ~APR_GWRITE;
|
||||
finfo.protection &= ~APR_WWRITE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* ### umask this! */
|
||||
finfo.protection |= APR_UWRITE;
|
||||
finfo.protection |= APR_GWRITE;
|
||||
finfo.protection |= APR_WWRITE;
|
||||
}
|
||||
}
|
||||
|
||||
if (attr_mask & APR_FILE_ATTR_EXECUTABLE)
|
||||
{
|
||||
if (attributes & APR_FILE_ATTR_EXECUTABLE)
|
||||
{
|
||||
/* ### umask this! */
|
||||
finfo.protection |= APR_UEXECUTE;
|
||||
finfo.protection |= APR_GEXECUTE;
|
||||
finfo.protection |= APR_WEXECUTE;
|
||||
}
|
||||
else
|
||||
{
|
||||
finfo.protection &= ~APR_UEXECUTE;
|
||||
finfo.protection &= ~APR_GEXECUTE;
|
||||
finfo.protection &= ~APR_WEXECUTE;
|
||||
}
|
||||
}
|
||||
|
||||
return apr_file_perms_set(fname, finfo.protection);
|
||||
}
|
||||
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname,
|
||||
apr_time_t mtime,
|
||||
apr_pool_t *pool)
|
||||
{
|
||||
apr_status_t status;
|
||||
apr_finfo_t finfo;
|
||||
|
||||
status = apr_stat(&finfo, fname, APR_FINFO_ATIME, pool);
|
||||
if (status) {
|
||||
return status;
|
||||
}
|
||||
|
||||
#ifdef HAVE_UTIMES
|
||||
{
|
||||
struct timeval tvp[2];
|
||||
|
||||
tvp[0].tv_sec = apr_time_sec(finfo.atime);
|
||||
tvp[0].tv_usec = apr_time_usec(finfo.atime);
|
||||
tvp[1].tv_sec = apr_time_sec(mtime);
|
||||
tvp[1].tv_usec = apr_time_usec(mtime);
|
||||
|
||||
if (utimes(fname, tvp) == -1) {
|
||||
return errno;
|
||||
}
|
||||
}
|
||||
#elif defined(HAVE_UTIME)
|
||||
{
|
||||
struct utimbuf buf;
|
||||
|
||||
buf.actime = (time_t) (finfo.atime / APR_USEC_PER_SEC);
|
||||
buf.modtime = (time_t) (mtime / APR_USEC_PER_SEC);
|
||||
|
||||
if (utime(fname, &buf) == -1) {
|
||||
return errno;
|
||||
}
|
||||
}
|
||||
#else
|
||||
return APR_ENOTIMPL;
|
||||
#endif
|
||||
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo,
|
||||
const char *fname,
|
||||
apr_int32_t wanted, apr_pool_t *pool)
|
||||
{
|
||||
struct_stat info;
|
||||
int srv;
|
||||
|
||||
if (wanted & APR_FINFO_LINK)
|
||||
srv = lstat(fname, &info);
|
||||
else
|
||||
srv = stat(fname, &info);
|
||||
|
||||
if (srv == 0) {
|
||||
finfo->pool = pool;
|
||||
finfo->fname = fname;
|
||||
fill_out_finfo(finfo, &info, wanted);
|
||||
if (wanted & APR_FINFO_LINK)
|
||||
wanted &= ~APR_FINFO_LINK;
|
||||
return (wanted & ~finfo->valid) ? APR_INCOMPLETE : APR_SUCCESS;
|
||||
}
|
||||
else {
|
||||
#if !defined(ENOENT) || !defined(ENOTDIR)
|
||||
#error ENOENT || ENOTDIR not defined; please see the
|
||||
#error comments at this line in the source for a workaround.
|
||||
/*
|
||||
* If ENOENT || ENOTDIR is not defined in one of the your OS's
|
||||
* include files, APR cannot report a good reason why the stat()
|
||||
* of the file failed; there are cases where it can fail even though
|
||||
* the file exists. This opens holes in Apache, for example, because
|
||||
* it becomes possible for someone to get a directory listing of a
|
||||
* directory even though there is an index (eg. index.html) file in
|
||||
* it. If you do not have a problem with this, delete the above
|
||||
* #error lines and start the compile again. If you need to do this,
|
||||
* please submit a bug report to http://www.apache.org/bug_report.html
|
||||
* letting us know that you needed to do this. Please be sure to
|
||||
* include the operating system you are using.
|
||||
*/
|
||||
/* WARNING: All errors will be handled as not found
|
||||
*/
|
||||
#if !defined(ENOENT)
|
||||
return APR_ENOENT;
|
||||
#else
|
||||
/* WARNING: All errors but not found will be handled as not directory
|
||||
*/
|
||||
if (errno != ENOENT)
|
||||
return APR_ENOENT;
|
||||
else
|
||||
return errno;
|
||||
#endif
|
||||
#else /* All was defined well, report the usual: */
|
||||
return errno;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
120
file_io/unix/flock.c
Normal file
120
file_io/unix/flock.c
Normal file
@ -0,0 +1,120 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "apr_arch_file_io.h"
|
||||
|
||||
#if APR_HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_FILE_H
|
||||
#include <sys/file.h>
|
||||
#endif
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_lock(apr_file_t *thefile, int type)
|
||||
{
|
||||
int rc;
|
||||
|
||||
#if defined(HAVE_FCNTL_H)
|
||||
{
|
||||
struct flock l = { 0 };
|
||||
int fc;
|
||||
|
||||
l.l_whence = SEEK_SET; /* lock from current point */
|
||||
l.l_start = 0; /* begin lock at this offset */
|
||||
l.l_len = 0; /* lock to end of file */
|
||||
if ((type & APR_FLOCK_TYPEMASK) == APR_FLOCK_SHARED)
|
||||
l.l_type = F_RDLCK;
|
||||
else
|
||||
l.l_type = F_WRLCK;
|
||||
|
||||
fc = (type & APR_FLOCK_NONBLOCK) ? F_SETLK : F_SETLKW;
|
||||
|
||||
/* keep trying if fcntl() gets interrupted (by a signal) */
|
||||
while ((rc = fcntl(thefile->filedes, fc, &l)) < 0 && errno == EINTR)
|
||||
continue;
|
||||
|
||||
if (rc == -1) {
|
||||
/* on some Unix boxes (e.g., Tru64), we get EACCES instead
|
||||
* of EAGAIN; we don't want APR_STATUS_IS_EAGAIN() matching EACCES
|
||||
* since that breaks other things, so fix up the retcode here
|
||||
*/
|
||||
if (errno == EACCES) {
|
||||
return EAGAIN;
|
||||
}
|
||||
return errno;
|
||||
}
|
||||
}
|
||||
#elif defined(HAVE_SYS_FILE_H)
|
||||
{
|
||||
int ltype;
|
||||
|
||||
if ((type & APR_FLOCK_TYPEMASK) == APR_FLOCK_SHARED)
|
||||
ltype = LOCK_SH;
|
||||
else
|
||||
ltype = LOCK_EX;
|
||||
if ((type & APR_FLOCK_NONBLOCK) != 0)
|
||||
ltype |= LOCK_NB;
|
||||
|
||||
/* keep trying if flock() gets interrupted (by a signal) */
|
||||
while ((rc = flock(thefile->filedes, ltype)) < 0 && errno == EINTR)
|
||||
continue;
|
||||
|
||||
if (rc == -1)
|
||||
return errno;
|
||||
}
|
||||
#else
|
||||
#error No file locking mechanism is available.
|
||||
#endif
|
||||
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_unlock(apr_file_t *thefile)
|
||||
{
|
||||
int rc;
|
||||
|
||||
#if defined(HAVE_FCNTL_H)
|
||||
{
|
||||
struct flock l = { 0 };
|
||||
|
||||
l.l_whence = SEEK_SET; /* lock from current point */
|
||||
l.l_start = 0; /* begin lock at this offset */
|
||||
l.l_len = 0; /* lock to end of file */
|
||||
l.l_type = F_UNLCK;
|
||||
|
||||
/* keep trying if fcntl() gets interrupted (by a signal) */
|
||||
while ((rc = fcntl(thefile->filedes, F_SETLKW, &l)) < 0
|
||||
&& errno == EINTR)
|
||||
continue;
|
||||
|
||||
if (rc == -1)
|
||||
return errno;
|
||||
}
|
||||
#elif defined(HAVE_SYS_FILE_H)
|
||||
{
|
||||
/* keep trying if flock() gets interrupted (by a signal) */
|
||||
while ((rc = flock(thefile->filedes, LOCK_UN)) < 0 && errno == EINTR)
|
||||
continue;
|
||||
|
||||
if (rc == -1)
|
||||
return errno;
|
||||
}
|
||||
#else
|
||||
#error No file locking mechanism is available.
|
||||
#endif
|
||||
|
||||
return APR_SUCCESS;
|
||||
}
|
111
file_io/unix/fullrw.c
Normal file
111
file_io/unix/fullrw.c
Normal file
@ -0,0 +1,111 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "apr_file_io.h"
|
||||
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_read_full(apr_file_t *thefile, void *buf,
|
||||
apr_size_t nbytes,
|
||||
apr_size_t *bytes_read)
|
||||
{
|
||||
apr_status_t status;
|
||||
apr_size_t total_read = 0;
|
||||
|
||||
do {
|
||||
apr_size_t amt = nbytes;
|
||||
|
||||
status = apr_file_read(thefile, buf, &amt);
|
||||
buf = (char *)buf + amt;
|
||||
nbytes -= amt;
|
||||
total_read += amt;
|
||||
} while (status == APR_SUCCESS && nbytes > 0);
|
||||
|
||||
if (bytes_read != NULL)
|
||||
*bytes_read = total_read;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_write_full(apr_file_t *thefile,
|
||||
const void *buf,
|
||||
apr_size_t nbytes,
|
||||
apr_size_t *bytes_written)
|
||||
{
|
||||
apr_status_t status;
|
||||
apr_size_t total_written = 0;
|
||||
|
||||
do {
|
||||
apr_size_t amt = nbytes;
|
||||
|
||||
status = apr_file_write(thefile, buf, &amt);
|
||||
buf = (char *)buf + amt;
|
||||
nbytes -= amt;
|
||||
total_written += amt;
|
||||
} while (status == APR_SUCCESS && nbytes > 0);
|
||||
|
||||
if (bytes_written != NULL)
|
||||
*bytes_written = total_written;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_writev_full(apr_file_t *thefile,
|
||||
const struct iovec *vec,
|
||||
apr_size_t nvec,
|
||||
apr_size_t *bytes_written)
|
||||
{
|
||||
apr_status_t rv = APR_SUCCESS;
|
||||
apr_size_t i;
|
||||
apr_size_t amt = 0;
|
||||
apr_size_t total = 0;
|
||||
|
||||
for (i = 0; i < nvec; i++) {
|
||||
total += vec[i].iov_len;
|
||||
}
|
||||
|
||||
rv = apr_file_writev(thefile, vec, nvec, &amt);
|
||||
|
||||
if (bytes_written != NULL)
|
||||
*bytes_written = amt;
|
||||
|
||||
if (rv != APR_SUCCESS || (amt == total)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
for (i = 0; i < nvec && amt; i++) {
|
||||
if (amt >= vec[i].iov_len) {
|
||||
amt -= vec[i].iov_len;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (amt) {
|
||||
rv = apr_file_write_full(thefile, (const char *)vec[i].iov_base + amt,
|
||||
vec[i].iov_len - amt, NULL);
|
||||
}
|
||||
|
||||
for (; i < nvec && rv == APR_SUCCESS; i++) {
|
||||
rv = apr_file_write_full(thefile, vec[i].iov_base,
|
||||
vec[i].iov_len, &amt);
|
||||
}
|
||||
|
||||
if (bytes_written != NULL)
|
||||
*bytes_written = total;
|
||||
|
||||
return rv;
|
||||
}
|
223
file_io/unix/mktemp.c
Normal file
223
file_io/unix/mktemp.c
Normal file
@ -0,0 +1,223 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1987, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS 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 REGENTS OR 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.
|
||||
*/
|
||||
|
||||
#include "apr_private.h"
|
||||
#include "apr_file_io.h" /* prototype of apr_mkstemp() */
|
||||
#include "apr_strings.h" /* prototype of apr_mkstemp() */
|
||||
#include "apr_arch_file_io.h" /* prototype of apr_mkstemp() */
|
||||
#include "apr_portable.h" /* for apr_os_file_put() */
|
||||
#include "apr_arch_inherit.h"
|
||||
|
||||
#ifndef HAVE_MKSTEMP
|
||||
|
||||
#if defined(SVR4) || defined(WIN32) || defined(NETWARE)
|
||||
#ifdef SVR4
|
||||
#if HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
#endif
|
||||
#define arc4random() rand()
|
||||
#define seedrandom(a) srand(a)
|
||||
#else
|
||||
#if APR_HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#define arc4random() random()
|
||||
#define seedrandom(a) srandom(a)
|
||||
#endif
|
||||
|
||||
#if APR_HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#if APR_HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
#if APR_HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#ifdef HAVE_TIME_H
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
static const unsigned char padchar[] =
|
||||
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
static apr_uint32_t randseed=0;
|
||||
|
||||
static int gettemp(char *path, apr_file_t **doopen, apr_int32_t flags, apr_pool_t *p)
|
||||
{
|
||||
register char *start, *trv, *suffp;
|
||||
char *pad;
|
||||
apr_finfo_t sbuf;
|
||||
apr_status_t rv;
|
||||
apr_uint32_t randnum;
|
||||
|
||||
if (randseed==0) {
|
||||
randseed = (int)apr_time_now();
|
||||
seedrandom(randseed);
|
||||
}
|
||||
|
||||
for (trv = path; *trv; ++trv)
|
||||
;
|
||||
suffp = trv;
|
||||
--trv;
|
||||
if (trv < path) {
|
||||
return APR_EINVAL;
|
||||
}
|
||||
|
||||
/* Fill space with random characters */
|
||||
while (*trv == 'X') {
|
||||
randnum = arc4random() % (sizeof(padchar) - 1);
|
||||
*trv-- = padchar[randnum];
|
||||
}
|
||||
start = trv + 1;
|
||||
|
||||
/*
|
||||
* check the target directory.
|
||||
*/
|
||||
for (;; --trv) {
|
||||
if (trv <= path)
|
||||
break;
|
||||
if (*trv == '/') {
|
||||
*trv = '\0';
|
||||
rv = apr_stat(&sbuf, path, APR_FINFO_TYPE, p);
|
||||
*trv = '/';
|
||||
if (rv != APR_SUCCESS)
|
||||
return rv;
|
||||
if (sbuf.filetype != APR_DIR) {
|
||||
return APR_ENOTDIR;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
if ((rv = apr_file_open(doopen, path, flags,
|
||||
APR_UREAD | APR_UWRITE, p)) == APR_SUCCESS)
|
||||
return APR_SUCCESS;
|
||||
if (!APR_STATUS_IS_EEXIST(rv))
|
||||
return rv;
|
||||
|
||||
/* If we have a collision, cycle through the space of filenames */
|
||||
for (trv = start;;) {
|
||||
if (*trv == '\0' || trv == suffp)
|
||||
return APR_EINVAL; /* XXX: is this the correct return code? */
|
||||
pad = strchr((char *)padchar, *trv);
|
||||
if (pad == NULL || !*++pad) {
|
||||
*trv++ = padchar[0];
|
||||
}
|
||||
else {
|
||||
*trv++ = *pad;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#if APR_HAVE_STDLIB_H
|
||||
#include <stdlib.h> /* for mkstemp() - Single Unix */
|
||||
#endif
|
||||
#if APR_HAVE_UNISTD_H
|
||||
#include <unistd.h> /* for mkstemp() - FreeBSD */
|
||||
#endif
|
||||
#endif /* !defined(HAVE_MKSTEMP) */
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_mktemp(apr_file_t **fp, char *template, apr_int32_t flags, apr_pool_t *p)
|
||||
{
|
||||
#ifdef HAVE_MKSTEMP
|
||||
int fd;
|
||||
#endif
|
||||
flags = (!flags) ? APR_FOPEN_CREATE | APR_FOPEN_READ | APR_FOPEN_WRITE | APR_FOPEN_EXCL |
|
||||
APR_FOPEN_DELONCLOSE : flags;
|
||||
#ifndef HAVE_MKSTEMP
|
||||
return gettemp(template, fp, flags, p);
|
||||
#else
|
||||
|
||||
#ifdef HAVE_MKSTEMP64
|
||||
fd = mkstemp64(template);
|
||||
#else
|
||||
fd = mkstemp(template);
|
||||
#endif
|
||||
|
||||
if (fd == -1) {
|
||||
return errno;
|
||||
}
|
||||
/* XXX: We must reset several flags values as passed-in, since
|
||||
* mkstemp didn't subscribe to our preference flags.
|
||||
*
|
||||
* We either have to unset the flags, or fix up the fd and other
|
||||
* xthread and inherit bits appropriately. Since gettemp() above
|
||||
* calls apr_file_open, our flags are respected in that code path.
|
||||
*/
|
||||
apr_os_file_put(fp, &fd, flags, p);
|
||||
(*fp)->fname = apr_pstrdup(p, template);
|
||||
|
||||
if (!(flags & APR_FOPEN_NOCLEANUP)) {
|
||||
int flags;
|
||||
|
||||
if ((flags = fcntl(fd, F_GETFD)) == -1)
|
||||
return errno;
|
||||
|
||||
flags |= FD_CLOEXEC;
|
||||
if (fcntl(fd, F_SETFD, flags) == -1)
|
||||
return errno;
|
||||
|
||||
apr_pool_cleanup_register((*fp)->pool, (void *)(*fp),
|
||||
apr_unix_file_cleanup,
|
||||
apr_unix_child_file_cleanup);
|
||||
}
|
||||
#endif
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
409
file_io/unix/open.c
Normal file
409
file_io/unix/open.c
Normal file
@ -0,0 +1,409 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "apr_arch_file_io.h"
|
||||
#include "apr_strings.h"
|
||||
#include "apr_portable.h"
|
||||
#include "apr_thread_mutex.h"
|
||||
#include "apr_arch_inherit.h"
|
||||
|
||||
#ifdef NETWARE
|
||||
#include "nks/dirio.h"
|
||||
#include "apr_hash.h"
|
||||
#include "fsio.h"
|
||||
#endif
|
||||
|
||||
static apr_status_t file_cleanup(apr_file_t *file, int is_child)
|
||||
{
|
||||
apr_status_t rv = APR_SUCCESS;
|
||||
int fd = file->filedes;
|
||||
|
||||
/* Set file descriptor to -1 before close(), so that there is no
|
||||
* chance of returning an already closed FD from apr_os_file_get().
|
||||
*/
|
||||
file->filedes = -1;
|
||||
|
||||
if (close(fd) == 0) {
|
||||
/* Only the parent process should delete the file! */
|
||||
if (!is_child && (file->flags & APR_FOPEN_DELONCLOSE)) {
|
||||
unlink(file->fname);
|
||||
}
|
||||
#if APR_HAS_THREADS
|
||||
if (file->thlock) {
|
||||
rv = apr_thread_mutex_destroy(file->thlock);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
/* Restore, close() was not successful. */
|
||||
file->filedes = fd;
|
||||
|
||||
/* Are there any error conditions other than EINTR or EBADF? */
|
||||
rv = errno;
|
||||
}
|
||||
#ifndef WAITIO_USES_POLL
|
||||
if (file->pollset != NULL) {
|
||||
apr_status_t pollset_rv = apr_pollset_destroy(file->pollset);
|
||||
/* If the file close failed, return its error value,
|
||||
* not apr_pollset_destroy()'s.
|
||||
*/
|
||||
if (rv == APR_SUCCESS) {
|
||||
rv = pollset_rv;
|
||||
}
|
||||
}
|
||||
#endif /* !WAITIO_USES_POLL */
|
||||
return rv;
|
||||
}
|
||||
|
||||
apr_status_t apr_unix_file_cleanup(void *thefile)
|
||||
{
|
||||
apr_file_t *file = thefile;
|
||||
apr_status_t flush_rv = APR_SUCCESS, rv = APR_SUCCESS;
|
||||
|
||||
if (file->buffered) {
|
||||
flush_rv = apr_file_flush(file);
|
||||
}
|
||||
|
||||
rv = file_cleanup(file, 0);
|
||||
|
||||
return rv != APR_SUCCESS ? rv : flush_rv;
|
||||
}
|
||||
|
||||
apr_status_t apr_unix_child_file_cleanup(void *thefile)
|
||||
{
|
||||
return file_cleanup(thefile, 1);
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new,
|
||||
const char *fname,
|
||||
apr_int32_t flag,
|
||||
apr_fileperms_t perm,
|
||||
apr_pool_t *pool)
|
||||
{
|
||||
apr_os_file_t fd;
|
||||
int oflags = 0;
|
||||
#if APR_HAS_THREADS
|
||||
apr_thread_mutex_t *thlock;
|
||||
apr_status_t rv;
|
||||
#endif
|
||||
|
||||
if ((flag & APR_FOPEN_READ) && (flag & APR_FOPEN_WRITE)) {
|
||||
oflags = O_RDWR;
|
||||
}
|
||||
else if (flag & APR_FOPEN_READ) {
|
||||
oflags = O_RDONLY;
|
||||
}
|
||||
else if (flag & APR_FOPEN_WRITE) {
|
||||
oflags = O_WRONLY;
|
||||
}
|
||||
else {
|
||||
return APR_EACCES;
|
||||
}
|
||||
|
||||
if (flag & APR_FOPEN_CREATE) {
|
||||
oflags |= O_CREAT;
|
||||
if (flag & APR_FOPEN_EXCL) {
|
||||
oflags |= O_EXCL;
|
||||
}
|
||||
}
|
||||
if ((flag & APR_FOPEN_EXCL) && !(flag & APR_FOPEN_CREATE)) {
|
||||
return APR_EACCES;
|
||||
}
|
||||
|
||||
if (flag & APR_FOPEN_APPEND) {
|
||||
oflags |= O_APPEND;
|
||||
}
|
||||
if (flag & APR_FOPEN_TRUNCATE) {
|
||||
oflags |= O_TRUNC;
|
||||
}
|
||||
#ifdef O_BINARY
|
||||
if (flag & APR_FOPEN_BINARY) {
|
||||
oflags |= O_BINARY;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef O_CLOEXEC
|
||||
/* Introduced in Linux 2.6.23. Silently ignored on earlier Linux kernels.
|
||||
*/
|
||||
if (!(flag & APR_FOPEN_NOCLEANUP)) {
|
||||
oflags |= O_CLOEXEC;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if APR_HAS_LARGE_FILES && defined(_LARGEFILE64_SOURCE)
|
||||
oflags |= O_LARGEFILE;
|
||||
#elif defined(O_LARGEFILE)
|
||||
if (flag & APR_FOPEN_LARGEFILE) {
|
||||
oflags |= O_LARGEFILE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if APR_HAS_THREADS
|
||||
if ((flag & APR_FOPEN_BUFFERED) && (flag & APR_FOPEN_XTHREAD)) {
|
||||
rv = apr_thread_mutex_create(&thlock,
|
||||
APR_THREAD_MUTEX_DEFAULT, pool);
|
||||
if (rv) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (perm == APR_OS_DEFAULT) {
|
||||
fd = open(fname, oflags, 0666);
|
||||
}
|
||||
else {
|
||||
fd = open(fname, oflags, apr_unix_perms2mode(perm));
|
||||
}
|
||||
if (fd < 0) {
|
||||
return errno;
|
||||
}
|
||||
if (!(flag & APR_FOPEN_NOCLEANUP)) {
|
||||
#ifdef O_CLOEXEC
|
||||
static int has_o_cloexec = 0;
|
||||
if (!has_o_cloexec)
|
||||
#endif
|
||||
{
|
||||
int flags;
|
||||
|
||||
if ((flags = fcntl(fd, F_GETFD)) == -1) {
|
||||
close(fd);
|
||||
return errno;
|
||||
}
|
||||
if ((flags & FD_CLOEXEC) == 0) {
|
||||
flags |= FD_CLOEXEC;
|
||||
if (fcntl(fd, F_SETFD, flags) == -1) {
|
||||
close(fd);
|
||||
return errno;
|
||||
}
|
||||
}
|
||||
#ifdef O_CLOEXEC
|
||||
else {
|
||||
has_o_cloexec = 1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
(*new) = (apr_file_t *)apr_pcalloc(pool, sizeof(apr_file_t));
|
||||
(*new)->pool = pool;
|
||||
(*new)->flags = flag;
|
||||
(*new)->filedes = fd;
|
||||
|
||||
(*new)->fname = apr_pstrdup(pool, fname);
|
||||
|
||||
(*new)->blocking = BLK_ON;
|
||||
(*new)->buffered = (flag & APR_FOPEN_BUFFERED) > 0;
|
||||
|
||||
if ((*new)->buffered) {
|
||||
(*new)->buffer = apr_palloc(pool, APR_FILE_DEFAULT_BUFSIZE);
|
||||
(*new)->bufsize = APR_FILE_DEFAULT_BUFSIZE;
|
||||
#if APR_HAS_THREADS
|
||||
if ((*new)->flags & APR_FOPEN_XTHREAD) {
|
||||
(*new)->thlock = thlock;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
(*new)->buffer = NULL;
|
||||
}
|
||||
|
||||
(*new)->is_pipe = 0;
|
||||
(*new)->timeout = -1;
|
||||
(*new)->ungetchar = -1;
|
||||
(*new)->eof_hit = 0;
|
||||
(*new)->filePtr = 0;
|
||||
(*new)->bufpos = 0;
|
||||
(*new)->dataRead = 0;
|
||||
(*new)->direction = 0;
|
||||
#ifndef WAITIO_USES_POLL
|
||||
/* Start out with no pollset. apr_wait_for_io_or_timeout() will
|
||||
* initialize the pollset if needed.
|
||||
*/
|
||||
(*new)->pollset = NULL;
|
||||
#endif
|
||||
if (!(flag & APR_FOPEN_NOCLEANUP)) {
|
||||
apr_pool_cleanup_register((*new)->pool, (void *)(*new),
|
||||
apr_unix_file_cleanup,
|
||||
apr_unix_child_file_cleanup);
|
||||
}
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_close(apr_file_t *file)
|
||||
{
|
||||
return apr_pool_cleanup_run(file->pool, file, apr_unix_file_cleanup);
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_remove(const char *path, apr_pool_t *pool)
|
||||
{
|
||||
if (unlink(path) == 0) {
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
else {
|
||||
return errno;
|
||||
}
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_rename(const char *from_path,
|
||||
const char *to_path,
|
||||
apr_pool_t *p)
|
||||
{
|
||||
if (rename(from_path, to_path) != 0) {
|
||||
return errno;
|
||||
}
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_os_file_get(apr_os_file_t *thefile,
|
||||
apr_file_t *file)
|
||||
{
|
||||
*thefile = file->filedes;
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file,
|
||||
apr_os_file_t *thefile,
|
||||
apr_int32_t flags, apr_pool_t *pool)
|
||||
{
|
||||
int *dafile = thefile;
|
||||
|
||||
(*file) = apr_pcalloc(pool, sizeof(apr_file_t));
|
||||
(*file)->pool = pool;
|
||||
(*file)->eof_hit = 0;
|
||||
(*file)->blocking = BLK_UNKNOWN; /* in case it is a pipe */
|
||||
(*file)->timeout = -1;
|
||||
(*file)->ungetchar = -1; /* no char avail */
|
||||
(*file)->filedes = *dafile;
|
||||
(*file)->flags = flags | APR_FOPEN_NOCLEANUP;
|
||||
(*file)->buffered = (flags & APR_FOPEN_BUFFERED) > 0;
|
||||
|
||||
#ifndef WAITIO_USES_POLL
|
||||
/* Start out with no pollset. apr_wait_for_io_or_timeout() will
|
||||
* initialize the pollset if needed.
|
||||
*/
|
||||
(*file)->pollset = NULL;
|
||||
#endif
|
||||
|
||||
if ((*file)->buffered) {
|
||||
(*file)->buffer = apr_palloc(pool, APR_FILE_DEFAULT_BUFSIZE);
|
||||
(*file)->bufsize = APR_FILE_DEFAULT_BUFSIZE;
|
||||
#if APR_HAS_THREADS
|
||||
if ((*file)->flags & APR_FOPEN_XTHREAD) {
|
||||
apr_status_t rv;
|
||||
rv = apr_thread_mutex_create(&((*file)->thlock),
|
||||
APR_THREAD_MUTEX_DEFAULT, pool);
|
||||
if (rv) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_eof(apr_file_t *fptr)
|
||||
{
|
||||
if (fptr->eof_hit == 1) {
|
||||
return APR_EOF;
|
||||
}
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_open_flags_stderr(apr_file_t **thefile,
|
||||
apr_int32_t flags,
|
||||
apr_pool_t *pool)
|
||||
{
|
||||
int fd = STDERR_FILENO;
|
||||
|
||||
return apr_os_file_put(thefile, &fd, flags | APR_FOPEN_WRITE, pool);
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_open_flags_stdout(apr_file_t **thefile,
|
||||
apr_int32_t flags,
|
||||
apr_pool_t *pool)
|
||||
{
|
||||
int fd = STDOUT_FILENO;
|
||||
|
||||
return apr_os_file_put(thefile, &fd, flags | APR_FOPEN_WRITE, pool);
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_open_flags_stdin(apr_file_t **thefile,
|
||||
apr_int32_t flags,
|
||||
apr_pool_t *pool)
|
||||
{
|
||||
int fd = STDIN_FILENO;
|
||||
|
||||
return apr_os_file_put(thefile, &fd, flags | APR_FOPEN_READ, pool);
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_open_stderr(apr_file_t **thefile,
|
||||
apr_pool_t *pool)
|
||||
{
|
||||
return apr_file_open_flags_stderr(thefile, 0, pool);
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_open_stdout(apr_file_t **thefile,
|
||||
apr_pool_t *pool)
|
||||
{
|
||||
return apr_file_open_flags_stdout(thefile, 0, pool);
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_open_stdin(apr_file_t **thefile,
|
||||
apr_pool_t *pool)
|
||||
{
|
||||
return apr_file_open_flags_stdin(thefile, 0, pool);
|
||||
}
|
||||
|
||||
APR_IMPLEMENT_INHERIT_SET(file, flags, pool, apr_unix_file_cleanup)
|
||||
|
||||
/* We need to do this by hand instead of using APR_IMPLEMENT_INHERIT_UNSET
|
||||
* because the macro sets both cleanups to the same function, which is not
|
||||
* suitable on Unix (see PR 41119). */
|
||||
APR_DECLARE(apr_status_t) apr_file_inherit_unset(apr_file_t *thefile)
|
||||
{
|
||||
if (thefile->flags & APR_FOPEN_NOCLEANUP) {
|
||||
return APR_EINVAL;
|
||||
}
|
||||
if (thefile->flags & APR_INHERIT) {
|
||||
int flags;
|
||||
|
||||
if ((flags = fcntl(thefile->filedes, F_GETFD)) == -1)
|
||||
return errno;
|
||||
|
||||
flags |= FD_CLOEXEC;
|
||||
if (fcntl(thefile->filedes, F_SETFD, flags) == -1)
|
||||
return errno;
|
||||
|
||||
thefile->flags &= ~APR_INHERIT;
|
||||
apr_pool_child_cleanup_set(thefile->pool,
|
||||
(void *)thefile,
|
||||
apr_unix_file_cleanup,
|
||||
apr_unix_child_file_cleanup);
|
||||
}
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
APR_POOL_IMPLEMENT_ACCESSOR(file)
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_link(const char *from_path,
|
||||
const char *to_path)
|
||||
{
|
||||
if (link(from_path, to_path) == -1) {
|
||||
return errno;
|
||||
}
|
||||
|
||||
return APR_SUCCESS;
|
||||
}
|
264
file_io/unix/pipe.c
Normal file
264
file_io/unix/pipe.c
Normal file
@ -0,0 +1,264 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "apr_arch_file_io.h"
|
||||
#include "apr_strings.h"
|
||||
#include "apr_portable.h"
|
||||
|
||||
#include "apr_arch_inherit.h"
|
||||
|
||||
/* Figure out how to get pipe block/nonblock on BeOS...
|
||||
* Basically, BONE7 changed things again so that ioctl didn't work,
|
||||
* but now fcntl does, hence we need to do this extra checking.
|
||||
* The joys of beta programs. :-)
|
||||
*/
|
||||
#if BEOS
|
||||
#if !BONE7
|
||||
# define BEOS_BLOCKING 1
|
||||
#else
|
||||
# define BEOS_BLOCKING 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static apr_status_t pipeblock(apr_file_t *thepipe)
|
||||
{
|
||||
#if !BEOS_BLOCKING
|
||||
int fd_flags;
|
||||
|
||||
fd_flags = fcntl(thepipe->filedes, F_GETFL, 0);
|
||||
# if defined(O_NONBLOCK)
|
||||
fd_flags &= ~O_NONBLOCK;
|
||||
# elif defined(O_NDELAY)
|
||||
fd_flags &= ~O_NDELAY;
|
||||
# elif defined(O_FNDELAY)
|
||||
fd_flags &= ~O_FNDELAY;
|
||||
# else
|
||||
/* XXXX: this breaks things, but an alternative isn't obvious...*/
|
||||
return APR_ENOTIMPL;
|
||||
# endif
|
||||
if (fcntl(thepipe->filedes, F_SETFL, fd_flags) == -1) {
|
||||
return errno;
|
||||
}
|
||||
#else /* BEOS_BLOCKING */
|
||||
|
||||
# if BEOS_BONE /* This only works on BONE 0-6 */
|
||||
int on = 0;
|
||||
if (ioctl(thepipe->filedes, FIONBIO, &on, sizeof(on)) < 0) {
|
||||
return errno;
|
||||
}
|
||||
# else /* "classic" BeOS doesn't support this at all */
|
||||
return APR_ENOTIMPL;
|
||||
# endif
|
||||
|
||||
#endif /* !BEOS_BLOCKING */
|
||||
|
||||
thepipe->blocking = BLK_ON;
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
static apr_status_t pipenonblock(apr_file_t *thepipe)
|
||||
{
|
||||
#if !BEOS_BLOCKING
|
||||
int fd_flags = fcntl(thepipe->filedes, F_GETFL, 0);
|
||||
|
||||
# if defined(O_NONBLOCK)
|
||||
fd_flags |= O_NONBLOCK;
|
||||
# elif defined(O_NDELAY)
|
||||
fd_flags |= O_NDELAY;
|
||||
# elif defined(O_FNDELAY)
|
||||
fd_flags |= O_FNDELAY;
|
||||
# else
|
||||
/* XXXX: this breaks things, but an alternative isn't obvious...*/
|
||||
return APR_ENOTIMPL;
|
||||
# endif
|
||||
if (fcntl(thepipe->filedes, F_SETFL, fd_flags) == -1) {
|
||||
return errno;
|
||||
}
|
||||
|
||||
#else /* BEOS_BLOCKING */
|
||||
|
||||
# if BEOS_BONE /* This only works on BONE 0-6 */
|
||||
int on = 1;
|
||||
if (ioctl(thepipe->filedes, FIONBIO, &on, sizeof(on)) < 0) {
|
||||
return errno;
|
||||
}
|
||||
# else /* "classic" BeOS doesn't support this at all */
|
||||
return APR_ENOTIMPL;
|
||||
# endif
|
||||
|
||||
#endif /* !BEOS_BLOCKING */
|
||||
|
||||
thepipe->blocking = BLK_OFF;
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_pipe_timeout_set(apr_file_t *thepipe, apr_interval_time_t timeout)
|
||||
{
|
||||
if (thepipe->is_pipe == 1) {
|
||||
thepipe->timeout = timeout;
|
||||
if (timeout >= 0) {
|
||||
if (thepipe->blocking != BLK_OFF) { /* blocking or unknown state */
|
||||
return pipenonblock(thepipe);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (thepipe->blocking != BLK_ON) { /* non-blocking or unknown state */
|
||||
return pipeblock(thepipe);
|
||||
}
|
||||
}
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
return APR_EINVAL;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_pipe_timeout_get(apr_file_t *thepipe, apr_interval_time_t *timeout)
|
||||
{
|
||||
if (thepipe->is_pipe == 1) {
|
||||
*timeout = thepipe->timeout;
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
return APR_EINVAL;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file,
|
||||
apr_os_file_t *thefile,
|
||||
int register_cleanup,
|
||||
apr_pool_t *pool)
|
||||
{
|
||||
int *dafile = thefile;
|
||||
|
||||
(*file) = apr_pcalloc(pool, sizeof(apr_file_t));
|
||||
(*file)->pool = pool;
|
||||
(*file)->eof_hit = 0;
|
||||
(*file)->is_pipe = 1;
|
||||
(*file)->blocking = BLK_UNKNOWN; /* app needs to make a timeout call */
|
||||
(*file)->timeout = -1;
|
||||
(*file)->ungetchar = -1; /* no char avail */
|
||||
(*file)->filedes = *dafile;
|
||||
if (!register_cleanup) {
|
||||
(*file)->flags = APR_FOPEN_NOCLEANUP;
|
||||
}
|
||||
(*file)->buffered = 0;
|
||||
#if APR_HAS_THREADS
|
||||
(*file)->thlock = NULL;
|
||||
#endif
|
||||
if (register_cleanup) {
|
||||
apr_pool_cleanup_register((*file)->pool, (void *)(*file),
|
||||
apr_unix_file_cleanup,
|
||||
apr_pool_cleanup_null);
|
||||
}
|
||||
#ifndef WAITIO_USES_POLL
|
||||
/* Start out with no pollset. apr_wait_for_io_or_timeout() will
|
||||
* initialize the pollset if needed.
|
||||
*/
|
||||
(*file)->pollset = NULL;
|
||||
#endif
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file,
|
||||
apr_os_file_t *thefile,
|
||||
apr_pool_t *pool)
|
||||
{
|
||||
return apr_os_pipe_put_ex(file, thefile, 0, pool);
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out, apr_pool_t *pool)
|
||||
{
|
||||
int filedes[2];
|
||||
|
||||
if (pipe(filedes) == -1) {
|
||||
return errno;
|
||||
}
|
||||
|
||||
(*in) = (apr_file_t *)apr_pcalloc(pool, sizeof(apr_file_t));
|
||||
(*in)->pool = pool;
|
||||
(*in)->filedes = filedes[0];
|
||||
(*in)->is_pipe = 1;
|
||||
(*in)->fname = NULL;
|
||||
(*in)->buffered = 0;
|
||||
(*in)->blocking = BLK_ON;
|
||||
(*in)->timeout = -1;
|
||||
(*in)->ungetchar = -1;
|
||||
(*in)->flags = APR_INHERIT;
|
||||
#if APR_HAS_THREADS
|
||||
(*in)->thlock = NULL;
|
||||
#endif
|
||||
#ifndef WAITIO_USES_POLL
|
||||
(*in)->pollset = NULL;
|
||||
#endif
|
||||
(*out) = (apr_file_t *)apr_pcalloc(pool, sizeof(apr_file_t));
|
||||
(*out)->pool = pool;
|
||||
(*out)->filedes = filedes[1];
|
||||
(*out)->is_pipe = 1;
|
||||
(*out)->fname = NULL;
|
||||
(*out)->buffered = 0;
|
||||
(*out)->blocking = BLK_ON;
|
||||
(*out)->flags = APR_INHERIT;
|
||||
(*out)->timeout = -1;
|
||||
#if APR_HAS_THREADS
|
||||
(*out)->thlock = NULL;
|
||||
#endif
|
||||
#ifndef WAITIO_USES_POLL
|
||||
(*out)->pollset = NULL;
|
||||
#endif
|
||||
apr_pool_cleanup_register((*in)->pool, (void *)(*in), apr_unix_file_cleanup,
|
||||
apr_pool_cleanup_null);
|
||||
apr_pool_cleanup_register((*out)->pool, (void *)(*out), apr_unix_file_cleanup,
|
||||
apr_pool_cleanup_null);
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_pipe_create_ex(apr_file_t **in,
|
||||
apr_file_t **out,
|
||||
apr_int32_t blocking,
|
||||
apr_pool_t *pool)
|
||||
{
|
||||
apr_status_t status;
|
||||
|
||||
if ((status = apr_file_pipe_create(in, out, pool)) != APR_SUCCESS)
|
||||
return status;
|
||||
|
||||
switch (blocking) {
|
||||
case APR_FULL_BLOCK:
|
||||
break;
|
||||
case APR_READ_BLOCK:
|
||||
apr_file_pipe_timeout_set(*out, 0);
|
||||
break;
|
||||
case APR_WRITE_BLOCK:
|
||||
apr_file_pipe_timeout_set(*in, 0);
|
||||
break;
|
||||
default:
|
||||
apr_file_pipe_timeout_set(*out, 0);
|
||||
apr_file_pipe_timeout_set(*in, 0);
|
||||
}
|
||||
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_namedpipe_create(const char *filename,
|
||||
apr_fileperms_t perm, apr_pool_t *pool)
|
||||
{
|
||||
mode_t mode = apr_unix_perms2mode(perm);
|
||||
|
||||
if (mkfifo(filename, mode) == -1) {
|
||||
return errno;
|
||||
}
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
526
file_io/unix/readwrite.c
Normal file
526
file_io/unix/readwrite.c
Normal file
@ -0,0 +1,526 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "apr_arch_file_io.h"
|
||||
#include "apr_strings.h"
|
||||
#include "apr_thread_mutex.h"
|
||||
#include "apr_support.h"
|
||||
|
||||
/* The only case where we don't use wait_for_io_or_timeout is on
|
||||
* pre-BONE BeOS, so this check should be sufficient and simpler */
|
||||
#if !BEOS_R5
|
||||
#define USE_WAIT_FOR_IO
|
||||
#endif
|
||||
|
||||
static apr_status_t file_read_buffered(apr_file_t *thefile, void *buf,
|
||||
apr_size_t *nbytes)
|
||||
{
|
||||
apr_ssize_t rv;
|
||||
char *pos = (char *)buf;
|
||||
apr_uint64_t blocksize;
|
||||
apr_uint64_t size = *nbytes;
|
||||
|
||||
if (thefile->direction == 1) {
|
||||
rv = apr_file_flush_locked(thefile);
|
||||
if (rv) {
|
||||
return rv;
|
||||
}
|
||||
thefile->bufpos = 0;
|
||||
thefile->direction = 0;
|
||||
thefile->dataRead = 0;
|
||||
}
|
||||
|
||||
rv = 0;
|
||||
if (thefile->ungetchar != -1) {
|
||||
*pos = (char)thefile->ungetchar;
|
||||
++pos;
|
||||
--size;
|
||||
thefile->ungetchar = -1;
|
||||
}
|
||||
while (rv == 0 && size > 0) {
|
||||
if (thefile->bufpos >= thefile->dataRead) {
|
||||
int bytesread = read(thefile->filedes, thefile->buffer,
|
||||
thefile->bufsize);
|
||||
if (bytesread == 0) {
|
||||
thefile->eof_hit = TRUE;
|
||||
rv = APR_EOF;
|
||||
break;
|
||||
}
|
||||
else if (bytesread == -1) {
|
||||
rv = errno;
|
||||
break;
|
||||
}
|
||||
thefile->dataRead = bytesread;
|
||||
thefile->filePtr += thefile->dataRead;
|
||||
thefile->bufpos = 0;
|
||||
}
|
||||
|
||||
blocksize = size > thefile->dataRead - thefile->bufpos ? thefile->dataRead - thefile->bufpos : size;
|
||||
memcpy(pos, thefile->buffer + thefile->bufpos, blocksize);
|
||||
thefile->bufpos += blocksize;
|
||||
pos += blocksize;
|
||||
size -= blocksize;
|
||||
}
|
||||
|
||||
*nbytes = pos - (char *)buf;
|
||||
if (*nbytes) {
|
||||
rv = 0;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf, apr_size_t *nbytes)
|
||||
{
|
||||
apr_ssize_t rv;
|
||||
apr_size_t bytes_read;
|
||||
|
||||
if (*nbytes <= 0) {
|
||||
*nbytes = 0;
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
if (thefile->buffered) {
|
||||
file_lock(thefile);
|
||||
rv = file_read_buffered(thefile, buf, nbytes);
|
||||
file_unlock(thefile);
|
||||
return rv;
|
||||
}
|
||||
else {
|
||||
bytes_read = 0;
|
||||
if (thefile->ungetchar != -1) {
|
||||
bytes_read = 1;
|
||||
*(char *)buf = (char)thefile->ungetchar;
|
||||
buf = (char *)buf + 1;
|
||||
(*nbytes)--;
|
||||
thefile->ungetchar = -1;
|
||||
if (*nbytes == 0) {
|
||||
*nbytes = bytes_read;
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
rv = read(thefile->filedes, buf, *nbytes);
|
||||
} while (rv == -1 && errno == EINTR);
|
||||
#ifdef USE_WAIT_FOR_IO
|
||||
if (rv == -1 &&
|
||||
(errno == EAGAIN || errno == EWOULDBLOCK) &&
|
||||
thefile->timeout != 0) {
|
||||
apr_status_t arv = apr_wait_for_io_or_timeout(thefile, NULL, 1);
|
||||
if (arv != APR_SUCCESS) {
|
||||
*nbytes = bytes_read;
|
||||
return arv;
|
||||
}
|
||||
else {
|
||||
do {
|
||||
rv = read(thefile->filedes, buf, *nbytes);
|
||||
} while (rv == -1 && errno == EINTR);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
*nbytes = bytes_read;
|
||||
if (rv == 0) {
|
||||
thefile->eof_hit = TRUE;
|
||||
return APR_EOF;
|
||||
}
|
||||
if (rv > 0) {
|
||||
*nbytes += rv;
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
return errno;
|
||||
}
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, apr_size_t *nbytes)
|
||||
{
|
||||
apr_size_t rv;
|
||||
|
||||
if (thefile->buffered) {
|
||||
char *pos = (char *)buf;
|
||||
int blocksize;
|
||||
int size = *nbytes;
|
||||
|
||||
file_lock(thefile);
|
||||
|
||||
if ( thefile->direction == 0 ) {
|
||||
/* Position file pointer for writing at the offset we are
|
||||
* logically reading from
|
||||
*/
|
||||
apr_int64_t offset = thefile->filePtr - thefile->dataRead + thefile->bufpos;
|
||||
if (offset != thefile->filePtr)
|
||||
lseek(thefile->filedes, offset, SEEK_SET);
|
||||
thefile->bufpos = thefile->dataRead = 0;
|
||||
thefile->direction = 1;
|
||||
}
|
||||
|
||||
rv = 0;
|
||||
while (rv == 0 && size > 0) {
|
||||
if (thefile->bufpos == thefile->bufsize) /* write buffer is full*/
|
||||
rv = apr_file_flush_locked(thefile);
|
||||
|
||||
blocksize = size > thefile->bufsize - thefile->bufpos ?
|
||||
thefile->bufsize - thefile->bufpos : size;
|
||||
memcpy(thefile->buffer + thefile->bufpos, pos, blocksize);
|
||||
thefile->bufpos += blocksize;
|
||||
pos += blocksize;
|
||||
size -= blocksize;
|
||||
}
|
||||
|
||||
file_unlock(thefile);
|
||||
|
||||
return rv;
|
||||
}
|
||||
else {
|
||||
do {
|
||||
rv = write(thefile->filedes, buf, *nbytes);
|
||||
} while (rv == (apr_size_t)-1 && errno == EINTR);
|
||||
#ifdef USE_WAIT_FOR_IO
|
||||
if (rv == (apr_size_t)-1 &&
|
||||
(errno == EAGAIN || errno == EWOULDBLOCK) &&
|
||||
thefile->timeout != 0) {
|
||||
apr_status_t arv = apr_wait_for_io_or_timeout(thefile, NULL, 0);
|
||||
if (arv != APR_SUCCESS) {
|
||||
*nbytes = 0;
|
||||
return arv;
|
||||
}
|
||||
else {
|
||||
do {
|
||||
do {
|
||||
rv = write(thefile->filedes, buf, *nbytes);
|
||||
} while (rv == (apr_size_t)-1 && errno == EINTR);
|
||||
if (rv == (apr_size_t)-1 &&
|
||||
(errno == EAGAIN || errno == EWOULDBLOCK)) {
|
||||
*nbytes /= 2; /* yes, we'll loop if kernel lied
|
||||
* and we can't even write 1 byte
|
||||
*/
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
} while (1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (rv == (apr_size_t)-1) {
|
||||
(*nbytes) = 0;
|
||||
return errno;
|
||||
}
|
||||
*nbytes = rv;
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_writev(apr_file_t *thefile, const struct iovec *vec,
|
||||
apr_size_t nvec, apr_size_t *nbytes)
|
||||
{
|
||||
#ifdef HAVE_WRITEV
|
||||
apr_status_t rv;
|
||||
apr_ssize_t bytes;
|
||||
|
||||
if (thefile->buffered) {
|
||||
file_lock(thefile);
|
||||
|
||||
rv = apr_file_flush_locked(thefile);
|
||||
if (rv != APR_SUCCESS) {
|
||||
file_unlock(thefile);
|
||||
return rv;
|
||||
}
|
||||
if (thefile->direction == 0) {
|
||||
/* Position file pointer for writing at the offset we are
|
||||
* logically reading from
|
||||
*/
|
||||
apr_int64_t offset = thefile->filePtr - thefile->dataRead +
|
||||
thefile->bufpos;
|
||||
if (offset != thefile->filePtr)
|
||||
lseek(thefile->filedes, offset, SEEK_SET);
|
||||
thefile->bufpos = thefile->dataRead = 0;
|
||||
}
|
||||
|
||||
file_unlock(thefile);
|
||||
}
|
||||
|
||||
if ((bytes = writev(thefile->filedes, vec, nvec)) < 0) {
|
||||
*nbytes = 0;
|
||||
rv = errno;
|
||||
}
|
||||
else {
|
||||
*nbytes = bytes;
|
||||
rv = APR_SUCCESS;
|
||||
}
|
||||
return rv;
|
||||
#else
|
||||
/**
|
||||
* The problem with trying to output the entire iovec is that we cannot
|
||||
* maintain the behaviour that a real writev would have. If we iterate
|
||||
* over the iovec one at a time, we lose the atomic properties of
|
||||
* writev(). The other option is to combine the entire iovec into one
|
||||
* buffer that we could then send in one call to write(). This is not
|
||||
* reasonable since we do not know how much data an iovec could contain.
|
||||
*
|
||||
* The only reasonable option, that maintains the semantics of a real
|
||||
* writev(), is to only write the first iovec. Callers of file_writev()
|
||||
* must deal with partial writes as they normally would. If you want to
|
||||
* ensure an entire iovec is written, use apr_file_writev_full().
|
||||
*/
|
||||
|
||||
*nbytes = vec[0].iov_len;
|
||||
return apr_file_write(thefile, vec[0].iov_base, nbytes);
|
||||
#endif
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_putc(char ch, apr_file_t *thefile)
|
||||
{
|
||||
apr_size_t nbytes = 1;
|
||||
|
||||
return apr_file_write(thefile, &ch, &nbytes);
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_ungetc(char ch, apr_file_t *thefile)
|
||||
{
|
||||
thefile->ungetchar = (unsigned char)ch;
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_getc(char *ch, apr_file_t *thefile)
|
||||
{
|
||||
apr_size_t nbytes = 1;
|
||||
|
||||
return apr_file_read(thefile, ch, &nbytes);
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_puts(const char *str, apr_file_t *thefile)
|
||||
{
|
||||
return apr_file_write_full(thefile, str, strlen(str), NULL);
|
||||
}
|
||||
|
||||
apr_status_t apr_file_flush_locked(apr_file_t *thefile)
|
||||
{
|
||||
apr_status_t rv = APR_SUCCESS;
|
||||
|
||||
if (thefile->direction == 1 && thefile->bufpos) {
|
||||
apr_ssize_t written = 0, ret;
|
||||
|
||||
do {
|
||||
ret = write(thefile->filedes, thefile->buffer + written,
|
||||
thefile->bufpos - written);
|
||||
if (ret > 0)
|
||||
written += ret;
|
||||
} while (written < thefile->bufpos &&
|
||||
(ret > 0 || (ret == -1 && errno == EINTR)));
|
||||
if (ret == -1) {
|
||||
rv = errno;
|
||||
} else {
|
||||
thefile->filePtr += written;
|
||||
thefile->bufpos = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_flush(apr_file_t *thefile)
|
||||
{
|
||||
apr_status_t rv = APR_SUCCESS;
|
||||
|
||||
if (thefile->buffered) {
|
||||
file_lock(thefile);
|
||||
rv = apr_file_flush_locked(thefile);
|
||||
file_unlock(thefile);
|
||||
}
|
||||
/* There isn't anything to do if we aren't buffering the output
|
||||
* so just return success.
|
||||
*/
|
||||
return rv;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_sync(apr_file_t *thefile)
|
||||
{
|
||||
apr_status_t rv = APR_SUCCESS;
|
||||
|
||||
file_lock(thefile);
|
||||
|
||||
if (thefile->buffered) {
|
||||
rv = apr_file_flush_locked(thefile);
|
||||
|
||||
if (rv != APR_SUCCESS) {
|
||||
file_unlock(thefile);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
if (fsync(thefile->filedes)) {
|
||||
rv = apr_get_os_error();
|
||||
}
|
||||
|
||||
file_unlock(thefile);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_datasync(apr_file_t *thefile)
|
||||
{
|
||||
apr_status_t rv = APR_SUCCESS;
|
||||
|
||||
file_lock(thefile);
|
||||
|
||||
if (thefile->buffered) {
|
||||
rv = apr_file_flush_locked(thefile);
|
||||
|
||||
if (rv != APR_SUCCESS) {
|
||||
file_unlock(thefile);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_FDATASYNC
|
||||
if (fdatasync(thefile->filedes)) {
|
||||
#else
|
||||
if (fsync(thefile->filedes)) {
|
||||
#endif
|
||||
rv = apr_get_os_error();
|
||||
}
|
||||
|
||||
file_unlock(thefile);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_gets(char *str, int len, apr_file_t *thefile)
|
||||
{
|
||||
apr_status_t rv = APR_SUCCESS; /* get rid of gcc warning */
|
||||
apr_size_t nbytes;
|
||||
const char *str_start = str;
|
||||
char *final = str + len - 1;
|
||||
|
||||
if (len <= 1) {
|
||||
/* sort of like fgets(), which returns NULL and stores no bytes
|
||||
*/
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
|
||||
/* If we have an underlying buffer, we can be *much* more efficient
|
||||
* and skip over the apr_file_read calls.
|
||||
*/
|
||||
if (thefile->buffered) {
|
||||
file_lock(thefile);
|
||||
|
||||
if (thefile->direction == 1) {
|
||||
rv = apr_file_flush_locked(thefile);
|
||||
if (rv) {
|
||||
file_unlock(thefile);
|
||||
return rv;
|
||||
}
|
||||
|
||||
thefile->direction = 0;
|
||||
thefile->bufpos = 0;
|
||||
thefile->dataRead = 0;
|
||||
}
|
||||
|
||||
while (str < final) { /* leave room for trailing '\0' */
|
||||
/* Force ungetc leftover to call apr_file_read. */
|
||||
if (thefile->bufpos < thefile->dataRead &&
|
||||
thefile->ungetchar == -1) {
|
||||
*str = thefile->buffer[thefile->bufpos++];
|
||||
}
|
||||
else {
|
||||
nbytes = 1;
|
||||
rv = file_read_buffered(thefile, str, &nbytes);
|
||||
if (rv != APR_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (*str == '\n') {
|
||||
++str;
|
||||
break;
|
||||
}
|
||||
++str;
|
||||
}
|
||||
file_unlock(thefile);
|
||||
}
|
||||
else {
|
||||
while (str < final) { /* leave room for trailing '\0' */
|
||||
nbytes = 1;
|
||||
rv = apr_file_read(thefile, str, &nbytes);
|
||||
if (rv != APR_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
if (*str == '\n') {
|
||||
++str;
|
||||
break;
|
||||
}
|
||||
++str;
|
||||
}
|
||||
}
|
||||
|
||||
/* We must store a terminating '\0' if we've stored any chars. We can
|
||||
* get away with storing it if we hit an error first.
|
||||
*/
|
||||
*str = '\0';
|
||||
if (str > str_start) {
|
||||
/* we stored chars; don't report EOF or any other errors;
|
||||
* the app will find out about that on the next call
|
||||
*/
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
struct apr_file_printf_data {
|
||||
apr_vformatter_buff_t vbuff;
|
||||
apr_file_t *fptr;
|
||||
char *buf;
|
||||
};
|
||||
|
||||
static int file_printf_flush(apr_vformatter_buff_t *buff)
|
||||
{
|
||||
struct apr_file_printf_data *data = (struct apr_file_printf_data *)buff;
|
||||
|
||||
if (apr_file_write_full(data->fptr, data->buf,
|
||||
data->vbuff.curpos - data->buf, NULL)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
data->vbuff.curpos = data->buf;
|
||||
return 0;
|
||||
}
|
||||
|
||||
APR_DECLARE_NONSTD(int) apr_file_printf(apr_file_t *fptr,
|
||||
const char *format, ...)
|
||||
{
|
||||
struct apr_file_printf_data data;
|
||||
va_list ap;
|
||||
int count;
|
||||
|
||||
/* don't really need a HUGE_STRING_LEN anymore */
|
||||
data.buf = malloc(HUGE_STRING_LEN);
|
||||
if (data.buf == NULL) {
|
||||
return -1;
|
||||
}
|
||||
data.vbuff.curpos = data.buf;
|
||||
data.vbuff.endpos = data.buf + HUGE_STRING_LEN;
|
||||
data.fptr = fptr;
|
||||
va_start(ap, format);
|
||||
count = apr_vformatter(file_printf_flush,
|
||||
(apr_vformatter_buff_t *)&data, format, ap);
|
||||
/* apr_vformatter does not call flush for the last bits */
|
||||
if (count >= 0) file_printf_flush((apr_vformatter_buff_t *)&data);
|
||||
|
||||
va_end(ap);
|
||||
|
||||
free(data.buf);
|
||||
|
||||
return count;
|
||||
}
|
129
file_io/unix/seek.c
Normal file
129
file_io/unix/seek.c
Normal file
@ -0,0 +1,129 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "apr_arch_file_io.h"
|
||||
|
||||
static apr_status_t setptr(apr_file_t *thefile, apr_off_t pos )
|
||||
{
|
||||
apr_off_t newbufpos;
|
||||
apr_status_t rv;
|
||||
|
||||
if (thefile->direction == 1) {
|
||||
rv = apr_file_flush_locked(thefile);
|
||||
if (rv) {
|
||||
return rv;
|
||||
}
|
||||
thefile->bufpos = thefile->direction = thefile->dataRead = 0;
|
||||
}
|
||||
|
||||
newbufpos = pos - (thefile->filePtr - thefile->dataRead);
|
||||
if (newbufpos >= 0 && newbufpos <= thefile->dataRead) {
|
||||
thefile->bufpos = newbufpos;
|
||||
rv = APR_SUCCESS;
|
||||
}
|
||||
else {
|
||||
if (lseek(thefile->filedes, pos, SEEK_SET) != -1) {
|
||||
thefile->bufpos = thefile->dataRead = 0;
|
||||
thefile->filePtr = pos;
|
||||
rv = APR_SUCCESS;
|
||||
}
|
||||
else {
|
||||
rv = errno;
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_file_seek(apr_file_t *thefile, apr_seek_where_t where, apr_off_t *offset)
|
||||
{
|
||||
apr_off_t rv;
|
||||
|
||||
thefile->eof_hit = 0;
|
||||
|
||||
if (thefile->buffered) {
|
||||
int rc = EINVAL;
|
||||
apr_finfo_t finfo;
|
||||
|
||||
file_lock(thefile);
|
||||
|
||||
switch (where) {
|
||||
case APR_SET:
|
||||
rc = setptr(thefile, *offset);
|
||||
break;
|
||||
|
||||
case APR_CUR:
|
||||
rc = setptr(thefile, thefile->filePtr - thefile->dataRead + thefile->bufpos + *offset);
|
||||
break;
|
||||
|
||||
case APR_END:
|
||||
rc = apr_file_info_get_locked(&finfo, APR_FINFO_SIZE, thefile);
|
||||
if (rc == APR_SUCCESS)
|
||||
rc = setptr(thefile, finfo.size + *offset);
|
||||
break;
|
||||
}
|
||||
|
||||
*offset = thefile->filePtr - thefile->dataRead + thefile->bufpos;
|
||||
|
||||
file_unlock(thefile);
|
||||
|
||||
return rc;
|
||||
}
|
||||
else {
|
||||
rv = lseek(thefile->filedes, *offset, where);
|
||||
if (rv == -1) {
|
||||
*offset = -1;
|
||||
return errno;
|
||||
}
|
||||
else {
|
||||
*offset = rv;
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
apr_status_t apr_file_trunc(apr_file_t *fp, apr_off_t offset)
|
||||
{
|
||||
if (fp->buffered) {
|
||||
int rc = 0;
|
||||
file_lock(fp);
|
||||
if (fp->direction == 1 && fp->bufpos != 0) {
|
||||
apr_off_t len = fp->filePtr + fp->bufpos;
|
||||
if (offset < len) {
|
||||
/* New file end fall below our write buffer limit.
|
||||
* Figure out if and what needs to be flushed.
|
||||
*/
|
||||
apr_off_t off = len - offset;
|
||||
if (off >= 0 && off <= fp->bufpos)
|
||||
fp->bufpos = fp->bufpos - (size_t)off;
|
||||
else
|
||||
fp->bufpos = 0;
|
||||
}
|
||||
rc = apr_file_flush_locked(fp);
|
||||
/* Reset buffer positions for write mode */
|
||||
fp->bufpos = fp->direction = fp->dataRead = 0;
|
||||
}
|
||||
if (rc) {
|
||||
return rc;
|
||||
}
|
||||
file_unlock(fp);
|
||||
}
|
||||
if (ftruncate(fp->filedes, offset) == -1) {
|
||||
return errno;
|
||||
}
|
||||
return apr_file_seek(fp, APR_SET, &offset);
|
||||
}
|
129
file_io/unix/tempdir.c
Normal file
129
file_io/unix/tempdir.c
Normal file
@ -0,0 +1,129 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "apr_private.h"
|
||||
#include "apr_file_io.h"
|
||||
#include "apr_strings.h"
|
||||
#include "apr_env.h"
|
||||
|
||||
|
||||
/* Try to open a temporary file in the temporary dir, write to it,
|
||||
and then close it. */
|
||||
static int test_tempdir(const char *temp_dir, apr_pool_t *p)
|
||||
{
|
||||
apr_file_t *dummy_file;
|
||||
char *path = apr_pstrcat(p, temp_dir, "/apr-tmp.XXXXXX", NULL);
|
||||
|
||||
if (apr_file_mktemp(&dummy_file, path, 0, p) == APR_SUCCESS) {
|
||||
if (apr_file_putc('!', dummy_file) == APR_SUCCESS) {
|
||||
if (apr_file_close(dummy_file) == APR_SUCCESS) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_temp_dir_get(const char **temp_dir,
|
||||
apr_pool_t *p)
|
||||
{
|
||||
apr_status_t apr_err;
|
||||
const char *try_dirs[] = { "/tmp", "/usr/tmp", "/var/tmp" };
|
||||
const char *try_envs[] = { "TMPDIR", "TMP", "TEMP"};
|
||||
const char *dir;
|
||||
char *cwd;
|
||||
int i;
|
||||
|
||||
/* Our goal is to find a temporary directory suitable for writing
|
||||
into.
|
||||
Here's the order in which we'll try various paths:
|
||||
|
||||
$TMPDIR
|
||||
$TMP
|
||||
$TEMP
|
||||
"C:\TEMP" (windows only)
|
||||
"SYS:\TMP" (netware only)
|
||||
"/tmp"
|
||||
"/var/tmp"
|
||||
"/usr/tmp"
|
||||
P_tmpdir (POSIX define)
|
||||
`pwd`
|
||||
|
||||
NOTE: This algorithm is basically the same one used by Python
|
||||
2.2's tempfile.py module. */
|
||||
|
||||
/* Try the environment first. */
|
||||
for (i = 0; i < (sizeof(try_envs) / sizeof(const char *)); i++) {
|
||||
char *value;
|
||||
apr_err = apr_env_get(&value, try_envs[i], p);
|
||||
if ((apr_err == APR_SUCCESS) && value) {
|
||||
apr_size_t len = strlen(value);
|
||||
if (len && (len < APR_PATH_MAX) && test_tempdir(value, p)) {
|
||||
dir = value;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
/* Next, on Win32, try the C:\TEMP directory. */
|
||||
if (test_tempdir("C:\\TEMP", p)) {
|
||||
dir = "C:\\TEMP";
|
||||
goto end;
|
||||
}
|
||||
#endif
|
||||
#ifdef NETWARE
|
||||
/* Next, on NetWare, try the SYS:/TMP directory. */
|
||||
if (test_tempdir("SYS:/TMP", p)) {
|
||||
dir = "SYS:/TMP";
|
||||
goto end;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Next, try a set of hard-coded paths. */
|
||||
for (i = 0; i < (sizeof(try_dirs) / sizeof(const char *)); i++) {
|
||||
if (test_tempdir(try_dirs[i], p)) {
|
||||
dir = try_dirs[i];
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef P_tmpdir
|
||||
/*
|
||||
* If we have it, use the POSIX definition of where
|
||||
* the tmpdir should be
|
||||
*/
|
||||
if (test_tempdir(P_tmpdir, p)) {
|
||||
dir = P_tmpdir;
|
||||
goto end;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Finally, try the current working directory. */
|
||||
if (APR_SUCCESS == apr_filepath_get(&cwd, APR_FILEPATH_NATIVE, p)) {
|
||||
if (test_tempdir(cwd, p)) {
|
||||
dir = cwd;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
/* We didn't find a suitable temp dir anywhere */
|
||||
return APR_EGENERAL;
|
||||
|
||||
end:
|
||||
*temp_dir = apr_pstrdup(p, dir);
|
||||
return APR_SUCCESS;
|
||||
}
|
106
helpers/apr_rename.pl
Executable file
106
helpers/apr_rename.pl
Executable file
@ -0,0 +1,106 @@
|
||||
#!/usr/bin/perl -w
|
||||
use strict;
|
||||
use ExtUtils::MakeMaker qw(prompt);
|
||||
use File::Find;
|
||||
|
||||
my $just_check = @ARGV ? $ARGV[0] eq '-c' : 0;
|
||||
shift if $just_check;
|
||||
my $dir = shift || '.';
|
||||
my %names;
|
||||
|
||||
my $prefix = 'apr_';
|
||||
|
||||
while (<DATA>) {
|
||||
chomp;
|
||||
my($old, $new) = grep { s/^$prefix//o } split;
|
||||
next unless $old and $new;
|
||||
$names{$old} = $new;
|
||||
}
|
||||
|
||||
my $pattern = join '|', keys %names;
|
||||
#print "replacement pattern=$pattern\n";
|
||||
|
||||
find sub {
|
||||
chomp;
|
||||
return unless /\.[ch]$/;
|
||||
my $file = "$File::Find::dir/$_";
|
||||
print "looking in $file\n";
|
||||
|
||||
replace($_, !$just_check);
|
||||
|
||||
}, $dir;
|
||||
|
||||
sub replace {
|
||||
my($file, $replace) = @_;
|
||||
local *IN, *OUT;
|
||||
my @lines;
|
||||
my $found = 0;
|
||||
|
||||
open IN, $file or die "open $file: $!";
|
||||
|
||||
while (<IN>) {
|
||||
for (m/[^_\"]*$prefix($pattern)\b/og) {
|
||||
$found++;
|
||||
print " $file:$. apr_$_ -> apr_$names{$_}\n";
|
||||
}
|
||||
push @lines, $_ if $replace;
|
||||
}
|
||||
|
||||
close IN;
|
||||
|
||||
return unless $found and $replace;
|
||||
|
||||
# my $ans = prompt("replace?", 'y');
|
||||
# return unless $ans =~ /^y/i;
|
||||
|
||||
open OUT, ">$file" or die "open $file: $!";
|
||||
|
||||
for (@lines) {
|
||||
unless (/^\#include/) {
|
||||
s/([^_\"]*$prefix)($pattern)\b/$1$names{$2}/og;
|
||||
}
|
||||
print OUT $_;
|
||||
}
|
||||
|
||||
close OUT;
|
||||
}
|
||||
|
||||
__DATA__
|
||||
apr_time_t:
|
||||
apr_implode_gmt apr_time_exp_gmt_get
|
||||
|
||||
apr_socket_t:
|
||||
apr_close_socket apr_socket_close
|
||||
apr_create_socket apr_socket_create
|
||||
apr_get_sockaddr apr_socket_addr_get
|
||||
apr_get_socketdata apr_socket_data_get
|
||||
apr_set_socketdata apr_socket_data_set
|
||||
apr_shutdown apr_socket_shutdown
|
||||
apr_bind apr_socket_bind
|
||||
apr_listen apr_socket_listen
|
||||
apr_accept apr_socket_accept
|
||||
apr_connect apr_socket_connect
|
||||
apr_send apr_socket_send
|
||||
apr_sendv apr_socket_sendv
|
||||
apr_sendto apr_socket_sendto
|
||||
apr_recvfrom apr_socket_recvfrom
|
||||
apr_sendfile apr_socket_sendfile
|
||||
apr_recv apr_socket_recv
|
||||
|
||||
apr_filepath_*:
|
||||
apr_filename_of_pathname apr_filepath_name_get
|
||||
|
||||
apr_gid_t:
|
||||
apr_get_groupid apr_gid_get
|
||||
apr_get_groupname apr_gid_name_get
|
||||
apr_group_name_get apr_gid_name_get
|
||||
apr_compare_groups apr_gid_compare
|
||||
|
||||
apr_uid_t:
|
||||
apr_get_home_directory apr_uid_homepath_get
|
||||
apr_get_userid apr_uid_get
|
||||
apr_current_userid apr_uid_current
|
||||
apr_compare_users apr_uid_compare
|
||||
apr_get_username apr_uid_name_get
|
||||
apr_compare_users apr_uid_compare
|
||||
|
621
include/apr.h.in
Normal file
621
include/apr.h.in
Normal file
@ -0,0 +1,621 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef APR_H
|
||||
#define APR_H
|
||||
|
||||
/* GENERATED FILE WARNING! DO NOT EDIT apr.h
|
||||
*
|
||||
* You must modify apr.h.in instead.
|
||||
*
|
||||
* And please, make an effort to stub apr.hw and apr.hnw in the process.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file apr.h
|
||||
* @brief APR Platform Definitions
|
||||
* @remark This is a generated header generated from include/apr.h.in by
|
||||
* ./configure, or copied from include/apr.hw or include/apr.hnw
|
||||
* for Win32 or Netware by those build environments, respectively.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup APR Apache Portability Runtime library
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @defgroup apr_platform Platform Definitions
|
||||
* @{
|
||||
* @warning
|
||||
* <strong><em>The actual values of macros and typedefs on this page<br>
|
||||
* are platform specific and should NOT be relied upon!</em></strong>
|
||||
*/
|
||||
|
||||
/* So that we can use inline on some critical functions, and use
|
||||
* GNUC attributes (such as to get -Wall warnings for printf-like
|
||||
* functions). Only do this in gcc 2.7 or later ... it may work
|
||||
* on earlier stuff, but why chance it.
|
||||
*
|
||||
* We've since discovered that the gcc shipped with NeXT systems
|
||||
* as "cc" is completely broken. It claims to be __GNUC__ and so
|
||||
* on, but it doesn't implement half of the things that __GNUC__
|
||||
* means. In particular it's missing inline and the __attribute__
|
||||
* stuff. So we hack around it. PR#1613. -djg
|
||||
*/
|
||||
#if !defined(__GNUC__) || __GNUC__ < 2 || \
|
||||
(__GNUC__ == 2 && __GNUC_MINOR__ < 7) ||\
|
||||
defined(NEXT)
|
||||
#ifndef __attribute__
|
||||
#define __attribute__(__x)
|
||||
#endif
|
||||
#define APR_INLINE
|
||||
#define APR_HAS_INLINE 0
|
||||
#else
|
||||
#define APR_INLINE __inline__
|
||||
#define APR_HAS_INLINE 1
|
||||
#endif
|
||||
|
||||
#define APR_HAVE_ARPA_INET_H @arpa_ineth@
|
||||
#define APR_HAVE_CONIO_H @conioh@
|
||||
#define APR_HAVE_CRYPT_H @crypth@
|
||||
#define APR_HAVE_CTYPE_H @ctypeh@
|
||||
#define APR_HAVE_DIRENT_H @direnth@
|
||||
#define APR_HAVE_ERRNO_H @errnoh@
|
||||
#define APR_HAVE_FCNTL_H @fcntlh@
|
||||
#define APR_HAVE_IO_H @ioh@
|
||||
#define APR_HAVE_LIMITS_H @limitsh@
|
||||
#define APR_HAVE_NETDB_H @netdbh@
|
||||
#define APR_HAVE_NETINET_IN_H @netinet_inh@
|
||||
#define APR_HAVE_NETINET_SCTP_H @netinet_sctph@
|
||||
#define APR_HAVE_NETINET_SCTP_UIO_H @netinet_sctp_uioh@
|
||||
#define APR_HAVE_NETINET_TCP_H @netinet_tcph@
|
||||
#define APR_HAVE_PROCESS_H @processh@
|
||||
#define APR_HAVE_PTHREAD_H @pthreadh@
|
||||
#define APR_HAVE_SEMAPHORE_H @semaphoreh@
|
||||
#define APR_HAVE_SIGNAL_H @signalh@
|
||||
#define APR_HAVE_STDARG_H @stdargh@
|
||||
#define APR_HAVE_STDINT_H @stdint@
|
||||
#define APR_HAVE_STDIO_H @stdioh@
|
||||
#define APR_HAVE_STDLIB_H @stdlibh@
|
||||
#define APR_HAVE_STRING_H @stringh@
|
||||
#define APR_HAVE_STRINGS_H @stringsh@
|
||||
#define APR_HAVE_SYS_IOCTL_H @sys_ioctlh@
|
||||
#define APR_HAVE_SYS_SENDFILE_H @sys_sendfileh@
|
||||
#define APR_HAVE_SYS_SIGNAL_H @sys_signalh@
|
||||
#define APR_HAVE_SYS_SOCKET_H @sys_socketh@
|
||||
#define APR_HAVE_SYS_SOCKIO_H @sys_sockioh@
|
||||
#define APR_HAVE_SYS_SYSLIMITS_H @sys_syslimitsh@
|
||||
#define APR_HAVE_SYS_TIME_H @sys_timeh@
|
||||
#define APR_HAVE_SYS_TYPES_H @sys_typesh@
|
||||
#define APR_HAVE_SYS_UIO_H @sys_uioh@
|
||||
#define APR_HAVE_SYS_UN_H @sys_unh@
|
||||
#define APR_HAVE_SYS_WAIT_H @sys_waith@
|
||||
#define APR_HAVE_TIME_H @timeh@
|
||||
#define APR_HAVE_UNISTD_H @unistdh@
|
||||
#define APR_HAVE_WINDOWS_H @windowsh@
|
||||
#define APR_HAVE_WINSOCK2_H @winsock2h@
|
||||
|
||||
/** @} */
|
||||
/** @} */
|
||||
|
||||
/* We don't include our conditional headers within the doxyblocks
|
||||
* or the extern "C" namespace
|
||||
*/
|
||||
|
||||
#if APR_HAVE_WINDOWS_H
|
||||
/* If windows.h was already included, our preferences don't matter.
|
||||
* If not, include a restricted set of windows headers to our tastes.
|
||||
*/
|
||||
#ifndef _WINDOWS_
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32_WINNT
|
||||
/* Restrict the server to a subset of Windows XP header files by default
|
||||
*/
|
||||
#define _WIN32_WINNT 0x0501
|
||||
#endif
|
||||
|
||||
#ifndef NOUSER
|
||||
#define NOUSER
|
||||
#endif
|
||||
#ifndef NOMCX
|
||||
#define NOMCX
|
||||
#endif
|
||||
#ifndef NOIME
|
||||
#define NOIME
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
/*
|
||||
* Add a _very_few_ declarations missing from the restricted set of headers
|
||||
* (If this list becomes extensive, re-enable the required headers above!)
|
||||
* winsock headers were excluded by WIN32_LEAN_AND_MEAN, so include them now
|
||||
*/
|
||||
#define SW_HIDE 0
|
||||
#ifndef _WIN32_WCE
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <mswsock.h>
|
||||
#else
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
|
||||
#endif /* ndef _WINDOWS_ */
|
||||
#endif /* APR_HAVE_WINDOWS_H */
|
||||
|
||||
#if APR_HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if APR_HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS)
|
||||
/* C99 7.18.4 requires that stdint.h only exposes INT64_C
|
||||
* and UINT64_C for C++ implementations if this is defined: */
|
||||
#define __STDC_CONSTANT_MACROS
|
||||
#endif
|
||||
|
||||
#if APR_HAVE_STDINT_H
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#if APR_HAVE_SYS_WAIT_H
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#ifdef OS2
|
||||
#define INCL_DOS
|
||||
#define INCL_DOSERRORS
|
||||
#include <os2.h>
|
||||
#endif
|
||||
|
||||
/* header files for PATH_MAX, _POSIX_PATH_MAX */
|
||||
#if APR_HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#else
|
||||
#if APR_HAVE_SYS_SYSLIMITS_H
|
||||
#include <sys/syslimits.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @addtogroup apr_platform
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define APR_HAVE_SHMEM_MMAP_TMP @havemmaptmp@
|
||||
#define APR_HAVE_SHMEM_MMAP_SHM @havemmapshm@
|
||||
#define APR_HAVE_SHMEM_MMAP_ZERO @havemmapzero@
|
||||
#define APR_HAVE_SHMEM_SHMGET_ANON @haveshmgetanon@
|
||||
#define APR_HAVE_SHMEM_SHMGET @haveshmget@
|
||||
#define APR_HAVE_SHMEM_MMAP_ANON @havemmapanon@
|
||||
#define APR_HAVE_SHMEM_BEOS @havebeosarea@
|
||||
|
||||
#define APR_USE_SHMEM_MMAP_TMP @usemmaptmp@
|
||||
#define APR_USE_SHMEM_MMAP_SHM @usemmapshm@
|
||||
#define APR_USE_SHMEM_MMAP_ZERO @usemmapzero@
|
||||
#define APR_USE_SHMEM_SHMGET_ANON @useshmgetanon@
|
||||
#define APR_USE_SHMEM_SHMGET @useshmget@
|
||||
#define APR_USE_SHMEM_MMAP_ANON @usemmapanon@
|
||||
#define APR_USE_SHMEM_BEOS @usebeosarea@
|
||||
|
||||
#define APR_USE_FLOCK_SERIALIZE @flockser@
|
||||
#define APR_USE_SYSVSEM_SERIALIZE @sysvser@
|
||||
#define APR_USE_POSIXSEM_SERIALIZE @posixser@
|
||||
#define APR_USE_FCNTL_SERIALIZE @fcntlser@
|
||||
#define APR_USE_PROC_PTHREAD_SERIALIZE @procpthreadser@
|
||||
#define APR_USE_PTHREAD_SERIALIZE @pthreadser@
|
||||
|
||||
#define APR_HAS_FLOCK_SERIALIZE @hasflockser@
|
||||
#define APR_HAS_SYSVSEM_SERIALIZE @hassysvser@
|
||||
#define APR_HAS_POSIXSEM_SERIALIZE @hasposixser@
|
||||
#define APR_HAS_FCNTL_SERIALIZE @hasfcntlser@
|
||||
#define APR_HAS_PROC_PTHREAD_SERIALIZE @hasprocpthreadser@
|
||||
|
||||
#define APR_PROCESS_LOCK_IS_GLOBAL @proclockglobal@
|
||||
|
||||
#define APR_HAVE_CORKABLE_TCP @have_corkable_tcp@
|
||||
#define APR_HAVE_GETRLIMIT @have_getrlimit@
|
||||
#define APR_HAVE_IN_ADDR @have_in_addr@
|
||||
#define APR_HAVE_INET_ADDR @have_inet_addr@
|
||||
#define APR_HAVE_INET_NETWORK @have_inet_network@
|
||||
#define APR_HAVE_IPV6 @have_ipv6@
|
||||
#define APR_HAVE_MEMMOVE @have_memmove@
|
||||
#define APR_HAVE_SETRLIMIT @have_setrlimit@
|
||||
#define APR_HAVE_SIGACTION @have_sigaction@
|
||||
#define APR_HAVE_SIGSUSPEND @have_sigsuspend@
|
||||
#define APR_HAVE_SIGWAIT @have_sigwait@
|
||||
#define APR_HAVE_SA_STORAGE @have_sa_storage@
|
||||
#define APR_HAVE_STRCASECMP @have_strcasecmp@
|
||||
#define APR_HAVE_STRDUP @have_strdup@
|
||||
#define APR_HAVE_STRICMP @have_stricmp@
|
||||
#define APR_HAVE_STRNCASECMP @have_strncasecmp@
|
||||
#define APR_HAVE_STRNICMP @have_strnicmp@
|
||||
#define APR_HAVE_STRSTR @have_strstr@
|
||||
#define APR_HAVE_MEMCHR @have_memchr@
|
||||
#define APR_HAVE_STRUCT_RLIMIT @struct_rlimit@
|
||||
#define APR_HAVE_UNION_SEMUN @have_union_semun@
|
||||
#define APR_HAVE_SCTP @have_sctp@
|
||||
#define APR_HAVE_IOVEC @have_iovec@
|
||||
|
||||
/* APR Feature Macros */
|
||||
#define APR_HAS_SHARED_MEMORY @sharedmem@
|
||||
#define APR_HAS_THREADS @threads@
|
||||
#define APR_HAS_SENDFILE @sendfile@
|
||||
#define APR_HAS_MMAP @mmap@
|
||||
#define APR_HAS_FORK @fork@
|
||||
#define APR_HAS_RANDOM @rand@
|
||||
#define APR_HAS_OTHER_CHILD @oc@
|
||||
#define APR_HAS_DSO @aprdso@
|
||||
#define APR_HAS_SO_ACCEPTFILTER @acceptfilter@
|
||||
#define APR_HAS_UNICODE_FS @have_unicode_fs@
|
||||
#define APR_HAS_PROC_INVOKED @have_proc_invoked@
|
||||
#define APR_HAS_USER @apr_has_user@
|
||||
#define APR_HAS_LARGE_FILES @aprlfs@
|
||||
#define APR_HAS_XTHREAD_FILES @apr_has_xthread_files@
|
||||
#define APR_HAS_OS_UUID @osuuid@
|
||||
|
||||
#define APR_PROCATTR_USER_SET_REQUIRES_PASSWORD @apr_procattr_user_set_requires_password@
|
||||
|
||||
/* APR sets APR_FILES_AS_SOCKETS to 1 on systems where it is possible
|
||||
* to poll on files/pipes.
|
||||
*/
|
||||
#define APR_FILES_AS_SOCKETS @file_as_socket@
|
||||
|
||||
/* This macro indicates whether or not EBCDIC is the native character set.
|
||||
*/
|
||||
#define APR_CHARSET_EBCDIC @apr_charset_ebcdic@
|
||||
|
||||
/* If we have a TCP implementation that can be "corked", what flag
|
||||
* do we use?
|
||||
*/
|
||||
#define APR_TCP_NOPUSH_FLAG @apr_tcp_nopush_flag@
|
||||
|
||||
/* Is the TCP_NODELAY socket option inherited from listening sockets?
|
||||
*/
|
||||
#define APR_TCP_NODELAY_INHERITED @tcp_nodelay_inherited@
|
||||
|
||||
/* Is the O_NONBLOCK flag inherited from listening sockets?
|
||||
*/
|
||||
#define APR_O_NONBLOCK_INHERITED @o_nonblock_inherited@
|
||||
|
||||
/* Typedefs that APR needs. */
|
||||
|
||||
typedef unsigned char apr_byte_t;
|
||||
|
||||
typedef @short_value@ apr_int16_t;
|
||||
typedef unsigned @short_value@ apr_uint16_t;
|
||||
|
||||
typedef @int_value@ apr_int32_t;
|
||||
typedef unsigned @int_value@ apr_uint32_t;
|
||||
|
||||
#define APR_SIZEOF_VOIDP @voidp_size@
|
||||
|
||||
/*
|
||||
* Darwin 10's default compiler (gcc42) builds for both 64 and
|
||||
* 32 bit architectures unless specifically told not to.
|
||||
* In those cases, we need to override types depending on how
|
||||
* we're being built at compile time.
|
||||
* NOTE: This is an ugly work-around for Darwin's
|
||||
* concept of universal binaries, a single package
|
||||
* (executable, lib, etc...) which contains both 32
|
||||
* and 64 bit versions. The issue is that if APR is
|
||||
* built universally, if something else is compiled
|
||||
* against it, some bit sizes will depend on whether
|
||||
* it is 32 or 64 bit. This is determined by the __LP64__
|
||||
* flag. Since we need to support both, we have to
|
||||
* handle OS X unqiuely.
|
||||
*/
|
||||
#ifdef DARWIN_10
|
||||
#undef APR_SIZEOF_VOIDP
|
||||
#undef INT64_C
|
||||
#undef UINT64_C
|
||||
#ifdef __LP64__
|
||||
typedef long apr_int64_t;
|
||||
typedef unsigned long apr_uint64_t;
|
||||
#define APR_SIZEOF_VOIDP 8
|
||||
#define INT64_C(v) (v ## L)
|
||||
#define UINT64_C(v) (v ## UL)
|
||||
#else
|
||||
typedef long long apr_int64_t;
|
||||
typedef unsigned long long apr_uint64_t;
|
||||
#define APR_SIZEOF_VOIDP 4
|
||||
#define INT64_C(v) (v ## LL)
|
||||
#define UINT64_C(v) (v ## ULL)
|
||||
#endif
|
||||
#else
|
||||
typedef @long_value@ apr_int64_t;
|
||||
typedef unsigned @long_value@ apr_uint64_t;
|
||||
#endif
|
||||
|
||||
typedef @size_t_value@ apr_size_t;
|
||||
typedef @ssize_t_value@ apr_ssize_t;
|
||||
typedef @off_t_value@ apr_off_t;
|
||||
typedef @socklen_t_value@ apr_socklen_t;
|
||||
typedef @ino_t_value@ apr_ino_t;
|
||||
|
||||
#if APR_SIZEOF_VOIDP == 8
|
||||
typedef apr_uint64_t apr_uintptr_t;
|
||||
#else
|
||||
typedef apr_uint32_t apr_uintptr_t;
|
||||
#endif
|
||||
|
||||
/* Are we big endian? */
|
||||
#define APR_IS_BIGENDIAN @bigendian@
|
||||
|
||||
/* Mechanisms to properly type numeric literals */
|
||||
@int64_literal@
|
||||
@uint64_literal@
|
||||
|
||||
#ifdef INT16_MIN
|
||||
#define APR_INT16_MIN INT16_MIN
|
||||
#else
|
||||
#define APR_INT16_MIN (-0x7fff - 1)
|
||||
#endif
|
||||
|
||||
#ifdef INT16_MAX
|
||||
#define APR_INT16_MAX INT16_MAX
|
||||
#else
|
||||
#define APR_INT16_MAX (0x7fff)
|
||||
#endif
|
||||
|
||||
#ifdef UINT16_MAX
|
||||
#define APR_UINT16_MAX UINT16_MAX
|
||||
#else
|
||||
#define APR_UINT16_MAX (0xffff)
|
||||
#endif
|
||||
|
||||
#ifdef INT32_MIN
|
||||
#define APR_INT32_MIN INT32_MIN
|
||||
#else
|
||||
#define APR_INT32_MIN (-0x7fffffff - 1)
|
||||
#endif
|
||||
|
||||
#ifdef INT32_MAX
|
||||
#define APR_INT32_MAX INT32_MAX
|
||||
#else
|
||||
#define APR_INT32_MAX 0x7fffffff
|
||||
#endif
|
||||
|
||||
#ifdef UINT32_MAX
|
||||
#define APR_UINT32_MAX UINT32_MAX
|
||||
#else
|
||||
#define APR_UINT32_MAX (0xffffffffU)
|
||||
#endif
|
||||
|
||||
#ifdef INT64_MIN
|
||||
#define APR_INT64_MIN INT64_MIN
|
||||
#else
|
||||
#define APR_INT64_MIN (APR_INT64_C(-0x7fffffffffffffff) - 1)
|
||||
#endif
|
||||
|
||||
#ifdef INT64_MAX
|
||||
#define APR_INT64_MAX INT64_MAX
|
||||
#else
|
||||
#define APR_INT64_MAX APR_INT64_C(0x7fffffffffffffff)
|
||||
#endif
|
||||
|
||||
#ifdef UINT64_MAX
|
||||
#define APR_UINT64_MAX UINT64_MAX
|
||||
#else
|
||||
#define APR_UINT64_MAX APR_UINT64_C(0xffffffffffffffff)
|
||||
#endif
|
||||
|
||||
#define APR_SIZE_MAX (~((apr_size_t)0))
|
||||
|
||||
|
||||
/* Definitions that APR programs need to work properly. */
|
||||
|
||||
/**
|
||||
* APR public API wrap for C++ compilers.
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
#define APR_BEGIN_DECLS extern "C" {
|
||||
#define APR_END_DECLS }
|
||||
#else
|
||||
#define APR_BEGIN_DECLS
|
||||
#define APR_END_DECLS
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Thread callbacks from APR functions must be declared with APR_THREAD_FUNC,
|
||||
* so that they follow the platform's calling convention.
|
||||
* <PRE>
|
||||
*
|
||||
* void* APR_THREAD_FUNC my_thread_entry_fn(apr_thread_t *thd, void *data);
|
||||
*
|
||||
* </PRE>
|
||||
*/
|
||||
#define APR_THREAD_FUNC @apr_thread_func@
|
||||
|
||||
/**
|
||||
* The public APR functions are declared with APR_DECLARE(), so they may
|
||||
* use the most appropriate calling convention. Public APR functions with
|
||||
* variable arguments must use APR_DECLARE_NONSTD().
|
||||
*
|
||||
* @remark Both the declaration and implementations must use the same macro.
|
||||
*
|
||||
* <PRE>
|
||||
* APR_DECLARE(rettype) apr_func(args)
|
||||
* </PRE>
|
||||
* @see APR_DECLARE_NONSTD @see APR_DECLARE_DATA
|
||||
* @remark Note that when APR compiles the library itself, it passes the
|
||||
* symbol -DAPR_DECLARE_EXPORT to the compiler on some platforms (e.g. Win32)
|
||||
* to export public symbols from the dynamic library build.\n
|
||||
* The user must define the APR_DECLARE_STATIC when compiling to target
|
||||
* the static APR library on some platforms (e.g. Win32.) The public symbols
|
||||
* are neither exported nor imported when APR_DECLARE_STATIC is defined.\n
|
||||
* By default, compiling an application and including the APR public
|
||||
* headers, without defining APR_DECLARE_STATIC, will prepare the code to be
|
||||
* linked to the dynamic library.
|
||||
*/
|
||||
#define APR_DECLARE(type) type
|
||||
|
||||
/**
|
||||
* The public APR functions using variable arguments are declared with
|
||||
* APR_DECLARE_NONSTD(), as they must follow the C language calling convention.
|
||||
* @see APR_DECLARE @see APR_DECLARE_DATA
|
||||
* @remark Both the declaration and implementations must use the same macro.
|
||||
* <PRE>
|
||||
*
|
||||
* APR_DECLARE_NONSTD(rettype) apr_func(args, ...);
|
||||
*
|
||||
* </PRE>
|
||||
*/
|
||||
#define APR_DECLARE_NONSTD(type) type
|
||||
|
||||
/**
|
||||
* The public APR variables are declared with AP_MODULE_DECLARE_DATA.
|
||||
* This assures the appropriate indirection is invoked at compile time.
|
||||
* @see APR_DECLARE @see APR_DECLARE_NONSTD
|
||||
* @remark Note that the declaration and implementations use different forms,
|
||||
* but both must include the macro.
|
||||
*
|
||||
* <PRE>
|
||||
*
|
||||
* extern APR_DECLARE_DATA type apr_variable;\n
|
||||
* APR_DECLARE_DATA type apr_variable = value;
|
||||
*
|
||||
* </PRE>
|
||||
*/
|
||||
#define APR_DECLARE_DATA
|
||||
|
||||
/* Define APR_SSIZE_T_FMT.
|
||||
* If ssize_t is an integer we define it to be "d",
|
||||
* if ssize_t is a long int we define it to be "ld",
|
||||
* if ssize_t is neither we declare an error here.
|
||||
* I looked for a better way to define this here, but couldn't find one, so
|
||||
* to find the logic for this definition search for "ssize_t_fmt" in
|
||||
* configure.in.
|
||||
*/
|
||||
|
||||
@ssize_t_fmt@
|
||||
|
||||
/* And APR_SIZE_T_FMT */
|
||||
@size_t_fmt@
|
||||
|
||||
/* And APR_OFF_T_FMT */
|
||||
@off_t_fmt@
|
||||
|
||||
/* And APR_PID_T_FMT */
|
||||
@pid_t_fmt@
|
||||
|
||||
/* And APR_INT64_T_FMT */
|
||||
@int64_t_fmt@
|
||||
|
||||
/* And APR_UINT64_T_FMT */
|
||||
@uint64_t_fmt@
|
||||
|
||||
/* And APR_UINT64_T_HEX_FMT */
|
||||
@uint64_t_hex_fmt@
|
||||
|
||||
/*
|
||||
* Ensure we work with universal binaries on Darwin
|
||||
*/
|
||||
#ifdef DARWIN_10
|
||||
|
||||
#undef APR_HAS_LARGE_FILES
|
||||
#undef APR_SIZEOF_VOIDP
|
||||
#undef APR_INT64_T_FMT
|
||||
#undef APR_UINT64_T_FMT
|
||||
#undef APR_UINT64_T_HEX_FMT
|
||||
|
||||
#ifdef __LP64__
|
||||
#define APR_HAS_LARGE_FILES 0
|
||||
#define APR_SIZEOF_VOIDP 8
|
||||
#define APR_INT64_T_FMT "ld"
|
||||
#define APR_UINT64_T_FMT "lu"
|
||||
#define APR_UINT64_T_HEX_FMT "lx"
|
||||
#else
|
||||
#define APR_HAS_LARGE_FILES 1
|
||||
#define APR_SIZEOF_VOIDP 4
|
||||
#define APR_INT64_T_FMT "lld"
|
||||
#define APR_UINT64_T_FMT "llu"
|
||||
#define APR_UINT64_T_HEX_FMT "llx"
|
||||
#endif
|
||||
|
||||
#undef APR_IS_BIGENDIAN
|
||||
#ifdef __BIG_ENDIAN__
|
||||
#define APR_IS_BIGENDIAN 1
|
||||
#else
|
||||
#define APR_IS_BIGENDIAN 0
|
||||
#endif
|
||||
|
||||
#undef APR_OFF_T_FMT
|
||||
#define APR_OFF_T_FMT "lld"
|
||||
|
||||
#endif /* DARWIN_10 */
|
||||
|
||||
/* Does the proc mutex lock threads too */
|
||||
#define APR_PROC_MUTEX_IS_GLOBAL @proc_mutex_is_global@
|
||||
|
||||
/* Local machine definition for console and log output. */
|
||||
#define APR_EOL_STR "@eolstr@"
|
||||
|
||||
#if APR_HAVE_SYS_WAIT_H
|
||||
#ifdef WEXITSTATUS
|
||||
#define apr_wait_t int
|
||||
#else
|
||||
#define apr_wait_t union wait
|
||||
#define WEXITSTATUS(status) (int)((status).w_retcode)
|
||||
#define WTERMSIG(status) (int)((status).w_termsig)
|
||||
#endif /* !WEXITSTATUS */
|
||||
#elif defined(__MINGW32__)
|
||||
typedef int apr_wait_t;
|
||||
#endif /* HAVE_SYS_WAIT_H */
|
||||
|
||||
#if defined(PATH_MAX)
|
||||
#define APR_PATH_MAX PATH_MAX
|
||||
#elif defined(_POSIX_PATH_MAX)
|
||||
#define APR_PATH_MAX _POSIX_PATH_MAX
|
||||
#else
|
||||
#error no decision has been made on APR_PATH_MAX for your platform
|
||||
#endif
|
||||
|
||||
#define APR_DSOPATH "@shlibpath_var@"
|
||||
|
||||
/** @} */
|
||||
|
||||
/* Definitions that only Win32 programs need to compile properly. */
|
||||
|
||||
/* XXX These simply don't belong here, perhaps in apr_portable.h
|
||||
* based on some APR_HAVE_PID/GID/UID?
|
||||
*/
|
||||
#ifdef __MINGW32__
|
||||
#ifndef __GNUC__
|
||||
typedef int pid_t;
|
||||
#endif
|
||||
typedef int uid_t;
|
||||
typedef int gid_t;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* APR_H */
|
443
include/apr.hnw
Normal file
443
include/apr.hnw
Normal file
@ -0,0 +1,443 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef APR_H
|
||||
#define APR_H
|
||||
|
||||
/* GENERATED FILE WARNING! DO NOT EDIT apr.h
|
||||
*
|
||||
* You must modify apr.hnw instead.
|
||||
*
|
||||
* And please, make an effort to stub apr.hw and apr.h.in in the process.
|
||||
*
|
||||
* This is the NetWare specific version of apr.h. It is copied from
|
||||
* apr.hnw at the start of a NetWare build by the ./build/NWGNmakefile.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file apr.h
|
||||
* @brief APR Platform Definitions
|
||||
* @remark This is a generated header generated from include/apr.h.in by
|
||||
* ./configure, or copied from include/apr.hw or include/apr.hnw
|
||||
* for Win32 or Netware by those build environments, respectively.
|
||||
*/
|
||||
|
||||
#if defined(NETWARE) || defined(DOXYGEN)
|
||||
|
||||
#undef FD_SETSIZE
|
||||
#define FD_SETSIZE 1024
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <netware.h>
|
||||
#include <nks/thread.h>
|
||||
#include <nks/synch.h>
|
||||
#include <nks/time.h>
|
||||
#include <signal.h>
|
||||
#ifdef USE_WINSOCK
|
||||
#include <novsock2.h>
|
||||
#ifdef NW_BUILD_IPV6
|
||||
#include <novtcpip.h>
|
||||
#endif
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
|
||||
#define _POSIX_THREAD_SAFE_FUNCTIONS 1
|
||||
#define READDIR_IS_THREAD_SAFE 1
|
||||
|
||||
/* Keep #include'd headers from within the __cplusplus or doxyblocks */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup apr_platform Platform Definitions
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define APR_INLINE
|
||||
#define APR_HAS_INLINE 0
|
||||
#ifndef __attribute__
|
||||
#define __attribute__(__x)
|
||||
#endif
|
||||
#define ENUM_BITFIELD(e,n,w) signed int n : w
|
||||
|
||||
#define APR_HAVE_CONIO_H 0
|
||||
#define APR_HAVE_CRYPT_H 0
|
||||
#define APR_HAVE_CTYPE_H 1
|
||||
#define APR_HAVE_DIRENT_H 1
|
||||
#define APR_HAVE_ERRNO_H 1
|
||||
#define APR_HAVE_FCNTL_H 1
|
||||
#define APR_HAVE_IO_H 0
|
||||
#define APR_HAVE_LIMITS_H 1
|
||||
#ifdef USE_WINSOCK
|
||||
#define APR_HAVE_ARPA_INET_H 0
|
||||
#define APR_HAVE_NETDB_H 0
|
||||
#define APR_HAVE_NETINET_IN_H 0
|
||||
#else
|
||||
#define APR_HAVE_ARPA_INET_H 1
|
||||
#define APR_HAVE_NETDB_H 1
|
||||
#define APR_HAVE_NETINET_IN_H 1
|
||||
#endif
|
||||
#define APR_HAVE_NETINET_SCTP_H 0
|
||||
#define APR_HAVE_NETINET_SCTP_UIO_H 0
|
||||
#define APR_HAVE_NETINET_TCP_H 0
|
||||
#define APR_HAVE_PTHREAD_H 0
|
||||
#define APR_HAVE_SIGNAL_H 1
|
||||
#define APR_HAVE_STDARG_H 1
|
||||
#define APR_HAVE_STDINT_H 0
|
||||
#define APR_HAVE_STDIO_H 1
|
||||
#define APR_HAVE_STDLIB_H 1
|
||||
#define APR_HAVE_STRING_H 1
|
||||
#define APR_HAVE_STRINGS_H 0
|
||||
#define APR_HAVE_STRTOLL 1
|
||||
#define APR_HAVE_SYS_SENDFILE_H 0
|
||||
#define APR_HAVE_SYS_SYSLIMITS_H 0
|
||||
#ifdef USE_WINSOCK
|
||||
#define APR_HAVE_SYS_SOCKET_H 0
|
||||
#define APR_HAVE_SYS_SOCKIO_H 0
|
||||
#define APR_HAVE_SYS_UN_H 0
|
||||
#else
|
||||
#define APR_HAVE_SYS_SOCKET_H 1
|
||||
#define APR_HAVE_SYS_SOCKIO_H 1
|
||||
#define APR_HAVE_SYS_UN_H 1
|
||||
#endif
|
||||
#define APR_HAVE_SYS_SIGNAL_H 1
|
||||
#define APR_HAVE_SYS_TIME_H 1
|
||||
#define APR_HAVE_SYS_TYPES_H 1
|
||||
#define APR_HAVE_SYS_UIO_H 1
|
||||
#define APR_HAVE_SYS_WAIT_H 1
|
||||
#define APR_HAVE_TIME_H 1
|
||||
#define APR_HAVE_UNISTD_H 1
|
||||
|
||||
#define APR_HAVE_SHMEM_MMAP_TMP 0
|
||||
#define APR_HAVE_SHMEM_MMAP_SHM 0
|
||||
#define APR_HAVE_SHMEM_MMAP_ZERO 0
|
||||
#define APR_HAVE_SHMEM_SHMGET_ANON 0
|
||||
#define APR_HAVE_SHMEM_SHMGET 0
|
||||
#define APR_HAVE_SHMEM_MMAP_ANON 0
|
||||
#define APR_HAVE_SHMEM_BEOS 0
|
||||
|
||||
#define APR_USE_SHMEM_MMAP_TMP 0
|
||||
#define APR_USE_SHMEM_MMAP_SHM 0
|
||||
#define APR_USE_SHMEM_MMAP_ZERO 0
|
||||
#define APR_USE_SHMEM_SHMGET_ANON 0
|
||||
#define APR_USE_SHMEM_SHMGET 0
|
||||
#define APR_USE_SHMEM_MMAP_ANON 0
|
||||
#define APR_USE_SHMEM_BEOS 0
|
||||
|
||||
#define APR_USE_FLOCK_SERIALIZE 0
|
||||
#define APR_USE_SYSVSEM_SERIALIZE 0
|
||||
#define APR_USE_FCNTL_SERIALIZE 0
|
||||
#define APR_USE_PROC_PTHREAD_SERIALIZE 0
|
||||
#define APR_USE_PTHREAD_SERIALIZE 0
|
||||
|
||||
#define APR_HAS_FLOCK_SERIALIZE 0
|
||||
#define APR_HAS_SYSVSEM_SERIALIZE 0
|
||||
#define APR_HAS_FCNTL_SERIALIZE 0
|
||||
#define APR_HAS_PROC_PTHREAD_SERIALIZE 0
|
||||
#define APR_HAS_RWLOCK_SERIALIZE 0
|
||||
|
||||
#define APR_HAS_LOCK_CREATE_NP 0
|
||||
|
||||
#define APR_PROCESS_LOCK_IS_GLOBAL 1
|
||||
|
||||
#define APR_FILE_BASED_SHM 0
|
||||
|
||||
#define APR_HAVE_CORKABLE_TCP 0
|
||||
#define APR_HAVE_GETRLIMIT 0
|
||||
#define APR_HAVE_ICONV 0
|
||||
#define APR_HAVE_IN_ADDR 1
|
||||
#define APR_HAVE_INET_ADDR 1
|
||||
#define APR_HAVE_INET_NETWORK 0
|
||||
#ifdef NW_BUILD_IPV6
|
||||
#define APR_HAVE_IPV6 1
|
||||
#else
|
||||
#define APR_HAVE_IPV6 0
|
||||
#endif
|
||||
#define APR_HAVE_MEMCHR 1
|
||||
#define APR_HAVE_MEMMOVE 1
|
||||
#define APR_HAVE_SETRLIMIT 0
|
||||
#define APR_HAVE_SIGACTION 0
|
||||
#define APR_HAVE_SIGSUSPEND 0
|
||||
#define APR_HAVE_SIGWAIT 0
|
||||
#define APR_HAVE_STRCASECMP 1
|
||||
#define APR_HAVE_STRDUP 1
|
||||
#define APR_HAVE_STRICMP 1
|
||||
#define APR_HAVE_STRNCASECMP 1
|
||||
#define APR_HAVE_STRNICMP 1
|
||||
#define APR_HAVE_STRSTR 1
|
||||
#define APR_HAVE_STRUCT_RLIMIT 0
|
||||
#define APR_HAVE_UNION_SEMUN 0
|
||||
#define APR_HAVE_SCTP 0
|
||||
#define APR_HAVE_IOVEC 1
|
||||
|
||||
/* APR Feature Macros */
|
||||
#define APR_HAS_SHARED_MEMORY 0
|
||||
#define APR_HAS_THREADS 1
|
||||
#define APR_HAS_SENDFILE 0
|
||||
#define APR_HAS_MMAP 0
|
||||
#define APR_HAS_FORK 0
|
||||
#define APR_HAS_RANDOM 1
|
||||
#define APR_HAS_OTHER_CHILD 0
|
||||
#define APR_HAS_DSO 1
|
||||
#define APR_HAS_SO_ACCEPTFILTER 0
|
||||
#define APR_HAS_UNICODE_FS 0
|
||||
#define APR_HAS_PROC_INVOKED 0
|
||||
#define APR_HAS_USER 1
|
||||
#define APR_HAS_LARGE_FILES 1
|
||||
#define APR_HAS_XTHREAD_FILES 0
|
||||
#define APR_HAS_OS_UUID 0
|
||||
|
||||
#define APR_PROCATTR_USER_SET_REQUIRES_PASSWORD 0
|
||||
|
||||
/* Netware can poll on files/pipes.
|
||||
*/
|
||||
#define APR_FILES_AS_SOCKETS 1
|
||||
|
||||
/* This macro indicates whether or not EBCDIC is the native character set.
|
||||
*/
|
||||
#define APR_CHARSET_EBCDIC 0
|
||||
|
||||
/* Is the TCP_NODELAY socket option inherited from listening sockets?
|
||||
*/
|
||||
#define APR_TCP_NODELAY_INHERITED 1
|
||||
|
||||
/* Is the O_NONBLOCK flag inherited from listening sockets?
|
||||
*/
|
||||
#define APR_O_NONBLOCK_INHERITED 1
|
||||
|
||||
/* Typedefs that APR needs. */
|
||||
|
||||
typedef unsigned char apr_byte_t;
|
||||
|
||||
typedef short apr_int16_t;
|
||||
typedef unsigned short apr_uint16_t;
|
||||
|
||||
typedef int apr_int32_t;
|
||||
typedef unsigned int apr_uint32_t;
|
||||
|
||||
typedef long long apr_int64_t;
|
||||
typedef unsigned long long apr_uint64_t;
|
||||
|
||||
typedef size_t apr_size_t;
|
||||
typedef ssize_t apr_ssize_t;
|
||||
#if APR_HAS_LARGE_FILES
|
||||
typedef off64_t apr_off_t;
|
||||
#else
|
||||
typedef off_t apr_off_t;
|
||||
#endif
|
||||
#ifdef USE_WINSOCK
|
||||
typedef int apr_socklen_t;
|
||||
#else
|
||||
typedef size_t apr_socklen_t;
|
||||
#endif
|
||||
typedef apr_uint64_t apr_ino_t;
|
||||
|
||||
/* Are we big endian? */
|
||||
/* XXX: Fatal assumption on Alpha platforms */
|
||||
#define APR_IS_BIGENDIAN 0
|
||||
|
||||
#ifdef UNKNOWN_NETWARE_64BIT_FLAG_NEEDED
|
||||
#define APR_SIZEOF_VOIDP 8
|
||||
#else
|
||||
#define APR_SIZEOF_VOIDP 4
|
||||
#endif
|
||||
|
||||
#if APR_SIZEOF_VOIDP == 8
|
||||
typedef apr_uint64_t apr_uintptr_t;
|
||||
#else
|
||||
typedef apr_uint32_t apr_uintptr_t;
|
||||
#endif
|
||||
|
||||
/* Mechanisms to properly type numeric literals */
|
||||
#define APR_INT64_C(val) (val##LL)
|
||||
#define APR_UINT64_C(val) (val##ULL)
|
||||
|
||||
#ifdef INT16_MIN
|
||||
#define APR_INT16_MIN INT16_MIN
|
||||
#else
|
||||
#define APR_INT16_MIN (-0x7fff - 1)
|
||||
#endif
|
||||
|
||||
#ifdef INT16_MAX
|
||||
#define APR_INT16_MAX INT16_MAX
|
||||
#else
|
||||
#define APR_INT16_MAX (0x7fff)
|
||||
#endif
|
||||
|
||||
#ifdef UINT16_MAX
|
||||
#define APR_UINT16_MAX UINT16_MAX
|
||||
#else
|
||||
#define APR_UINT16_MAX (0xffff)
|
||||
#endif
|
||||
|
||||
#ifdef INT32_MIN
|
||||
#define APR_INT32_MIN INT32_MIN
|
||||
#else
|
||||
#define APR_INT32_MIN (-0x7fffffff - 1)
|
||||
#endif
|
||||
|
||||
#ifdef INT32_MAX
|
||||
#define APR_INT32_MAX INT32_MAX
|
||||
#else
|
||||
#define APR_INT32_MAX 0x7fffffff
|
||||
#endif
|
||||
|
||||
#ifdef UINT32_MAX
|
||||
#define APR_UINT32_MAX UINT32_MAX
|
||||
#else
|
||||
#define APR_UINT32_MAX (0xffffffffU)
|
||||
#endif
|
||||
|
||||
#ifdef INT64_MIN
|
||||
#define APR_INT64_MIN INT64_MIN
|
||||
#else
|
||||
#define APR_INT64_MIN (APR_INT64_C(-0x7fffffffffffffff) - 1)
|
||||
#endif
|
||||
|
||||
#ifdef INT64_MAX
|
||||
#define APR_INT64_MAX INT64_MAX
|
||||
#else
|
||||
#define APR_INT64_MAX APR_INT64_C(0x7fffffffffffffff)
|
||||
#endif
|
||||
|
||||
#ifdef UINT64_MAX
|
||||
#define APR_UINT64_MAX UINT64_MAX
|
||||
#else
|
||||
#define APR_UINT64_MAX APR_UINT64_C(0xffffffffffffffff)
|
||||
#endif
|
||||
|
||||
#define APR_SIZE_MAX (~((apr_size_t)0))
|
||||
|
||||
/* PROC mutex is a GLOBAL mutex on Netware */
|
||||
#define APR_PROC_MUTEX_IS_GLOBAL 1
|
||||
|
||||
/* Definitions that APR programs need to work properly. */
|
||||
|
||||
/**
|
||||
* APR public API wrap for C++ compilers.
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
#define APR_BEGIN_DECLS extern "C" {
|
||||
#define APR_END_DECLS }
|
||||
#else
|
||||
#define APR_BEGIN_DECLS
|
||||
#define APR_END_DECLS
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Thread callbacks from APR functions must be declared with APR_THREAD_FUNC,
|
||||
* so that they follow the platform's calling convention.
|
||||
* @example
|
||||
*/
|
||||
/** void* APR_THREAD_FUNC my_thread_entry_fn(apr_thread_t *thd, void *data);
|
||||
*/
|
||||
#define APR_THREAD_FUNC
|
||||
|
||||
/**
|
||||
* The public APR functions are declared with APR_DECLARE(), so they may
|
||||
* use the most appropriate calling convention. Public APR functions with
|
||||
* variable arguments must use APR_DECLARE_NONSTD().
|
||||
*
|
||||
* @remark Both the declaration and implementations must use the same macro.
|
||||
* @example
|
||||
*/
|
||||
/** APR_DECLARE(rettype) apr_func(args)
|
||||
* @see APR_DECLARE_NONSTD @see APR_DECLARE_DATA
|
||||
* @remark Note that when APR compiles the library itself, it passes the
|
||||
* symbol -DAPR_DECLARE_EXPORT to the compiler on some platforms (e.g. Win32)
|
||||
* to export public symbols from the dynamic library build.\n
|
||||
* The user must define the APR_DECLARE_STATIC when compiling to target
|
||||
* the static APR library on some platforms (e.g. Win32.) The public symbols
|
||||
* are neither exported nor imported when APR_DECLARE_STATIC is defined.\n
|
||||
* By default, compiling an application and including the APR public
|
||||
* headers, without defining APR_DECLARE_STATIC, will prepare the code to be
|
||||
* linked to the dynamic library.
|
||||
*/
|
||||
#define APR_DECLARE(type) type
|
||||
|
||||
/**
|
||||
* The public APR functions using variable arguments are declared with
|
||||
* APR_DECLARE_NONSTD(), as they must follow the C language calling convention.
|
||||
* @see APR_DECLARE @see APR_DECLARE_DATA
|
||||
* @remark Both the declaration and implementations must use the same macro.
|
||||
* @example
|
||||
*/
|
||||
/** APR_DECLARE_NONSTD(rettype) apr_func(args, ...);
|
||||
*/
|
||||
#define APR_DECLARE_NONSTD(type) type
|
||||
|
||||
/**
|
||||
* The public APR variables are declared with APR_DECLARE_DATA.
|
||||
* This assures the appropriate indirection is invoked at compile time.
|
||||
* @see APR_DECLARE @see APR_DECLARE_NONSTD
|
||||
* @remark Note that the declaration and implementations use different forms,
|
||||
* but both must include the macro.
|
||||
* @example
|
||||
*/
|
||||
/** extern APR_DECLARE_DATA type apr_variable;\n
|
||||
* APR_DECLARE_DATA type apr_variable = value;
|
||||
*/
|
||||
#define APR_DECLARE_DATA
|
||||
|
||||
#define APR_SSIZE_T_FMT "d"
|
||||
|
||||
#define APR_SIZE_T_FMT "d"
|
||||
|
||||
#if APR_HAS_LARGE_FILES
|
||||
#define APR_OFF_T_FMT "lld"
|
||||
#else
|
||||
#define APR_OFF_T_FMT "ld"
|
||||
#endif
|
||||
|
||||
#define APR_PID_T_FMT "d"
|
||||
|
||||
/* Local machine definition for console and log output. */
|
||||
#define APR_EOL_STR "\r\n"
|
||||
|
||||
typedef int apr_wait_t;
|
||||
|
||||
#define APR_PATH_MAX PATH_MAX
|
||||
|
||||
#define APR_DSOPATH "PATH"
|
||||
|
||||
#define APR_INT64_T_FMT "lld"
|
||||
#define APR_UINT64_T_FMT "llu"
|
||||
#define APR_UINT64_T_HEX_FMT "llx"
|
||||
#define APR_TIME_T_FMT APR_INT64_T_FMT
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* NETWARE */
|
||||
|
||||
#endif /* APR_H */
|
638
include/apr.hw
Normal file
638
include/apr.hw
Normal file
@ -0,0 +1,638 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef APR_H
|
||||
#define APR_H
|
||||
|
||||
/* GENERATED FILE WARNING! DO NOT EDIT apr.h
|
||||
*
|
||||
* You must modify apr.hw instead.
|
||||
*
|
||||
* And please, make an effort to stub apr.hnw and apr.h.in in the process.
|
||||
*
|
||||
* This is the Win32 specific version of apr.h. It is copied from
|
||||
* apr.hw by the apr.dsp and libapr.dsp projects.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file apr.h
|
||||
* @brief APR Platform Definitions
|
||||
* @remark This is a generated header generated from include/apr.h.in by
|
||||
* ./configure, or copied from include/apr.hw or include/apr.hnw
|
||||
* for Win32 or Netware by those build environments, respectively.
|
||||
*/
|
||||
|
||||
#if defined(WIN32) || defined(DOXYGEN)
|
||||
|
||||
/* Ignore most warnings (back down to /W3) for poorly constructed headers
|
||||
*/
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1200
|
||||
#pragma warning(push, 3)
|
||||
#endif
|
||||
|
||||
/* disable or reduce the frequency of...
|
||||
* C4057: indirection to slightly different base types
|
||||
* C4075: slight indirection changes (unsigned short* vs short[])
|
||||
* C4100: unreferenced formal parameter
|
||||
* C4127: conditional expression is constant
|
||||
* C4163: '_rotl64' : not available as an intrinsic function
|
||||
* C4201: nonstandard extension nameless struct/unions
|
||||
* C4244: int to char/short - precision loss
|
||||
* C4514: unreferenced inline function removed
|
||||
*/
|
||||
#pragma warning(disable: 4100 4127 4163 4201 4514; once: 4057 4075 4244)
|
||||
|
||||
/* Ignore Microsoft's interpretation of secure development
|
||||
* and the POSIX string handling API
|
||||
*/
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
#ifndef _CRT_SECURE_NO_DEPRECATE
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
#endif
|
||||
#pragma warning(disable: 4996)
|
||||
#endif
|
||||
|
||||
/* Has windows.h already been included? If so, our preferences don't matter,
|
||||
* but we will still need the winsock things no matter what was included.
|
||||
* If not, include a restricted set of windows headers to our tastes.
|
||||
*/
|
||||
#ifndef _WINDOWS_
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#ifndef _WIN32_WINNT
|
||||
|
||||
/* Restrict the server to a subset of Windows XP header files by default
|
||||
*/
|
||||
#define _WIN32_WINNT 0x0501
|
||||
#endif
|
||||
#ifndef NOUSER
|
||||
#define NOUSER
|
||||
#endif
|
||||
#ifndef NOMCX
|
||||
#define NOMCX
|
||||
#endif
|
||||
#ifndef NOIME
|
||||
#define NOIME
|
||||
#endif
|
||||
#include <windows.h>
|
||||
/*
|
||||
* Add a _very_few_ declarations missing from the restricted set of headers
|
||||
* (If this list becomes extensive, re-enable the required headers above!)
|
||||
* winsock headers were excluded by WIN32_LEAN_AND_MEAN, so include them now
|
||||
*/
|
||||
#define SW_HIDE 0
|
||||
#ifndef _WIN32_WCE
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <mswsock.h>
|
||||
#else
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
#endif /* !_WINDOWS_ */
|
||||
|
||||
/**
|
||||
* @defgroup APR Apache Portability Runtime library
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @defgroup apr_platform Platform Definitions
|
||||
* @{
|
||||
* @warning
|
||||
* <strong><em>The actual values of macros and typedefs on this page<br>
|
||||
* are platform specific and should NOT be relied upon!</em></strong>
|
||||
*/
|
||||
|
||||
#define APR_INLINE __inline
|
||||
#define APR_HAS_INLINE 1
|
||||
#if !defined(__GNUC__) && !defined(__attribute__)
|
||||
#define __attribute__(__x)
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
#define APR_HAVE_ARPA_INET_H 0
|
||||
#define APR_HAVE_CONIO_H 1
|
||||
#define APR_HAVE_CRYPT_H 0
|
||||
#define APR_HAVE_CTYPE_H 1
|
||||
#define APR_HAVE_DIRENT_H 0
|
||||
#define APR_HAVE_ERRNO_H 1
|
||||
#define APR_HAVE_FCNTL_H 1
|
||||
#define APR_HAVE_IO_H 1
|
||||
#define APR_HAVE_LIMITS_H 1
|
||||
#define APR_HAVE_NETDB_H 0
|
||||
#define APR_HAVE_NETINET_IN_H 0
|
||||
#define APR_HAVE_NETINET_SCTP_H 0
|
||||
#define APR_HAVE_NETINET_SCTP_UIO_H 0
|
||||
#define APR_HAVE_NETINET_TCP_H 0
|
||||
#define APR_HAVE_PTHREAD_H 0
|
||||
#define APR_HAVE_SEMAPHORE_H 0
|
||||
#define APR_HAVE_SIGNAL_H 1
|
||||
#define APR_HAVE_STDARG_H 1
|
||||
#define APR_HAVE_STDINT_H 0
|
||||
#define APR_HAVE_STDIO_H 1
|
||||
#define APR_HAVE_STDLIB_H 1
|
||||
#define APR_HAVE_STRING_H 1
|
||||
#define APR_HAVE_STRINGS_H 0
|
||||
#define APR_HAVE_SYS_IOCTL_H 0
|
||||
#define APR_HAVE_SYS_SENDFILE_H 0
|
||||
#define APR_HAVE_SYS_SIGNAL_H 0
|
||||
#define APR_HAVE_SYS_SOCKET_H 0
|
||||
#define APR_HAVE_SYS_SOCKIO_H 0
|
||||
#define APR_HAVE_SYS_SYSLIMITS_H 0
|
||||
#define APR_HAVE_SYS_TIME_H 0
|
||||
#define APR_HAVE_SYS_TYPES_H 1
|
||||
#define APR_HAVE_SYS_UIO_H 0
|
||||
#define APR_HAVE_SYS_UN_H 0
|
||||
#define APR_HAVE_SYS_WAIT_H 0
|
||||
#define APR_HAVE_TIME_H 1
|
||||
#define APR_HAVE_UNISTD_H 0
|
||||
#define APR_HAVE_STDDEF_H 1
|
||||
#define APR_HAVE_PROCESS_H 1
|
||||
#else
|
||||
#define APR_HAVE_ARPA_INET_H 0
|
||||
#define APR_HAVE_CONIO_H 0
|
||||
#define APR_HAVE_CRYPT_H 0
|
||||
#define APR_HAVE_CTYPE_H 0
|
||||
#define APR_HAVE_DIRENT_H 0
|
||||
#define APR_HAVE_ERRNO_H 0
|
||||
#define APR_HAVE_FCNTL_H 0
|
||||
#define APR_HAVE_IO_H 0
|
||||
#define APR_HAVE_LIMITS_H 0
|
||||
#define APR_HAVE_NETDB_H 0
|
||||
#define APR_HAVE_NETINET_IN_H 0
|
||||
#define APR_HAVE_NETINET_SCTP_H 0
|
||||
#define APR_HAVE_NETINET_SCTP_UIO_H 0
|
||||
#define APR_HAVE_NETINET_TCP_H 0
|
||||
#define APR_HAVE_PTHREAD_H 0
|
||||
#define APR_HAVE_SEMAPHORE_H 0
|
||||
#define APR_HAVE_SIGNAL_H 0
|
||||
#define APR_HAVE_STDARG_H 0
|
||||
#define APR_HAVE_STDINT_H 0
|
||||
#define APR_HAVE_STDIO_H 1
|
||||
#define APR_HAVE_STDLIB_H 1
|
||||
#define APR_HAVE_STRING_H 1
|
||||
#define APR_HAVE_STRINGS_H 0
|
||||
#define APR_HAVE_SYS_IOCTL_H 0
|
||||
#define APR_HAVE_SYS_SENDFILE_H 0
|
||||
#define APR_HAVE_SYS_SIGNAL_H 0
|
||||
#define APR_HAVE_SYS_SOCKET_H 0
|
||||
#define APR_HAVE_SYS_SOCKIO_H 0
|
||||
#define APR_HAVE_SYS_SYSLIMITS_H 0
|
||||
#define APR_HAVE_SYS_TIME_H 0
|
||||
#define APR_HAVE_SYS_TYPES_H 0
|
||||
#define APR_HAVE_SYS_UIO_H 0
|
||||
#define APR_HAVE_SYS_UN_H 0
|
||||
#define APR_HAVE_SYS_WAIT_H 0
|
||||
#define APR_HAVE_TIME_H 0
|
||||
#define APR_HAVE_UNISTD_H 0
|
||||
#define APR_HAVE_STDDEF_H 0
|
||||
#define APR_HAVE_PROCESS_H 0
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
/** @} */
|
||||
|
||||
/* We don't include our conditional headers within the doxyblocks
|
||||
* or the extern "C" namespace
|
||||
*/
|
||||
|
||||
#if APR_HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#if APR_HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#if APR_HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#if APR_HAVE_STDDEF_H
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
#if APR_HAVE_TIME_H
|
||||
#include <time.h>
|
||||
#endif
|
||||
#if APR_HAVE_PROCESS_H
|
||||
#include <process.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @addtogroup apr_platform
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define APR_HAVE_SHMEM_MMAP_TMP 0
|
||||
#define APR_HAVE_SHMEM_MMAP_SHM 0
|
||||
#define APR_HAVE_SHMEM_MMAP_ZERO 0
|
||||
#define APR_HAVE_SHMEM_SHMGET_ANON 0
|
||||
#define APR_HAVE_SHMEM_SHMGET 0
|
||||
#define APR_HAVE_SHMEM_MMAP_ANON 0
|
||||
#define APR_HAVE_SHMEM_BEOS 0
|
||||
|
||||
#define APR_USE_SHMEM_MMAP_TMP 0
|
||||
#define APR_USE_SHMEM_MMAP_SHM 0
|
||||
#define APR_USE_SHMEM_MMAP_ZERO 0
|
||||
#define APR_USE_SHMEM_SHMGET_ANON 0
|
||||
#define APR_USE_SHMEM_SHMGET 0
|
||||
#define APR_USE_SHMEM_MMAP_ANON 0
|
||||
#define APR_USE_SHMEM_BEOS 0
|
||||
|
||||
#define APR_USE_FLOCK_SERIALIZE 0
|
||||
#define APR_USE_POSIXSEM_SERIALIZE 0
|
||||
#define APR_USE_SYSVSEM_SERIALIZE 0
|
||||
#define APR_USE_FCNTL_SERIALIZE 0
|
||||
#define APR_USE_PROC_PTHREAD_SERIALIZE 0
|
||||
#define APR_USE_PTHREAD_SERIALIZE 0
|
||||
|
||||
#define APR_HAS_FLOCK_SERIALIZE 0
|
||||
#define APR_HAS_SYSVSEM_SERIALIZE 0
|
||||
#define APR_HAS_POSIXSEM_SERIALIZE 0
|
||||
#define APR_HAS_FCNTL_SERIALIZE 0
|
||||
#define APR_HAS_PROC_PTHREAD_SERIALIZE 0
|
||||
|
||||
#define APR_PROCESS_LOCK_IS_GLOBAL 0
|
||||
|
||||
#define APR_HAVE_CORKABLE_TCP 0
|
||||
#define APR_HAVE_GETRLIMIT 0
|
||||
#define APR_HAVE_ICONV 0
|
||||
#define APR_HAVE_IN_ADDR 1
|
||||
#define APR_HAVE_INET_ADDR 1
|
||||
#define APR_HAVE_INET_NETWORK 0
|
||||
#define APR_HAVE_IPV6 0
|
||||
#define APR_HAVE_MEMMOVE 1
|
||||
#define APR_HAVE_SETRLIMIT 0
|
||||
#define APR_HAVE_SIGACTION 0
|
||||
#define APR_HAVE_SIGSUSPEND 0
|
||||
#define APR_HAVE_SIGWAIT 0
|
||||
#define APR_HAVE_SA_STORAGE 0
|
||||
#define APR_HAVE_STRCASECMP 0
|
||||
#define APR_HAVE_STRDUP 1
|
||||
#define APR_HAVE_STRNCASECMP 0
|
||||
#define APR_HAVE_STRSTR 1
|
||||
#define APR_HAVE_MEMCHR 1
|
||||
#define APR_HAVE_STRUCT_RLIMIT 0
|
||||
#define APR_HAVE_UNION_SEMUN 0
|
||||
#define APR_HAVE_SCTP 0
|
||||
#define APR_HAVE_IOVEC 0
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
#define APR_HAVE_STRICMP 1
|
||||
#define APR_HAVE_STRNICMP 1
|
||||
#else
|
||||
#define APR_HAVE_STRICMP 0
|
||||
#define APR_HAVE_STRNICMP 0
|
||||
#endif
|
||||
|
||||
/* APR Feature Macros */
|
||||
#define APR_HAS_SHARED_MEMORY 1
|
||||
#define APR_HAS_THREADS 1
|
||||
#define APR_HAS_MMAP 1
|
||||
#define APR_HAS_FORK 0
|
||||
#define APR_HAS_RANDOM 1
|
||||
#define APR_HAS_OTHER_CHILD 1
|
||||
#define APR_HAS_DSO 1
|
||||
#define APR_HAS_SO_ACCEPTFILTER 0
|
||||
#define APR_HAS_UNICODE_FS 1
|
||||
#define APR_HAS_PROC_INVOKED 1
|
||||
#define APR_HAS_OS_UUID 1
|
||||
|
||||
#ifndef _WIN32_WCE
|
||||
#define APR_HAS_SENDFILE 1
|
||||
#define APR_HAS_USER 1
|
||||
#define APR_HAS_LARGE_FILES 1
|
||||
#define APR_HAS_XTHREAD_FILES 1
|
||||
#define APR_PROCATTR_USER_SET_REQUIRES_PASSWORD 1
|
||||
#else
|
||||
#define APR_HAS_SENDFILE 0
|
||||
#define APR_HAS_USER 0
|
||||
#define APR_HAS_LARGE_FILES 0
|
||||
#define APR_HAS_XTHREAD_FILES 0
|
||||
#define APR_PROCATTR_USER_SET_REQUIRES_PASSWORD 0
|
||||
#endif
|
||||
|
||||
/* APR sets APR_FILES_AS_SOCKETS to 1 on systems where it is possible
|
||||
* to poll on files/pipes.
|
||||
*/
|
||||
#define APR_FILES_AS_SOCKETS 0
|
||||
|
||||
/* This macro indicates whether or not EBCDIC is the native character set.
|
||||
*/
|
||||
#define APR_CHARSET_EBCDIC 0
|
||||
|
||||
/* If we have a TCP implementation that can be "corked", what flag
|
||||
* do we use?
|
||||
*/
|
||||
#define APR_TCP_NOPUSH_FLAG @apr_tcp_nopush_flag@
|
||||
|
||||
/* Is the TCP_NODELAY socket option inherited from listening sockets?
|
||||
*/
|
||||
#define APR_TCP_NODELAY_INHERITED 1
|
||||
|
||||
/* Is the O_NONBLOCK flag inherited from listening sockets?
|
||||
*/
|
||||
#define APR_O_NONBLOCK_INHERITED 1
|
||||
|
||||
/* Typedefs that APR needs. */
|
||||
|
||||
typedef unsigned char apr_byte_t;
|
||||
|
||||
typedef short apr_int16_t;
|
||||
typedef unsigned short apr_uint16_t;
|
||||
|
||||
typedef int apr_int32_t;
|
||||
typedef unsigned int apr_uint32_t;
|
||||
|
||||
typedef __int64 apr_int64_t;
|
||||
typedef unsigned __int64 apr_uint64_t;
|
||||
|
||||
typedef size_t apr_size_t;
|
||||
#if APR_HAVE_STDDEF_H
|
||||
typedef ptrdiff_t apr_ssize_t;
|
||||
#else
|
||||
typedef int apr_ssize_t;
|
||||
#endif
|
||||
#if APR_HAS_LARGE_FILES
|
||||
typedef __int64 apr_off_t;
|
||||
#else
|
||||
typedef int apr_off_t;
|
||||
#endif
|
||||
typedef int apr_socklen_t;
|
||||
typedef apr_uint64_t apr_ino_t;
|
||||
|
||||
#ifdef WIN64
|
||||
#define APR_SIZEOF_VOIDP 8
|
||||
#else
|
||||
#define APR_SIZEOF_VOIDP 4
|
||||
#endif
|
||||
|
||||
#if APR_SIZEOF_VOIDP == 8
|
||||
typedef apr_uint64_t apr_uintptr_t;
|
||||
#else
|
||||
typedef apr_uint32_t apr_uintptr_t;
|
||||
#endif
|
||||
|
||||
/* Are we big endian? */
|
||||
/* XXX: Fatal assumption on Alpha platforms */
|
||||
#define APR_IS_BIGENDIAN 0
|
||||
|
||||
/* Mechanisms to properly type numeric literals */
|
||||
|
||||
#ifndef __GNUC__
|
||||
#define APR_INT64_C(val) (val##i64)
|
||||
#define APR_UINT64_C(val) (val##Ui64)
|
||||
#else
|
||||
#define APR_INT64_C(val) (val##LL)
|
||||
#define APR_UINT64_C(val) (val##ULL)
|
||||
#endif
|
||||
|
||||
#ifdef INT16_MIN
|
||||
#define APR_INT16_MIN INT16_MIN
|
||||
#else
|
||||
#define APR_INT16_MIN (-0x7fff - 1)
|
||||
#endif
|
||||
|
||||
#ifdef INT16_MAX
|
||||
#define APR_INT16_MAX INT16_MAX
|
||||
#else
|
||||
#define APR_INT16_MAX (0x7fff)
|
||||
#endif
|
||||
|
||||
#ifdef UINT16_MAX
|
||||
#define APR_UINT16_MAX UINT16_MAX
|
||||
#else
|
||||
#define APR_UINT16_MAX (0xffff)
|
||||
#endif
|
||||
|
||||
#ifdef INT32_MIN
|
||||
#define APR_INT32_MIN INT32_MIN
|
||||
#else
|
||||
#define APR_INT32_MIN (-0x7fffffff - 1)
|
||||
#endif
|
||||
|
||||
#ifdef INT32_MAX
|
||||
#define APR_INT32_MAX INT32_MAX
|
||||
#else
|
||||
#define APR_INT32_MAX 0x7fffffff
|
||||
#endif
|
||||
|
||||
#ifdef UINT32_MAX
|
||||
#define APR_UINT32_MAX UINT32_MAX
|
||||
#else
|
||||
#define APR_UINT32_MAX (0xffffffffU)
|
||||
#endif
|
||||
|
||||
#ifdef INT64_MIN
|
||||
#define APR_INT64_MIN INT64_MIN
|
||||
#else
|
||||
#define APR_INT64_MIN (APR_INT64_C(-0x7fffffffffffffff) - 1)
|
||||
#endif
|
||||
|
||||
#ifdef INT64_MAX
|
||||
#define APR_INT64_MAX INT64_MAX
|
||||
#else
|
||||
#define APR_INT64_MAX APR_INT64_C(0x7fffffffffffffff)
|
||||
#endif
|
||||
|
||||
#ifdef UINT64_MAX
|
||||
#define APR_UINT64_MAX UINT64_MAX
|
||||
#else
|
||||
#define APR_UINT64_MAX APR_UINT64_C(0xffffffffffffffff)
|
||||
#endif
|
||||
|
||||
#define APR_SIZE_MAX (~((apr_size_t)0))
|
||||
|
||||
/* Definitions that APR programs need to work properly. */
|
||||
|
||||
/**
|
||||
* APR public API wrap for C++ compilers.
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
#define APR_BEGIN_DECLS extern "C" {
|
||||
#define APR_END_DECLS }
|
||||
#else
|
||||
#define APR_BEGIN_DECLS
|
||||
#define APR_END_DECLS
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Thread callbacks from APR functions must be declared with APR_THREAD_FUNC,
|
||||
* so that they follow the platform's calling convention.
|
||||
* <PRE>
|
||||
*
|
||||
* void* APR_THREAD_FUNC my_thread_entry_fn(apr_thread_t *thd, void *data);
|
||||
*
|
||||
* </PRE>
|
||||
*/
|
||||
#define APR_THREAD_FUNC __stdcall
|
||||
|
||||
|
||||
#if defined(DOXYGEN) || !defined(WIN32)
|
||||
|
||||
/**
|
||||
* The public APR functions are declared with APR_DECLARE(), so they may
|
||||
* use the most appropriate calling convention. Public APR functions with
|
||||
* variable arguments must use APR_DECLARE_NONSTD().
|
||||
*
|
||||
* @remark Both the declaration and implementations must use the same macro.
|
||||
*
|
||||
* <PRE>
|
||||
* APR_DECLARE(rettype) apr_func(args)
|
||||
* </PRE>
|
||||
* @see APR_DECLARE_NONSTD @see APR_DECLARE_DATA
|
||||
* @remark Note that when APR compiles the library itself, it passes the
|
||||
* symbol -DAPR_DECLARE_EXPORT to the compiler on some platforms (e.g. Win32)
|
||||
* to export public symbols from the dynamic library build.\n
|
||||
* The user must define the APR_DECLARE_STATIC when compiling to target
|
||||
* the static APR library on some platforms (e.g. Win32.) The public symbols
|
||||
* are neither exported nor imported when APR_DECLARE_STATIC is defined.\n
|
||||
* By default, compiling an application and including the APR public
|
||||
* headers, without defining APR_DECLARE_STATIC, will prepare the code to be
|
||||
* linked to the dynamic library.
|
||||
*/
|
||||
#define APR_DECLARE(type) type
|
||||
|
||||
/**
|
||||
* The public APR functions using variable arguments are declared with
|
||||
* APR_DECLARE_NONSTD(), as they must follow the C language calling convention.
|
||||
* @see APR_DECLARE @see APR_DECLARE_DATA
|
||||
* @remark Both the declaration and implementations must use the same macro.
|
||||
* <PRE>
|
||||
*
|
||||
* APR_DECLARE_NONSTD(rettype) apr_func(args, ...);
|
||||
*
|
||||
* </PRE>
|
||||
*/
|
||||
#define APR_DECLARE_NONSTD(type) type
|
||||
|
||||
/**
|
||||
* The public APR variables are declared with AP_MODULE_DECLARE_DATA.
|
||||
* This assures the appropriate indirection is invoked at compile time.
|
||||
* @see APR_DECLARE @see APR_DECLARE_NONSTD
|
||||
* @remark Note that the declaration and implementations use different forms,
|
||||
* but both must include the macro.
|
||||
*
|
||||
* <PRE>
|
||||
*
|
||||
* extern APR_DECLARE_DATA type apr_variable;\n
|
||||
* APR_DECLARE_DATA type apr_variable = value;
|
||||
*
|
||||
* </PRE>
|
||||
*/
|
||||
#define APR_DECLARE_DATA
|
||||
|
||||
#elif defined(APR_DECLARE_STATIC)
|
||||
#define APR_DECLARE(type) type __stdcall
|
||||
#define APR_DECLARE_NONSTD(type) type __cdecl
|
||||
#define APR_DECLARE_DATA
|
||||
#elif defined(APR_DECLARE_EXPORT)
|
||||
#define APR_DECLARE(type) __declspec(dllexport) type __stdcall
|
||||
#define APR_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl
|
||||
#define APR_DECLARE_DATA __declspec(dllexport)
|
||||
#else
|
||||
#define APR_DECLARE(type) __declspec(dllimport) type __stdcall
|
||||
#define APR_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl
|
||||
#define APR_DECLARE_DATA __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#ifdef WIN64
|
||||
#define APR_SSIZE_T_FMT "I64d"
|
||||
#define APR_SIZE_T_FMT "I64u"
|
||||
#else
|
||||
#define APR_SSIZE_T_FMT "d"
|
||||
#define APR_SIZE_T_FMT "u"
|
||||
#endif
|
||||
|
||||
#if APR_HAS_LARGE_FILES
|
||||
#define APR_OFF_T_FMT "I64d"
|
||||
#else
|
||||
#define APR_OFF_T_FMT "d"
|
||||
#endif
|
||||
|
||||
#define APR_PID_T_FMT "d"
|
||||
|
||||
#define APR_INT64_T_FMT "I64d"
|
||||
#define APR_UINT64_T_FMT "I64u"
|
||||
#define APR_UINT64_T_HEX_FMT "I64x"
|
||||
|
||||
/* No difference between PROC and GLOBAL mutex */
|
||||
#define APR_PROC_MUTEX_IS_GLOBAL 1
|
||||
|
||||
/* Local machine definition for console and log output. */
|
||||
#define APR_EOL_STR "\r\n"
|
||||
|
||||
typedef int apr_wait_t;
|
||||
|
||||
#if APR_HAS_UNICODE_FS
|
||||
/* An arbitrary size that is digestable. True max is a bit less than 32000 */
|
||||
#define APR_PATH_MAX 8192
|
||||
#else /* !APR_HAS_UNICODE_FS */
|
||||
#define APR_PATH_MAX MAX_PATH
|
||||
#endif
|
||||
|
||||
#define APR_DSOPATH "PATH"
|
||||
|
||||
/** @} */
|
||||
|
||||
/* Definitions that only Win32 programs need to compile properly. */
|
||||
|
||||
/* XXX These simply don't belong here, perhaps in apr_portable.h
|
||||
* based on some APR_HAVE_PID/GID/UID?
|
||||
*/
|
||||
#ifndef __GNUC__
|
||||
typedef int pid_t;
|
||||
#endif
|
||||
typedef int uid_t;
|
||||
typedef int gid_t;
|
||||
|
||||
/* Win32 .h ommissions we really need */
|
||||
#define STDIN_FILENO 0
|
||||
#define STDOUT_FILENO 1
|
||||
#define STDERR_FILENO 2
|
||||
|
||||
#if APR_HAVE_IPV6
|
||||
|
||||
/* Appears in later flavors, not the originals. */
|
||||
#ifndef in_addr6
|
||||
#define in6_addr in_addr6
|
||||
#endif
|
||||
|
||||
#ifndef WS2TCPIP_INLINE
|
||||
#define IN6_IS_ADDR_V4MAPPED(a) \
|
||||
( (*(const apr_uint64_t *)(const void *)(&(a)->s6_addr[0]) == 0) \
|
||||
&& (*(const apr_uint32_t *)(const void *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff)))
|
||||
#endif
|
||||
|
||||
#endif /* APR_HAS_IPV6 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Done with badly written headers
|
||||
*/
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1200
|
||||
#pragma warning(pop)
|
||||
#pragma warning(disable: 4996)
|
||||
#endif
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
#endif /* APR_H */
|
160
include/apr_allocator.h
Normal file
160
include/apr_allocator.h
Normal file
@ -0,0 +1,160 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_ALLOCATOR_H
|
||||
#define APR_ALLOCATOR_H
|
||||
|
||||
/**
|
||||
* @file apr_allocator.h
|
||||
* @brief APR Internal Memory Allocation
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_errno.h"
|
||||
#define APR_WANT_MEMFUNC /**< For no good reason? */
|
||||
#include "apr_want.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup apr_allocator Internal Memory Allocation
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** the allocator structure */
|
||||
typedef struct apr_allocator_t apr_allocator_t;
|
||||
/** the structure which holds information about the allocation */
|
||||
typedef struct apr_memnode_t apr_memnode_t;
|
||||
|
||||
/** basic memory node structure
|
||||
* @note The next, ref and first_avail fields are available for use by the
|
||||
* caller of apr_allocator_alloc(), the remaining fields are read-only.
|
||||
* The next field has to be used with caution and sensibly set when the
|
||||
* memnode is passed back to apr_allocator_free(). See apr_allocator_free()
|
||||
* for details.
|
||||
* The ref and first_avail fields will be properly restored by
|
||||
* apr_allocator_free().
|
||||
*/
|
||||
struct apr_memnode_t {
|
||||
apr_memnode_t *next; /**< next memnode */
|
||||
apr_memnode_t **ref; /**< reference to self */
|
||||
apr_uint32_t index; /**< size */
|
||||
apr_uint32_t free_index; /**< how much free */
|
||||
char *first_avail; /**< pointer to first free memory */
|
||||
char *endp; /**< pointer to end of free memory */
|
||||
};
|
||||
|
||||
/** The base size of a memory node - aligned. */
|
||||
#define APR_MEMNODE_T_SIZE APR_ALIGN_DEFAULT(sizeof(apr_memnode_t))
|
||||
|
||||
/** Symbolic constants */
|
||||
#define APR_ALLOCATOR_MAX_FREE_UNLIMITED 0
|
||||
|
||||
/**
|
||||
* Create a new allocator
|
||||
* @param allocator The allocator we have just created.
|
||||
*
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_allocator_create(apr_allocator_t **allocator);
|
||||
|
||||
/**
|
||||
* Destroy an allocator
|
||||
* @param allocator The allocator to be destroyed
|
||||
* @remark Any memnodes not given back to the allocator prior to destroying
|
||||
* will _not_ be free()d.
|
||||
*/
|
||||
APR_DECLARE(void) apr_allocator_destroy(apr_allocator_t *allocator);
|
||||
|
||||
/**
|
||||
* Allocate a block of mem from the allocator
|
||||
* @param allocator The allocator to allocate from
|
||||
* @param size The size of the mem to allocate (excluding the
|
||||
* memnode structure)
|
||||
*/
|
||||
APR_DECLARE(apr_memnode_t *) apr_allocator_alloc(apr_allocator_t *allocator,
|
||||
apr_size_t size);
|
||||
|
||||
/**
|
||||
* Free a list of blocks of mem, giving them back to the allocator.
|
||||
* The list is typically terminated by a memnode with its next field
|
||||
* set to NULL.
|
||||
* @param allocator The allocator to give the mem back to
|
||||
* @param memnode The memory node to return
|
||||
*/
|
||||
APR_DECLARE(void) apr_allocator_free(apr_allocator_t *allocator,
|
||||
apr_memnode_t *memnode);
|
||||
|
||||
#include "apr_pools.h"
|
||||
|
||||
/**
|
||||
* Set the owner of the allocator
|
||||
* @param allocator The allocator to set the owner for
|
||||
* @param pool The pool that is to own the allocator
|
||||
* @remark Typically pool is the highest level pool using the allocator
|
||||
*/
|
||||
/*
|
||||
* XXX: see if we can come up with something a bit better. Currently
|
||||
* you can make a pool an owner, but if the pool doesn't use the allocator
|
||||
* the allocator will never be destroyed.
|
||||
*/
|
||||
APR_DECLARE(void) apr_allocator_owner_set(apr_allocator_t *allocator,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Get the current owner of the allocator
|
||||
* @param allocator The allocator to get the owner from
|
||||
*/
|
||||
APR_DECLARE(apr_pool_t *) apr_allocator_owner_get(apr_allocator_t *allocator);
|
||||
|
||||
/**
|
||||
* Set the current threshold at which the allocator should start
|
||||
* giving blocks back to the system.
|
||||
* @param allocator The allocator the set the threshold on
|
||||
* @param size The threshold. 0 == unlimited.
|
||||
*/
|
||||
APR_DECLARE(void) apr_allocator_max_free_set(apr_allocator_t *allocator,
|
||||
apr_size_t size);
|
||||
|
||||
#include "apr_thread_mutex.h"
|
||||
|
||||
#if APR_HAS_THREADS
|
||||
/**
|
||||
* Set a mutex for the allocator to use
|
||||
* @param allocator The allocator to set the mutex for
|
||||
* @param mutex The mutex
|
||||
*/
|
||||
APR_DECLARE(void) apr_allocator_mutex_set(apr_allocator_t *allocator,
|
||||
apr_thread_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Get the mutex currently set for the allocator
|
||||
* @param allocator The allocator
|
||||
*/
|
||||
APR_DECLARE(apr_thread_mutex_t *) apr_allocator_mutex_get(
|
||||
apr_allocator_t *allocator);
|
||||
|
||||
#endif /* APR_HAS_THREADS */
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !APR_ALLOCATOR_H */
|
140
include/apr_atomic.h
Normal file
140
include/apr_atomic.h
Normal file
@ -0,0 +1,140 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_ATOMIC_H
|
||||
#define APR_ATOMIC_H
|
||||
|
||||
/**
|
||||
* @file apr_atomic.h
|
||||
* @brief APR Atomic Operations
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup apr_atomic Atomic Operations
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* this function is required on some platforms to initialize the
|
||||
* atomic operation's internal structures
|
||||
* @param p pool
|
||||
* @return APR_SUCCESS on successful completion
|
||||
* @remark Programs do NOT need to call this directly. APR will call this
|
||||
* automatically from apr_initialize.
|
||||
* @internal
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p);
|
||||
|
||||
/*
|
||||
* Atomic operations on 32-bit values
|
||||
* Note: Each of these functions internally implements a memory barrier
|
||||
* on platforms that require it
|
||||
*/
|
||||
|
||||
/**
|
||||
* atomically read an apr_uint32_t from memory
|
||||
* @param mem the pointer
|
||||
*/
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem);
|
||||
|
||||
/**
|
||||
* atomically set an apr_uint32_t in memory
|
||||
* @param mem pointer to the object
|
||||
* @param val value that the object will assume
|
||||
*/
|
||||
APR_DECLARE(void) apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val);
|
||||
|
||||
/**
|
||||
* atomically add 'val' to an apr_uint32_t
|
||||
* @param mem pointer to the object
|
||||
* @param val amount to add
|
||||
* @return old value pointed to by mem
|
||||
*/
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val);
|
||||
|
||||
/**
|
||||
* atomically subtract 'val' from an apr_uint32_t
|
||||
* @param mem pointer to the object
|
||||
* @param val amount to subtract
|
||||
*/
|
||||
APR_DECLARE(void) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val);
|
||||
|
||||
/**
|
||||
* atomically increment an apr_uint32_t by 1
|
||||
* @param mem pointer to the object
|
||||
* @return old value pointed to by mem
|
||||
*/
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_inc32(volatile apr_uint32_t *mem);
|
||||
|
||||
/**
|
||||
* atomically decrement an apr_uint32_t by 1
|
||||
* @param mem pointer to the atomic value
|
||||
* @return zero if the value becomes zero on decrement, otherwise non-zero
|
||||
*/
|
||||
APR_DECLARE(int) apr_atomic_dec32(volatile apr_uint32_t *mem);
|
||||
|
||||
/**
|
||||
* compare an apr_uint32_t's value with 'cmp'.
|
||||
* If they are the same swap the value with 'with'
|
||||
* @param mem pointer to the value
|
||||
* @param with what to swap it with
|
||||
* @param cmp the value to compare it to
|
||||
* @return the old value of *mem
|
||||
*/
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t with,
|
||||
apr_uint32_t cmp);
|
||||
|
||||
/**
|
||||
* exchange an apr_uint32_t's value with 'val'.
|
||||
* @param mem pointer to the value
|
||||
* @param val what to swap it with
|
||||
* @return the old value of *mem
|
||||
*/
|
||||
APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val);
|
||||
|
||||
/**
|
||||
* compare the pointer's value with cmp.
|
||||
* If they are the same swap the value with 'with'
|
||||
* @param mem pointer to the pointer
|
||||
* @param with what to swap it with
|
||||
* @param cmp the value to compare it to
|
||||
* @return the old value of the pointer
|
||||
*/
|
||||
APR_DECLARE(void*) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp);
|
||||
|
||||
/**
|
||||
* exchange a pair of pointer values
|
||||
* @param mem pointer to the pointer
|
||||
* @param with what to swap it with
|
||||
* @return the old value of the pointer
|
||||
*/
|
||||
APR_DECLARE(void*) apr_atomic_xchgptr(volatile void **mem, void *with);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !APR_ATOMIC_H */
|
94
include/apr_dso.h
Normal file
94
include/apr_dso.h
Normal file
@ -0,0 +1,94 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_DSO_DOT_H
|
||||
#define APR_DSO_DOT_H
|
||||
|
||||
/**
|
||||
* @file apr_dso.h
|
||||
* @brief APR Dynamic Object Handling Routines
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup apr_dso Dynamic Object Handling
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if APR_HAS_DSO || defined(DOXYGEN)
|
||||
|
||||
/**
|
||||
* Structure for referencing dynamic objects
|
||||
*/
|
||||
typedef struct apr_dso_handle_t apr_dso_handle_t;
|
||||
|
||||
/**
|
||||
* Structure for referencing symbols from dynamic objects
|
||||
*/
|
||||
typedef void * apr_dso_handle_sym_t;
|
||||
|
||||
/**
|
||||
* Load a DSO library.
|
||||
* @param res_handle Location to store new handle for the DSO.
|
||||
* @param path Path to the DSO library
|
||||
* @param ctx Pool to use.
|
||||
* @bug We aught to provide an alternative to RTLD_GLOBAL, which
|
||||
* is the only supported method of loading DSOs today.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle,
|
||||
const char *path, apr_pool_t *ctx);
|
||||
|
||||
/**
|
||||
* Close a DSO library.
|
||||
* @param handle handle to close.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle);
|
||||
|
||||
/**
|
||||
* Load a symbol from a DSO handle.
|
||||
* @param ressym Location to store the loaded symbol
|
||||
* @param handle handle to load the symbol from.
|
||||
* @param symname Name of the symbol to load.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym,
|
||||
apr_dso_handle_t *handle,
|
||||
const char *symname);
|
||||
|
||||
/**
|
||||
* Report more information when a DSO function fails.
|
||||
* @param dso The dso handle that has been opened
|
||||
* @param buf Location to store the dso error
|
||||
* @param bufsize The size of the provided buffer
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buf, apr_size_t bufsize);
|
||||
|
||||
#endif /* APR_HAS_DSO */
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
67
include/apr_env.h
Normal file
67
include/apr_env.h
Normal file
@ -0,0 +1,67 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_ENV_H
|
||||
#define APR_ENV_H
|
||||
/**
|
||||
* @file apr_env.h
|
||||
* @brief APR Environment functions
|
||||
*/
|
||||
#include "apr_errno.h"
|
||||
#include "apr_pools.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_env Functions for manipulating the environment
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the value of an environment variable
|
||||
* @param value the returned value, allocated from @a pool
|
||||
* @param envvar the name of the environment variable
|
||||
* @param pool where to allocate @a value and any temporary storage from
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_env_get(char **value, const char *envvar,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Set the value of an environment variable
|
||||
* @param envvar the name of the environment variable
|
||||
* @param value the value to set
|
||||
* @param pool where to allocate temporary storage from
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_env_set(const char *envvar, const char *value,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Delete a variable from the environment
|
||||
* @param envvar the name of the environment variable
|
||||
* @param pool where to allocate temporary storage from
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_env_delete(const char *envvar, apr_pool_t *pool);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_ENV_H */
|
1315
include/apr_errno.h
Normal file
1315
include/apr_errno.h
Normal file
File diff suppressed because it is too large
Load Diff
428
include/apr_file_info.h
Normal file
428
include/apr_file_info.h
Normal file
@ -0,0 +1,428 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_FILE_INFO_H
|
||||
#define APR_FILE_INFO_H
|
||||
|
||||
/**
|
||||
* @file apr_file_info.h
|
||||
* @brief APR File Information
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_user.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_tables.h"
|
||||
#include "apr_time.h"
|
||||
#include "apr_errno.h"
|
||||
|
||||
#if APR_HAVE_SYS_UIO_H
|
||||
#include <sys/uio.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_file_info File Information
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Many applications use the type member to determine the
|
||||
* existance of a file or initialization of the file info,
|
||||
* so the APR_NOFILE value must be distinct from APR_UNKFILE.
|
||||
*/
|
||||
|
||||
/** apr_filetype_e values for the filetype member of the
|
||||
* apr_file_info_t structure
|
||||
* @warning: Not all of the filetypes below can be determined.
|
||||
* For example, a given platform might not correctly report
|
||||
* a socket descriptor as APR_SOCK if that type isn't
|
||||
* well-identified on that platform. In such cases where
|
||||
* a filetype exists but cannot be described by the recognized
|
||||
* flags below, the filetype will be APR_UNKFILE. If the
|
||||
* filetype member is not determined, the type will be APR_NOFILE.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
APR_NOFILE = 0, /**< no file type determined */
|
||||
APR_REG, /**< a regular file */
|
||||
APR_DIR, /**< a directory */
|
||||
APR_CHR, /**< a character device */
|
||||
APR_BLK, /**< a block device */
|
||||
APR_PIPE, /**< a FIFO / pipe */
|
||||
APR_LNK, /**< a symbolic link */
|
||||
APR_SOCK, /**< a [unix domain] socket */
|
||||
APR_UNKFILE = 127 /**< a file of some other unknown type */
|
||||
} apr_filetype_e;
|
||||
|
||||
/**
|
||||
* @defgroup apr_file_permissions File Permissions flags
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define APR_FPROT_USETID 0x8000 /**< Set user id */
|
||||
#define APR_FPROT_UREAD 0x0400 /**< Read by user */
|
||||
#define APR_FPROT_UWRITE 0x0200 /**< Write by user */
|
||||
#define APR_FPROT_UEXECUTE 0x0100 /**< Execute by user */
|
||||
|
||||
#define APR_FPROT_GSETID 0x4000 /**< Set group id */
|
||||
#define APR_FPROT_GREAD 0x0040 /**< Read by group */
|
||||
#define APR_FPROT_GWRITE 0x0020 /**< Write by group */
|
||||
#define APR_FPROT_GEXECUTE 0x0010 /**< Execute by group */
|
||||
|
||||
#define APR_FPROT_WSTICKY 0x2000 /**< Sticky bit */
|
||||
#define APR_FPROT_WREAD 0x0004 /**< Read by others */
|
||||
#define APR_FPROT_WWRITE 0x0002 /**< Write by others */
|
||||
#define APR_FPROT_WEXECUTE 0x0001 /**< Execute by others */
|
||||
|
||||
#define APR_FPROT_OS_DEFAULT 0x0FFF /**< use OS's default permissions */
|
||||
|
||||
/* additional permission flags for apr_file_copy and apr_file_append */
|
||||
#define APR_FPROT_FILE_SOURCE_PERMS 0x1000 /**< Copy source file's permissions */
|
||||
|
||||
/* backcompat */
|
||||
#define APR_USETID APR_FPROT_USETID /**< @deprecated @see APR_FPROT_USETID */
|
||||
#define APR_UREAD APR_FPROT_UREAD /**< @deprecated @see APR_FPROT_UREAD */
|
||||
#define APR_UWRITE APR_FPROT_UWRITE /**< @deprecated @see APR_FPROT_UWRITE */
|
||||
#define APR_UEXECUTE APR_FPROT_UEXECUTE /**< @deprecated @see APR_FPROT_UEXECUTE */
|
||||
#define APR_GSETID APR_FPROT_GSETID /**< @deprecated @see APR_FPROT_GSETID */
|
||||
#define APR_GREAD APR_FPROT_GREAD /**< @deprecated @see APR_FPROT_GREAD */
|
||||
#define APR_GWRITE APR_FPROT_GWRITE /**< @deprecated @see APR_FPROT_GWRITE */
|
||||
#define APR_GEXECUTE APR_FPROT_GEXECUTE /**< @deprecated @see APR_FPROT_GEXECUTE */
|
||||
#define APR_WSTICKY APR_FPROT_WSTICKY /**< @deprecated @see APR_FPROT_WSTICKY */
|
||||
#define APR_WREAD APR_FPROT_WREAD /**< @deprecated @see APR_FPROT_WREAD */
|
||||
#define APR_WWRITE APR_FPROT_WWRITE /**< @deprecated @see APR_FPROT_WWRITE */
|
||||
#define APR_WEXECUTE APR_FPROT_WEXECUTE /**< @deprecated @see APR_FPROT_WEXECUTE */
|
||||
#define APR_OS_DEFAULT APR_FPROT_OS_DEFAULT /**< @deprecated @see APR_FPROT_OS_DEFAULT */
|
||||
#define APR_FILE_SOURCE_PERMS APR_FPROT_FILE_SOURCE_PERMS /**< @deprecated @see APR_FPROT_FILE_SOURCE_PERMS */
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
/**
|
||||
* Structure for referencing directories.
|
||||
*/
|
||||
typedef struct apr_dir_t apr_dir_t;
|
||||
/**
|
||||
* Structure for determining file permissions.
|
||||
*/
|
||||
typedef apr_int32_t apr_fileperms_t;
|
||||
#if (defined WIN32) || (defined NETWARE)
|
||||
/**
|
||||
* Structure for determining the device the file is on.
|
||||
*/
|
||||
typedef apr_uint32_t apr_dev_t;
|
||||
#else
|
||||
/**
|
||||
* Structure for determining the device the file is on.
|
||||
*/
|
||||
typedef dev_t apr_dev_t;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup apr_file_stat Stat Functions
|
||||
* @{
|
||||
*/
|
||||
/** file info structure */
|
||||
typedef struct apr_finfo_t apr_finfo_t;
|
||||
|
||||
#define APR_FINFO_LINK 0x00000001 /**< Stat the link not the file itself if it is a link */
|
||||
#define APR_FINFO_MTIME 0x00000010 /**< Modification Time */
|
||||
#define APR_FINFO_CTIME 0x00000020 /**< Creation or inode-changed time */
|
||||
#define APR_FINFO_ATIME 0x00000040 /**< Access Time */
|
||||
#define APR_FINFO_SIZE 0x00000100 /**< Size of the file */
|
||||
#define APR_FINFO_CSIZE 0x00000200 /**< Storage size consumed by the file */
|
||||
#define APR_FINFO_DEV 0x00001000 /**< Device */
|
||||
#define APR_FINFO_INODE 0x00002000 /**< Inode */
|
||||
#define APR_FINFO_NLINK 0x00004000 /**< Number of links */
|
||||
#define APR_FINFO_TYPE 0x00008000 /**< Type */
|
||||
#define APR_FINFO_USER 0x00010000 /**< User */
|
||||
#define APR_FINFO_GROUP 0x00020000 /**< Group */
|
||||
#define APR_FINFO_UPROT 0x00100000 /**< User protection bits */
|
||||
#define APR_FINFO_GPROT 0x00200000 /**< Group protection bits */
|
||||
#define APR_FINFO_WPROT 0x00400000 /**< World protection bits */
|
||||
#define APR_FINFO_ICASE 0x01000000 /**< if dev is case insensitive */
|
||||
#define APR_FINFO_NAME 0x02000000 /**< ->name in proper case */
|
||||
|
||||
#define APR_FINFO_MIN 0x00008170 /**< type, mtime, ctime, atime, size */
|
||||
#define APR_FINFO_IDENT 0x00003000 /**< dev and inode */
|
||||
#define APR_FINFO_OWNER 0x00030000 /**< user and group */
|
||||
#define APR_FINFO_PROT 0x00700000 /**< all protections */
|
||||
#define APR_FINFO_NORM 0x0073b170 /**< an atomic unix apr_stat() */
|
||||
#define APR_FINFO_DIRENT 0x02000000 /**< an atomic unix apr_dir_read() */
|
||||
|
||||
/**
|
||||
* The file information structure. This is analogous to the POSIX
|
||||
* stat structure.
|
||||
*/
|
||||
struct apr_finfo_t {
|
||||
/** Allocates memory and closes lingering handles in the specified pool */
|
||||
apr_pool_t *pool;
|
||||
/** The bitmask describing valid fields of this apr_finfo_t structure
|
||||
* including all available 'wanted' fields and potentially more */
|
||||
apr_int32_t valid;
|
||||
/** The access permissions of the file. Mimics Unix access rights. */
|
||||
apr_fileperms_t protection;
|
||||
/** The type of file. One of APR_REG, APR_DIR, APR_CHR, APR_BLK, APR_PIPE,
|
||||
* APR_LNK or APR_SOCK. If the type is undetermined, the value is APR_NOFILE.
|
||||
* If the type cannot be determined, the value is APR_UNKFILE.
|
||||
*/
|
||||
apr_filetype_e filetype;
|
||||
/** The user id that owns the file */
|
||||
apr_uid_t user;
|
||||
/** The group id that owns the file */
|
||||
apr_gid_t group;
|
||||
/** The inode of the file. */
|
||||
apr_ino_t inode;
|
||||
/** The id of the device the file is on. */
|
||||
apr_dev_t device;
|
||||
/** The number of hard links to the file. */
|
||||
apr_int32_t nlink;
|
||||
/** The size of the file */
|
||||
apr_off_t size;
|
||||
/** The storage size consumed by the file */
|
||||
apr_off_t csize;
|
||||
/** The time the file was last accessed */
|
||||
apr_time_t atime;
|
||||
/** The time the file was last modified */
|
||||
apr_time_t mtime;
|
||||
/** The time the file was created, or the inode was last changed */
|
||||
apr_time_t ctime;
|
||||
/** The pathname of the file (possibly unrooted) */
|
||||
const char *fname;
|
||||
/** The file's name (no path) in filesystem case */
|
||||
const char *name;
|
||||
/** The file's handle, if accessed (can be submitted to apr_duphandle) */
|
||||
struct apr_file_t *filehand;
|
||||
};
|
||||
|
||||
/**
|
||||
* get the specified file's stats. The file is specified by filename,
|
||||
* instead of using a pre-opened file.
|
||||
* @param finfo Where to store the information about the file, which is
|
||||
* never touched if the call fails.
|
||||
* @param fname The name of the file to stat.
|
||||
* @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_
|
||||
values
|
||||
* @param pool the pool to use to allocate the new file.
|
||||
*
|
||||
* @note If @c APR_INCOMPLETE is returned all the fields in @a finfo may
|
||||
* not be filled in, and you need to check the @c finfo->valid bitmask
|
||||
* to verify that what you're looking for is there.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname,
|
||||
apr_int32_t wanted, apr_pool_t *pool);
|
||||
|
||||
/** @} */
|
||||
/**
|
||||
* @defgroup apr_dir Directory Manipulation Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Open the specified directory.
|
||||
* @param new_dir The opened directory descriptor.
|
||||
* @param dirname The full path to the directory (use / on all systems)
|
||||
* @param pool The pool to use.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_dir_open(apr_dir_t **new_dir,
|
||||
const char *dirname,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* close the specified directory.
|
||||
* @param thedir the directory descriptor to close.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_dir_close(apr_dir_t *thedir);
|
||||
|
||||
/**
|
||||
* Read the next entry from the specified directory.
|
||||
* @param finfo the file info structure and filled in by apr_dir_read
|
||||
* @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_
|
||||
values
|
||||
* @param thedir the directory descriptor returned from apr_dir_open
|
||||
* @remark No ordering is guaranteed for the entries read.
|
||||
*
|
||||
* @note If @c APR_INCOMPLETE is returned all the fields in @a finfo may
|
||||
* not be filled in, and you need to check the @c finfo->valid bitmask
|
||||
* to verify that what you're looking for is there. When no more
|
||||
* entries are available, APR_ENOENT is returned.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted,
|
||||
apr_dir_t *thedir);
|
||||
|
||||
/**
|
||||
* Rewind the directory to the first entry.
|
||||
* @param thedir the directory descriptor to rewind.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_dir_rewind(apr_dir_t *thedir);
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup apr_filepath Filepath Manipulation Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Cause apr_filepath_merge to fail if addpath is above rootpath
|
||||
* @bug in APR 0.9 and 1.x, this flag's behavior is undefined
|
||||
* if the rootpath is NULL or empty. In APR 2.0 this should be
|
||||
* changed to imply NOTABSOLUTE if the rootpath is NULL or empty.
|
||||
*/
|
||||
#define APR_FILEPATH_NOTABOVEROOT 0x01
|
||||
|
||||
/** internal: Only meaningful with APR_FILEPATH_NOTABOVEROOT */
|
||||
#define APR_FILEPATH_SECUREROOTTEST 0x02
|
||||
|
||||
/** Cause apr_filepath_merge to fail if addpath is above rootpath,
|
||||
* even given a rootpath /foo/bar and an addpath ../bar/bash
|
||||
*/
|
||||
#define APR_FILEPATH_SECUREROOT 0x03
|
||||
|
||||
/** Fail apr_filepath_merge if the merged path is relative */
|
||||
#define APR_FILEPATH_NOTRELATIVE 0x04
|
||||
|
||||
/** Fail apr_filepath_merge if the merged path is absolute */
|
||||
#define APR_FILEPATH_NOTABSOLUTE 0x08
|
||||
|
||||
/** Return the file system's native path format (e.g. path delimiters
|
||||
* of ':' on MacOS9, '\' on Win32, etc.) */
|
||||
#define APR_FILEPATH_NATIVE 0x10
|
||||
|
||||
/** Resolve the true case of existing directories and file elements
|
||||
* of addpath, (resolving any aliases on Win32) and append a proper
|
||||
* trailing slash if a directory
|
||||
*/
|
||||
#define APR_FILEPATH_TRUENAME 0x20
|
||||
|
||||
/**
|
||||
* Extract the rootpath from the given filepath
|
||||
* @param rootpath the root file path returned with APR_SUCCESS or APR_EINCOMPLETE
|
||||
* @param filepath the pathname to parse for its root component
|
||||
* @param flags the desired rules to apply, from
|
||||
* <PRE>
|
||||
* APR_FILEPATH_NATIVE Use native path seperators (e.g. '\' on Win32)
|
||||
* APR_FILEPATH_TRUENAME Tests that the root exists, and makes it proper
|
||||
* </PRE>
|
||||
* @param p the pool to allocate the new path string from
|
||||
* @remark on return, filepath points to the first non-root character in the
|
||||
* given filepath. In the simplest example, given a filepath of "/foo",
|
||||
* returns the rootpath of "/" and filepath points at "foo". This is far
|
||||
* more complex on other platforms, which will canonicalize the root form
|
||||
* to a consistant format, given the APR_FILEPATH_TRUENAME flag, and also
|
||||
* test for the validity of that root (e.g., that a drive d:/ or network
|
||||
* share //machine/foovol/).
|
||||
* The function returns APR_ERELATIVE if filepath isn't rooted (an
|
||||
* error), APR_EINCOMPLETE if the root path is ambigious (but potentially
|
||||
* legitimate, e.g. "/" on Windows is incomplete because it doesn't specify
|
||||
* the drive letter), or APR_EBADPATH if the root is simply invalid.
|
||||
* APR_SUCCESS is returned if filepath is an absolute path.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_filepath_root(const char **rootpath,
|
||||
const char **filepath,
|
||||
apr_int32_t flags,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Merge additional file path onto the previously processed rootpath
|
||||
* @param newpath the merged paths returned
|
||||
* @param rootpath the root file path (NULL uses the current working path)
|
||||
* @param addpath the path to add to the root path
|
||||
* @param flags the desired APR_FILEPATH_ rules to apply when merging
|
||||
* @param p the pool to allocate the new path string from
|
||||
* @remark if the flag APR_FILEPATH_TRUENAME is given, and the addpath
|
||||
* contains wildcard characters ('*', '?') on platforms that don't support
|
||||
* such characters within filenames, the paths will be merged, but the
|
||||
* result code will be APR_EPATHWILD, and all further segments will not
|
||||
* reflect the true filenames including the wildcard and following segments.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath,
|
||||
const char *rootpath,
|
||||
const char *addpath,
|
||||
apr_int32_t flags,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Split a search path into separate components
|
||||
* @param pathelts the returned components of the search path
|
||||
* @param liststr the search path (e.g., <tt>getenv("PATH")</tt>)
|
||||
* @param p the pool to allocate the array and path components from
|
||||
* @remark empty path componenta do not become part of @a pathelts.
|
||||
* @remark the path separator in @a liststr is system specific;
|
||||
* e.g., ':' on Unix, ';' on Windows, etc.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_filepath_list_split(apr_array_header_t **pathelts,
|
||||
const char *liststr,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Merge a list of search path components into a single search path
|
||||
* @param liststr the returned search path; may be NULL if @a pathelts is empty
|
||||
* @param pathelts the components of the search path
|
||||
* @param p the pool to allocate the search path from
|
||||
* @remark emtpy strings in the source array are ignored.
|
||||
* @remark the path separator in @a liststr is system specific;
|
||||
* e.g., ':' on Unix, ';' on Windows, etc.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_filepath_list_merge(char **liststr,
|
||||
apr_array_header_t *pathelts,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Return the default file path (for relative file names)
|
||||
* @param path the default path string returned
|
||||
* @param flags optional flag APR_FILEPATH_NATIVE to retrieve the
|
||||
* default file path in os-native format.
|
||||
* @param p the pool to allocate the default path string from
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_filepath_get(char **path, apr_int32_t flags,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Set the default file path (for relative file names)
|
||||
* @param path the default path returned
|
||||
* @param p the pool to allocate any working storage
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_filepath_set(const char *path, apr_pool_t *p);
|
||||
|
||||
/** The FilePath character encoding is unknown */
|
||||
#define APR_FILEPATH_ENCODING_UNKNOWN 0
|
||||
|
||||
/** The FilePath character encoding is locale-dependent */
|
||||
#define APR_FILEPATH_ENCODING_LOCALE 1
|
||||
|
||||
/** The FilePath character encoding is UTF-8 */
|
||||
#define APR_FILEPATH_ENCODING_UTF8 2
|
||||
|
||||
/**
|
||||
* Determine the encoding used internally by the FilePath functions
|
||||
* @param style points to a variable which receives the encoding style flag
|
||||
* @param p the pool to allocate any working storage
|
||||
* @remark Use @c apr_os_locale_encoding and/or @c apr_os_default_encoding
|
||||
* to get the name of the path encoding if it's not UTF-8.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_filepath_encoding(int *style, apr_pool_t *p);
|
||||
/** @} */
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_FILE_INFO_H */
|
945
include/apr_file_io.h
Normal file
945
include/apr_file_io.h
Normal file
@ -0,0 +1,945 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_FILE_IO_H
|
||||
#define APR_FILE_IO_H
|
||||
|
||||
/**
|
||||
* @file apr_file_io.h
|
||||
* @brief APR File I/O Handling
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_time.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_file_info.h"
|
||||
#include "apr_inherit.h"
|
||||
|
||||
#define APR_WANT_STDIO /**< for SEEK_* */
|
||||
#define APR_WANT_IOVEC /**< for apr_file_writev */
|
||||
#include "apr_want.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_file_io File I/O Handling Functions
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup apr_file_open_flags File Open Flags/Routines
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* Note to implementors: Values in the range 0x00100000--0x80000000
|
||||
are reserved for platform-specific values. */
|
||||
|
||||
#define APR_FOPEN_READ 0x00001 /**< Open the file for reading */
|
||||
#define APR_FOPEN_WRITE 0x00002 /**< Open the file for writing */
|
||||
#define APR_FOPEN_CREATE 0x00004 /**< Create the file if not there */
|
||||
#define APR_FOPEN_APPEND 0x00008 /**< Append to the end of the file */
|
||||
#define APR_FOPEN_TRUNCATE 0x00010 /**< Open the file and truncate
|
||||
to 0 length */
|
||||
#define APR_FOPEN_BINARY 0x00020 /**< Open the file in binary mode */
|
||||
#define APR_FOPEN_EXCL 0x00040 /**< Open should fail if APR_CREATE
|
||||
and file exists. */
|
||||
#define APR_FOPEN_BUFFERED 0x00080 /**< Open the file for buffered I/O */
|
||||
#define APR_FOPEN_DELONCLOSE 0x00100 /**< Delete the file after close */
|
||||
#define APR_FOPEN_XTHREAD 0x00200 /**< Platform dependent tag to open
|
||||
the file for use across multiple
|
||||
threads */
|
||||
#define APR_FOPEN_SHARELOCK 0x00400 /**< Platform dependent support for
|
||||
higher level locked read/write
|
||||
access to support writes across
|
||||
process/machines */
|
||||
#define APR_FOPEN_NOCLEANUP 0x00800 /**< Do not register a cleanup
|
||||
when the file is opened */
|
||||
#define APR_FOPEN_SENDFILE_ENABLED 0x01000 /**< Advisory flag that this
|
||||
file should support
|
||||
apr_socket_sendfile operation */
|
||||
#define APR_FOPEN_LARGEFILE 0x04000 /**< Platform dependent flag to enable
|
||||
* large file support, see WARNING below
|
||||
*/
|
||||
#define APR_FOPEN_SPARSE 0x08000 /**< Platform dependent flag to enable
|
||||
* sparse file support, see WARNING below
|
||||
*/
|
||||
|
||||
/* backcompat */
|
||||
#define APR_READ APR_FOPEN_READ /**< @deprecated @see APR_FOPEN_READ */
|
||||
#define APR_WRITE APR_FOPEN_WRITE /**< @deprecated @see APR_FOPEN_WRITE */
|
||||
#define APR_CREATE APR_FOPEN_CREATE /**< @deprecated @see APR_FOPEN_CREATE */
|
||||
#define APR_APPEND APR_FOPEN_APPEND /**< @deprecated @see APR_FOPEN_APPEND */
|
||||
#define APR_TRUNCATE APR_FOPEN_TRUNCATE /**< @deprecated @see APR_FOPEN_TRUNCATE */
|
||||
#define APR_BINARY APR_FOPEN_BINARY /**< @deprecated @see APR_FOPEN_BINARY */
|
||||
#define APR_EXCL APR_FOPEN_EXCL /**< @deprecated @see APR_FOPEN_EXCL */
|
||||
#define APR_BUFFERED APR_FOPEN_BUFFERED /**< @deprecated @see APR_FOPEN_BUFFERED */
|
||||
#define APR_DELONCLOSE APR_FOPEN_DELONCLOSE /**< @deprecated @see APR_FOPEN_DELONCLOSE */
|
||||
#define APR_XTHREAD APR_FOPEN_XTHREAD /**< @deprecated @see APR_FOPEN_XTHREAD */
|
||||
#define APR_SHARELOCK APR_FOPEN_SHARELOCK /**< @deprecated @see APR_FOPEN_SHARELOCK */
|
||||
#define APR_FILE_NOCLEANUP APR_FOPEN_NOCLEANUP /**< @deprecated @see APR_FOPEN_NOCLEANUP */
|
||||
#define APR_SENDFILE_ENABLED APR_FOPEN_SENDFILE_ENABLED /**< @deprecated @see APR_FOPEN_SENDFILE_ENABLED */
|
||||
#define APR_LARGEFILE APR_FOPEN_LARGEFILE /**< @deprecated @see APR_FOPEN_LARGEFILE */
|
||||
|
||||
/** @warning APR_FOPEN_LARGEFILE flag only has effect on some
|
||||
* platforms where sizeof(apr_off_t) == 4. Where implemented, it
|
||||
* allows opening and writing to a file which exceeds the size which
|
||||
* can be represented by apr_off_t (2 gigabytes). When a file's size
|
||||
* does exceed 2Gb, apr_file_info_get() will fail with an error on the
|
||||
* descriptor, likewise apr_stat()/apr_lstat() will fail on the
|
||||
* filename. apr_dir_read() will fail with APR_INCOMPLETE on a
|
||||
* directory entry for a large file depending on the particular
|
||||
* APR_FINFO_* flags. Generally, it is not recommended to use this
|
||||
* flag.
|
||||
*
|
||||
* @warning APR_FOPEN_SPARSE may, depending on platform, convert a
|
||||
* normal file to a sparse file. Some applications may be unable
|
||||
* to decipher a sparse file, so it's critical that the sparse file
|
||||
* flag should only be used for files accessed only by APR or other
|
||||
* applications known to be able to decipher them. APR does not
|
||||
* guarantee that it will compress the file into sparse segments
|
||||
* if it was previously created and written without the sparse flag.
|
||||
* On platforms which do not understand, or on file systems which
|
||||
* cannot handle sparse files, the flag is ignored by apr_file_open().
|
||||
*/
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup apr_file_seek_flags File Seek Flags
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* flags for apr_file_seek */
|
||||
/** Set the file position */
|
||||
#define APR_SET SEEK_SET
|
||||
/** Current */
|
||||
#define APR_CUR SEEK_CUR
|
||||
/** Go to end of file */
|
||||
#define APR_END SEEK_END
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup apr_file_attrs_set_flags File Attribute Flags
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* flags for apr_file_attrs_set */
|
||||
#define APR_FILE_ATTR_READONLY 0x01 /**< File is read-only */
|
||||
#define APR_FILE_ATTR_EXECUTABLE 0x02 /**< File is executable */
|
||||
#define APR_FILE_ATTR_HIDDEN 0x04 /**< File is hidden */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup apr_file_writev{_full} max iovec size
|
||||
* @{
|
||||
*/
|
||||
#if defined(DOXYGEN)
|
||||
#define APR_MAX_IOVEC_SIZE 1024 /**< System dependent maximum
|
||||
size of an iovec array */
|
||||
#elif defined(IOV_MAX)
|
||||
#define APR_MAX_IOVEC_SIZE IOV_MAX
|
||||
#elif defined(MAX_IOVEC)
|
||||
#define APR_MAX_IOVEC_SIZE MAX_IOVEC
|
||||
#else
|
||||
#define APR_MAX_IOVEC_SIZE 1024
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
/** File attributes */
|
||||
typedef apr_uint32_t apr_fileattrs_t;
|
||||
|
||||
/** Type to pass as whence argument to apr_file_seek. */
|
||||
typedef int apr_seek_where_t;
|
||||
|
||||
/**
|
||||
* Structure for referencing files.
|
||||
*/
|
||||
typedef struct apr_file_t apr_file_t;
|
||||
|
||||
/* File lock types/flags */
|
||||
/**
|
||||
* @defgroup apr_file_lock_types File Lock Types
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define APR_FLOCK_SHARED 1 /**< Shared lock. More than one process
|
||||
or thread can hold a shared lock
|
||||
at any given time. Essentially,
|
||||
this is a "read lock", preventing
|
||||
writers from establishing an
|
||||
exclusive lock. */
|
||||
#define APR_FLOCK_EXCLUSIVE 2 /**< Exclusive lock. Only one process
|
||||
may hold an exclusive lock at any
|
||||
given time. This is analogous to
|
||||
a "write lock". */
|
||||
|
||||
#define APR_FLOCK_TYPEMASK 0x000F /**< mask to extract lock type */
|
||||
#define APR_FLOCK_NONBLOCK 0x0010 /**< do not block while acquiring the
|
||||
file lock */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* Open the specified file.
|
||||
* @param newf The opened file descriptor.
|
||||
* @param fname The full path to the file (using / on all systems)
|
||||
* @param flag Or'ed value of:
|
||||
* <PRE>
|
||||
* APR_READ open for reading
|
||||
* APR_WRITE open for writing
|
||||
* APR_CREATE create the file if not there
|
||||
* APR_APPEND file ptr is set to end prior to all writes
|
||||
* APR_TRUNCATE set length to zero if file exists
|
||||
* APR_BINARY not a text file (This flag is ignored on
|
||||
* UNIX because it has no meaning)
|
||||
* APR_BUFFERED buffer the data. Default is non-buffered
|
||||
* APR_EXCL return error if APR_CREATE and file exists
|
||||
* APR_DELONCLOSE delete the file after closing.
|
||||
* APR_XTHREAD Platform dependent tag to open the file
|
||||
* for use across multiple threads
|
||||
* APR_SHARELOCK Platform dependent support for higher
|
||||
* level locked read/write access to support
|
||||
* writes across process/machines
|
||||
* APR_FILE_NOCLEANUP Do not register a cleanup with the pool
|
||||
* passed in on the <EM>pool</EM> argument (see below).
|
||||
* The apr_os_file_t handle in apr_file_t will not
|
||||
* be closed when the pool is destroyed.
|
||||
* APR_SENDFILE_ENABLED Open with appropriate platform semantics
|
||||
* for sendfile operations. Advisory only,
|
||||
* apr_socket_sendfile does not check this flag.
|
||||
* </PRE>
|
||||
* @param perm Access permissions for file.
|
||||
* @param pool The pool to use.
|
||||
* @remark If perm is APR_OS_DEFAULT and the file is being created,
|
||||
* appropriate default permissions will be used.
|
||||
* @remark By default, the returned file descriptor will not be
|
||||
* inherited by child processes created by apr_proc_create(). This
|
||||
* can be changed using apr_file_inherit_set().
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **newf, const char *fname,
|
||||
apr_int32_t flag, apr_fileperms_t perm,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Close the specified file.
|
||||
* @param file The file descriptor to close.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_close(apr_file_t *file);
|
||||
|
||||
/**
|
||||
* Delete the specified file.
|
||||
* @param path The full path to the file (using / on all systems)
|
||||
* @param pool The pool to use.
|
||||
* @remark If the file is open, it won't be removed until all
|
||||
* instances are closed.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_remove(const char *path, apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Rename the specified file.
|
||||
* @param from_path The full path to the original file (using / on all systems)
|
||||
* @param to_path The full path to the new file (using / on all systems)
|
||||
* @param pool The pool to use.
|
||||
* @warning If a file exists at the new location, then it will be
|
||||
* overwritten. Moving files or directories across devices may not be
|
||||
* possible.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_rename(const char *from_path,
|
||||
const char *to_path,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Create a hard link to the specified file.
|
||||
* @param from_path The full path to the original file (using / on all systems)
|
||||
* @param to_path The full path to the new file (using / on all systems)
|
||||
* @remark Both files must reside on the same device.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_link(const char *from_path,
|
||||
const char *to_path);
|
||||
|
||||
/**
|
||||
* Copy the specified file to another file.
|
||||
* @param from_path The full path to the original file (using / on all systems)
|
||||
* @param to_path The full path to the new file (using / on all systems)
|
||||
* @param perms Access permissions for the new file if it is created.
|
||||
* In place of the usual or'd combination of file permissions, the
|
||||
* value APR_FILE_SOURCE_PERMS may be given, in which case the source
|
||||
* file's permissions are copied.
|
||||
* @param pool The pool to use.
|
||||
* @remark The new file does not need to exist, it will be created if required.
|
||||
* @warning If the new file already exists, its contents will be overwritten.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_copy(const char *from_path,
|
||||
const char *to_path,
|
||||
apr_fileperms_t perms,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Append the specified file to another file.
|
||||
* @param from_path The full path to the source file (use / on all systems)
|
||||
* @param to_path The full path to the destination file (use / on all systems)
|
||||
* @param perms Access permissions for the destination file if it is created.
|
||||
* In place of the usual or'd combination of file permissions, the
|
||||
* value APR_FILE_SOURCE_PERMS may be given, in which case the source
|
||||
* file's permissions are copied.
|
||||
* @param pool The pool to use.
|
||||
* @remark The new file does not need to exist, it will be created if required.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_append(const char *from_path,
|
||||
const char *to_path,
|
||||
apr_fileperms_t perms,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Are we at the end of the file
|
||||
* @param fptr The apr file we are testing.
|
||||
* @remark Returns APR_EOF if we are at the end of file, APR_SUCCESS otherwise.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_eof(apr_file_t *fptr);
|
||||
|
||||
/**
|
||||
* Open standard error as an apr file pointer.
|
||||
* @param thefile The apr file to use as stderr.
|
||||
* @param pool The pool to allocate the file out of.
|
||||
*
|
||||
* @remark The only reason that the apr_file_open_std* functions exist
|
||||
* is that you may not always have a stderr/out/in on Windows. This
|
||||
* is generally a problem with newer versions of Windows and services.
|
||||
*
|
||||
* @remark The other problem is that the C library functions generally work
|
||||
* differently on Windows and Unix. So, by using apr_file_open_std*
|
||||
* functions, you can get a handle to an APR struct that works with
|
||||
* the APR functions which are supposed to work identically on all
|
||||
* platforms.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_open_stderr(apr_file_t **thefile,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* open standard output as an apr file pointer.
|
||||
* @param thefile The apr file to use as stdout.
|
||||
* @param pool The pool to allocate the file out of.
|
||||
*
|
||||
* @remark See remarks for apr_file_open_stderr.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_open_stdout(apr_file_t **thefile,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* open standard input as an apr file pointer.
|
||||
* @param thefile The apr file to use as stdin.
|
||||
* @param pool The pool to allocate the file out of.
|
||||
*
|
||||
* @remark See remarks for apr_file_open_stderr.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_open_stdin(apr_file_t **thefile,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* open standard error as an apr file pointer, with flags.
|
||||
* @param thefile The apr file to use as stderr.
|
||||
* @param flags The flags to open the file with. Only the APR_EXCL,
|
||||
* APR_BUFFERED, APR_XTHREAD, APR_SHARELOCK,
|
||||
* APR_SENDFILE_ENABLED and APR_LARGEFILE flags should
|
||||
* be used. The APR_WRITE flag will be set unconditionally.
|
||||
* @param pool The pool to allocate the file out of.
|
||||
*
|
||||
* @remark See remarks for apr_file_open_stderr.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_open_flags_stderr(apr_file_t **thefile,
|
||||
apr_int32_t flags,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* open standard output as an apr file pointer, with flags.
|
||||
* @param thefile The apr file to use as stdout.
|
||||
* @param flags The flags to open the file with. Only the APR_EXCL,
|
||||
* APR_BUFFERED, APR_XTHREAD, APR_SHARELOCK,
|
||||
* APR_SENDFILE_ENABLED and APR_LARGEFILE flags should
|
||||
* be used. The APR_WRITE flag will be set unconditionally.
|
||||
* @param pool The pool to allocate the file out of.
|
||||
*
|
||||
* @remark See remarks for apr_file_open_stderr.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_open_flags_stdout(apr_file_t **thefile,
|
||||
apr_int32_t flags,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* open standard input as an apr file pointer, with flags.
|
||||
* @param thefile The apr file to use as stdin.
|
||||
* @param flags The flags to open the file with. Only the APR_EXCL,
|
||||
* APR_BUFFERED, APR_XTHREAD, APR_SHARELOCK,
|
||||
* APR_SENDFILE_ENABLED and APR_LARGEFILE flags should
|
||||
* be used. The APR_READ flag will be set unconditionally.
|
||||
* @param pool The pool to allocate the file out of.
|
||||
*
|
||||
* @remark See remarks for apr_file_open_stderr.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_open_flags_stdin(apr_file_t **thefile,
|
||||
apr_int32_t flags,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Read data from the specified file.
|
||||
* @param thefile The file descriptor to read from.
|
||||
* @param buf The buffer to store the data to.
|
||||
* @param nbytes On entry, the number of bytes to read; on exit, the number
|
||||
* of bytes read.
|
||||
*
|
||||
* @remark apr_file_read will read up to the specified number of
|
||||
* bytes, but never more. If there isn't enough data to fill that
|
||||
* number of bytes, all of the available data is read. The third
|
||||
* argument is modified to reflect the number of bytes read. If a
|
||||
* char was put back into the stream via ungetc, it will be the first
|
||||
* character returned.
|
||||
*
|
||||
* @remark It is not possible for both bytes to be read and an APR_EOF
|
||||
* or other error to be returned. APR_EINTR is never returned.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf,
|
||||
apr_size_t *nbytes);
|
||||
|
||||
/**
|
||||
* Write data to the specified file.
|
||||
* @param thefile The file descriptor to write to.
|
||||
* @param buf The buffer which contains the data.
|
||||
* @param nbytes On entry, the number of bytes to write; on exit, the number
|
||||
* of bytes written.
|
||||
*
|
||||
* @remark apr_file_write will write up to the specified number of
|
||||
* bytes, but never more. If the OS cannot write that many bytes, it
|
||||
* will write as many as it can. The third argument is modified to
|
||||
* reflect the * number of bytes written.
|
||||
*
|
||||
* @remark It is possible for both bytes to be written and an error to
|
||||
* be returned. APR_EINTR is never returned.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf,
|
||||
apr_size_t *nbytes);
|
||||
|
||||
/**
|
||||
* Write data from iovec array to the specified file.
|
||||
* @param thefile The file descriptor to write to.
|
||||
* @param vec The array from which to get the data to write to the file.
|
||||
* @param nvec The number of elements in the struct iovec array. This must
|
||||
* be smaller than APR_MAX_IOVEC_SIZE. If it isn't, the function
|
||||
* will fail with APR_EINVAL.
|
||||
* @param nbytes The number of bytes written.
|
||||
*
|
||||
* @remark It is possible for both bytes to be written and an error to
|
||||
* be returned. APR_EINTR is never returned.
|
||||
*
|
||||
* @remark apr_file_writev is available even if the underlying
|
||||
* operating system doesn't provide writev().
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_writev(apr_file_t *thefile,
|
||||
const struct iovec *vec,
|
||||
apr_size_t nvec, apr_size_t *nbytes);
|
||||
|
||||
/**
|
||||
* Read data from the specified file, ensuring that the buffer is filled
|
||||
* before returning.
|
||||
* @param thefile The file descriptor to read from.
|
||||
* @param buf The buffer to store the data to.
|
||||
* @param nbytes The number of bytes to read.
|
||||
* @param bytes_read If non-NULL, this will contain the number of bytes read.
|
||||
*
|
||||
* @remark apr_file_read will read up to the specified number of
|
||||
* bytes, but never more. If there isn't enough data to fill that
|
||||
* number of bytes, then the process/thread will block until it is
|
||||
* available or EOF is reached. If a char was put back into the
|
||||
* stream via ungetc, it will be the first character returned.
|
||||
*
|
||||
* @remark It is possible for both bytes to be read and an error to be
|
||||
* returned. And if *bytes_read is less than nbytes, an accompanying
|
||||
* error is _always_ returned.
|
||||
*
|
||||
* @remark APR_EINTR is never returned.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_read_full(apr_file_t *thefile, void *buf,
|
||||
apr_size_t nbytes,
|
||||
apr_size_t *bytes_read);
|
||||
|
||||
/**
|
||||
* Write data to the specified file, ensuring that all of the data is
|
||||
* written before returning.
|
||||
* @param thefile The file descriptor to write to.
|
||||
* @param buf The buffer which contains the data.
|
||||
* @param nbytes The number of bytes to write.
|
||||
* @param bytes_written If non-NULL, set to the number of bytes written.
|
||||
*
|
||||
* @remark apr_file_write will write up to the specified number of
|
||||
* bytes, but never more. If the OS cannot write that many bytes, the
|
||||
* process/thread will block until they can be written. Exceptional
|
||||
* error such as "out of space" or "pipe closed" will terminate with
|
||||
* an error.
|
||||
*
|
||||
* @remark It is possible for both bytes to be written and an error to
|
||||
* be returned. And if *bytes_written is less than nbytes, an
|
||||
* accompanying error is _always_ returned.
|
||||
*
|
||||
* @remark APR_EINTR is never returned.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_write_full(apr_file_t *thefile,
|
||||
const void *buf,
|
||||
apr_size_t nbytes,
|
||||
apr_size_t *bytes_written);
|
||||
|
||||
|
||||
/**
|
||||
* Write data from iovec array to the specified file, ensuring that all of the
|
||||
* data is written before returning.
|
||||
* @param thefile The file descriptor to write to.
|
||||
* @param vec The array from which to get the data to write to the file.
|
||||
* @param nvec The number of elements in the struct iovec array. This must
|
||||
* be smaller than APR_MAX_IOVEC_SIZE. If it isn't, the function
|
||||
* will fail with APR_EINVAL.
|
||||
* @param nbytes The number of bytes written.
|
||||
*
|
||||
* @remark apr_file_writev_full is available even if the underlying
|
||||
* operating system doesn't provide writev().
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_writev_full(apr_file_t *thefile,
|
||||
const struct iovec *vec,
|
||||
apr_size_t nvec,
|
||||
apr_size_t *nbytes);
|
||||
/**
|
||||
* Write a character into the specified file.
|
||||
* @param ch The character to write.
|
||||
* @param thefile The file descriptor to write to
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_putc(char ch, apr_file_t *thefile);
|
||||
|
||||
/**
|
||||
* Read a character from the specified file.
|
||||
* @param ch The character to read into
|
||||
* @param thefile The file descriptor to read from
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_getc(char *ch, apr_file_t *thefile);
|
||||
|
||||
/**
|
||||
* Put a character back onto a specified stream.
|
||||
* @param ch The character to write.
|
||||
* @param thefile The file descriptor to write to
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_ungetc(char ch, apr_file_t *thefile);
|
||||
|
||||
/**
|
||||
* Read a line from the specified file
|
||||
* @param str The buffer to store the string in.
|
||||
* @param len The length of the string
|
||||
* @param thefile The file descriptor to read from
|
||||
* @remark The buffer will be NUL-terminated if any characters are stored.
|
||||
* The newline at the end of the line will not be stripped.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_gets(char *str, int len,
|
||||
apr_file_t *thefile);
|
||||
|
||||
/**
|
||||
* Write the string into the specified file.
|
||||
* @param str The string to write.
|
||||
* @param thefile The file descriptor to write to
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_puts(const char *str, apr_file_t *thefile);
|
||||
|
||||
/**
|
||||
* Flush the file's buffer.
|
||||
* @param thefile The file descriptor to flush
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_flush(apr_file_t *thefile);
|
||||
|
||||
/**
|
||||
* Transfer all file modified data and metadata to disk.
|
||||
* @param thefile The file descriptor to sync
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_sync(apr_file_t *thefile);
|
||||
|
||||
/**
|
||||
* Transfer all file modified data to disk.
|
||||
* @param thefile The file descriptor to sync
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_datasync(apr_file_t *thefile);
|
||||
|
||||
/**
|
||||
* Duplicate the specified file descriptor.
|
||||
* @param new_file The structure to duplicate into.
|
||||
* @param old_file The file to duplicate.
|
||||
* @param p The pool to use for the new file.
|
||||
* @remark *new_file must point to a valid apr_file_t, or point to NULL.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_dup(apr_file_t **new_file,
|
||||
apr_file_t *old_file,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Duplicate the specified file descriptor and close the original
|
||||
* @param new_file The old file that is to be closed and reused
|
||||
* @param old_file The file to duplicate
|
||||
* @param p The pool to use for the new file
|
||||
*
|
||||
* @remark new_file MUST point at a valid apr_file_t. It cannot be NULL.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file,
|
||||
apr_file_t *old_file,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Move the specified file descriptor to a new pool
|
||||
* @param new_file Pointer in which to return the new apr_file_t
|
||||
* @param old_file The file to move
|
||||
* @param p The pool to which the descriptor is to be moved
|
||||
* @remark Unlike apr_file_dup2(), this function doesn't do an
|
||||
* OS dup() operation on the underlying descriptor; it just
|
||||
* moves the descriptor's apr_file_t wrapper to a new pool.
|
||||
* @remark The new pool need not be an ancestor of old_file's pool.
|
||||
* @remark After calling this function, old_file may not be used
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_setaside(apr_file_t **new_file,
|
||||
apr_file_t *old_file,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Give the specified apr file handle a new buffer
|
||||
* @param thefile The file handle that is to be modified
|
||||
* @param buffer The buffer
|
||||
* @param bufsize The size of the buffer
|
||||
* @remark It is possible to add a buffer to previously unbuffered
|
||||
* file handles, the APR_BUFFERED flag will be added to
|
||||
* the file handle's flags. Likewise, with buffer=NULL and
|
||||
* bufsize=0 arguments it is possible to make a previously
|
||||
* buffered file handle unbuffered.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_buffer_set(apr_file_t *thefile,
|
||||
char * buffer,
|
||||
apr_size_t bufsize);
|
||||
|
||||
/**
|
||||
* Get the size of any buffer for the specified apr file handle
|
||||
* @param thefile The file handle
|
||||
*/
|
||||
APR_DECLARE(apr_size_t) apr_file_buffer_size_get(apr_file_t *thefile);
|
||||
|
||||
/**
|
||||
* Move the read/write file offset to a specified byte within a file.
|
||||
* @param thefile The file descriptor
|
||||
* @param where How to move the pointer, one of:
|
||||
* <PRE>
|
||||
* APR_SET -- set the offset to offset
|
||||
* APR_CUR -- add the offset to the current position
|
||||
* APR_END -- add the offset to the current file size
|
||||
* </PRE>
|
||||
* @param offset The offset to move the pointer to.
|
||||
* @remark The third argument is modified to be the offset the pointer
|
||||
was actually moved to.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_seek(apr_file_t *thefile,
|
||||
apr_seek_where_t where,
|
||||
apr_off_t *offset);
|
||||
|
||||
/**
|
||||
* Create an anonymous pipe.
|
||||
* @param in The newly created pipe's file for reading.
|
||||
* @param out The newly created pipe's file for writing.
|
||||
* @param pool The pool to operate on.
|
||||
* @remark By default, the returned file descriptors will be inherited
|
||||
* by child processes created using apr_proc_create(). This can be
|
||||
* changed using apr_file_inherit_unset().
|
||||
* @bug Some platforms cannot toggle between blocking and nonblocking,
|
||||
* and when passing a pipe as a standard handle to an application which
|
||||
* does not expect it, a non-blocking stream will fluxor the client app.
|
||||
* @deprecated @see apr_file_pipe_create_ex
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in,
|
||||
apr_file_t **out,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Create an anonymous pipe which portably supports async timeout options.
|
||||
* @param in The newly created pipe's file for reading.
|
||||
* @param out The newly created pipe's file for writing.
|
||||
* @param blocking one of these values defined in apr_thread_proc.h;
|
||||
* @param pool The pool to operate on.
|
||||
* <pre>
|
||||
* APR_FULL_BLOCK
|
||||
* APR_READ_BLOCK
|
||||
* APR_WRITE_BLOCK
|
||||
* APR_FULL_NONBLOCK
|
||||
* </pre>
|
||||
* @remark By default, the returned file descriptors will be inherited
|
||||
* by child processes created using apr_proc_create(). This can be
|
||||
* changed using apr_file_inherit_unset().
|
||||
* @remark Some platforms cannot toggle between blocking and nonblocking,
|
||||
* and when passing a pipe as a standard handle to an application which
|
||||
* does not expect it, a non-blocking stream will fluxor the client app.
|
||||
* Use this function rather than apr_file_pipe_create to create pipes
|
||||
* where one or both ends require non-blocking semantics.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_pipe_create_ex(apr_file_t **in,
|
||||
apr_file_t **out,
|
||||
apr_int32_t blocking,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Create a named pipe.
|
||||
* @param filename The filename of the named pipe
|
||||
* @param perm The permissions for the newly created pipe.
|
||||
* @param pool The pool to operate on.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_namedpipe_create(const char *filename,
|
||||
apr_fileperms_t perm,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Get the timeout value for a pipe or manipulate the blocking state.
|
||||
* @param thepipe The pipe we are getting a timeout for.
|
||||
* @param timeout The current timeout value in microseconds.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_pipe_timeout_get(apr_file_t *thepipe,
|
||||
apr_interval_time_t *timeout);
|
||||
|
||||
/**
|
||||
* Set the timeout value for a pipe or manipulate the blocking state.
|
||||
* @param thepipe The pipe we are setting a timeout on.
|
||||
* @param timeout The timeout value in microseconds. Values < 0 mean wait
|
||||
* forever, 0 means do not wait at all.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_pipe_timeout_set(apr_file_t *thepipe,
|
||||
apr_interval_time_t timeout);
|
||||
|
||||
/** file (un)locking functions. */
|
||||
|
||||
/**
|
||||
* Establish a lock on the specified, open file. The lock may be advisory
|
||||
* or mandatory, at the discretion of the platform. The lock applies to
|
||||
* the file as a whole, rather than a specific range. Locks are established
|
||||
* on a per-thread/process basis; a second lock by the same thread will not
|
||||
* block.
|
||||
* @param thefile The file to lock.
|
||||
* @param type The type of lock to establish on the file.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_lock(apr_file_t *thefile, int type);
|
||||
|
||||
/**
|
||||
* Remove any outstanding locks on the file.
|
||||
* @param thefile The file to unlock.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_unlock(apr_file_t *thefile);
|
||||
|
||||
/**accessor and general file_io functions. */
|
||||
|
||||
/**
|
||||
* return the file name of the current file.
|
||||
* @param new_path The path of the file.
|
||||
* @param thefile The currently open file.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_name_get(const char **new_path,
|
||||
apr_file_t *thefile);
|
||||
|
||||
/**
|
||||
* Return the data associated with the current file.
|
||||
* @param data The user data associated with the file.
|
||||
* @param key The key to use for retrieving data associated with this file.
|
||||
* @param file The currently open file.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_data_get(void **data, const char *key,
|
||||
apr_file_t *file);
|
||||
|
||||
/**
|
||||
* Set the data associated with the current file.
|
||||
* @param file The currently open file.
|
||||
* @param data The user data to associate with the file.
|
||||
* @param key The key to use for associating data with the file.
|
||||
* @param cleanup The cleanup routine to use when the file is destroyed.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_data_set(apr_file_t *file, void *data,
|
||||
const char *key,
|
||||
apr_status_t (*cleanup)(void *));
|
||||
|
||||
/**
|
||||
* Write a string to a file using a printf format.
|
||||
* @param fptr The file to write to.
|
||||
* @param format The format string
|
||||
* @param ... The values to substitute in the format string
|
||||
* @return The number of bytes written
|
||||
*/
|
||||
APR_DECLARE_NONSTD(int) apr_file_printf(apr_file_t *fptr,
|
||||
const char *format, ...)
|
||||
__attribute__((format(printf,2,3)));
|
||||
|
||||
/**
|
||||
* set the specified file's permission bits.
|
||||
* @param fname The file (name) to apply the permissions to.
|
||||
* @param perms The permission bits to apply to the file.
|
||||
*
|
||||
* @warning Some platforms may not be able to apply all of the
|
||||
* available permission bits; APR_INCOMPLETE will be returned if some
|
||||
* permissions are specified which could not be set.
|
||||
*
|
||||
* @warning Platforms which do not implement this feature will return
|
||||
* APR_ENOTIMPL.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_perms_set(const char *fname,
|
||||
apr_fileperms_t perms);
|
||||
|
||||
/**
|
||||
* Set attributes of the specified file.
|
||||
* @param fname The full path to the file (using / on all systems)
|
||||
* @param attributes Or'd combination of
|
||||
* <PRE>
|
||||
* APR_FILE_ATTR_READONLY - make the file readonly
|
||||
* APR_FILE_ATTR_EXECUTABLE - make the file executable
|
||||
* APR_FILE_ATTR_HIDDEN - make the file hidden
|
||||
* </PRE>
|
||||
* @param attr_mask Mask of valid bits in attributes.
|
||||
* @param pool the pool to use.
|
||||
* @remark This function should be used in preference to explicit manipulation
|
||||
* of the file permissions, because the operations to provide these
|
||||
* attributes are platform specific and may involve more than simply
|
||||
* setting permission bits.
|
||||
* @warning Platforms which do not implement this feature will return
|
||||
* APR_ENOTIMPL.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname,
|
||||
apr_fileattrs_t attributes,
|
||||
apr_fileattrs_t attr_mask,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Set the mtime of the specified file.
|
||||
* @param fname The full path to the file (using / on all systems)
|
||||
* @param mtime The mtime to apply to the file.
|
||||
* @param pool The pool to use.
|
||||
* @warning Platforms which do not implement this feature will return
|
||||
* APR_ENOTIMPL.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname,
|
||||
apr_time_t mtime,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Create a new directory on the file system.
|
||||
* @param path the path for the directory to be created. (use / on all systems)
|
||||
* @param perm Permissions for the new directory.
|
||||
* @param pool the pool to use.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_dir_make(const char *path, apr_fileperms_t perm,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/** Creates a new directory on the file system, but behaves like
|
||||
* 'mkdir -p'. Creates intermediate directories as required. No error
|
||||
* will be reported if PATH already exists.
|
||||
* @param path the path for the directory to be created. (use / on all systems)
|
||||
* @param perm Permissions for the new directory.
|
||||
* @param pool the pool to use.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_dir_make_recursive(const char *path,
|
||||
apr_fileperms_t perm,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Remove directory from the file system.
|
||||
* @param path the path for the directory to be removed. (use / on all systems)
|
||||
* @param pool the pool to use.
|
||||
* @remark Removing a directory which is in-use (e.g., the current working
|
||||
* directory, or during apr_dir_read, or with an open file) is not portable.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_dir_remove(const char *path, apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* get the specified file's stats.
|
||||
* @param finfo Where to store the information about the file.
|
||||
* @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ values
|
||||
* @param thefile The file to get information about.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_info_get(apr_finfo_t *finfo,
|
||||
apr_int32_t wanted,
|
||||
apr_file_t *thefile);
|
||||
|
||||
|
||||
/**
|
||||
* Truncate the file's length to the specified offset
|
||||
* @param fp The file to truncate
|
||||
* @param offset The offset to truncate to.
|
||||
* @remark The read/write file offset is repositioned to offset.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_trunc(apr_file_t *fp, apr_off_t offset);
|
||||
|
||||
/**
|
||||
* Retrieve the flags that were passed into apr_file_open()
|
||||
* when the file was opened.
|
||||
* @return apr_int32_t the flags
|
||||
*/
|
||||
APR_DECLARE(apr_int32_t) apr_file_flags_get(apr_file_t *f);
|
||||
|
||||
/**
|
||||
* Get the pool used by the file.
|
||||
*/
|
||||
APR_POOL_DECLARE_ACCESSOR(file);
|
||||
|
||||
/**
|
||||
* Set a file to be inherited by child processes.
|
||||
*
|
||||
*/
|
||||
APR_DECLARE_INHERIT_SET(file);
|
||||
|
||||
/**
|
||||
* Unset a file from being inherited by child processes.
|
||||
*/
|
||||
APR_DECLARE_INHERIT_UNSET(file);
|
||||
|
||||
/**
|
||||
* Open a temporary file
|
||||
* @param fp The apr file to use as a temporary file.
|
||||
* @param templ The template to use when creating a temp file.
|
||||
* @param flags The flags to open the file with. If this is zero,
|
||||
* the file is opened with
|
||||
* APR_CREATE | APR_READ | APR_WRITE | APR_EXCL | APR_DELONCLOSE
|
||||
* @param p The pool to allocate the file out of.
|
||||
* @remark
|
||||
* This function generates a unique temporary file name from template.
|
||||
* The last six characters of template must be XXXXXX and these are replaced
|
||||
* with a string that makes the filename unique. Since it will be modified,
|
||||
* template must not be a string constant, but should be declared as a character
|
||||
* array.
|
||||
*
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_file_mktemp(apr_file_t **fp, char *templ,
|
||||
apr_int32_t flags, apr_pool_t *p);
|
||||
|
||||
|
||||
/**
|
||||
* Find an existing directory suitable as a temporary storage location.
|
||||
* @param temp_dir The temp directory.
|
||||
* @param p The pool to use for any necessary allocations.
|
||||
* @remark
|
||||
* This function uses an algorithm to search for a directory that an
|
||||
* an application can use for temporary storage.
|
||||
*
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_temp_dir_get(const char **temp_dir,
|
||||
apr_pool_t *p);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_FILE_IO_H */
|
149
include/apr_fnmatch.h
Normal file
149
include/apr_fnmatch.h
Normal file
@ -0,0 +1,149 @@
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS 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 REGENTS OR 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.
|
||||
*
|
||||
* @(#)fnmatch.h 8.1 (Berkeley) 6/2/93
|
||||
*/
|
||||
|
||||
/* This file has been modified by the Apache Software Foundation. */
|
||||
#ifndef _APR_FNMATCH_H_
|
||||
#define _APR_FNMATCH_H_
|
||||
|
||||
/**
|
||||
* @file apr_fnmatch.h
|
||||
* @brief APR FNMatch Functions
|
||||
*/
|
||||
|
||||
#include "apr_errno.h"
|
||||
#include "apr_tables.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup apr_fnmatch Filename Matching Functions
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define APR_FNM_NOMATCH 1 /**< Match failed. */
|
||||
|
||||
#define APR_FNM_NOESCAPE 0x01 /**< Disable backslash escaping. */
|
||||
#define APR_FNM_PATHNAME 0x02 /**< Slash must be matched by slash. */
|
||||
#define APR_FNM_PERIOD 0x04 /**< Period must be matched by period. */
|
||||
#define APR_FNM_CASE_BLIND 0x08 /**< Compare characters case-insensitively.
|
||||
* @remark This flag is an Apache addition
|
||||
*/
|
||||
|
||||
/**
|
||||
* Try to match the string to the given pattern, return APR_SUCCESS if
|
||||
* match, else return APR_FNM_NOMATCH. Note that there is no such thing as
|
||||
* an illegal pattern.
|
||||
*
|
||||
* With all flags unset, a pattern is interpreted as such:
|
||||
*
|
||||
* PATTERN: Backslash followed by any character, including another
|
||||
* backslash.<br/>
|
||||
* MATCHES: That character exactly.
|
||||
*
|
||||
* <p>
|
||||
* PATTERN: ?<br/>
|
||||
* MATCHES: Any single character.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* PATTERN: *<br/>
|
||||
* MATCHES: Any sequence of zero or more characters. (Note that multiple
|
||||
* *s in a row are equivalent to one.)
|
||||
*
|
||||
* PATTERN: Any character other than \?*[ or a \ at the end of the pattern<br/>
|
||||
* MATCHES: That character exactly. (Case sensitive.)
|
||||
*
|
||||
* PATTERN: [ followed by a class description followed by ]<br/>
|
||||
* MATCHES: A single character described by the class description.
|
||||
* (Never matches, if the class description reaches until the
|
||||
* end of the string without a ].) If the first character of
|
||||
* the class description is ^ or !, the sense of the description
|
||||
* is reversed. The rest of the class description is a list of
|
||||
* single characters or pairs of characters separated by -. Any
|
||||
* of those characters can have a backslash in front of them,
|
||||
* which is ignored; this lets you use the characters ] and -
|
||||
* in the character class, as well as ^ and ! at the
|
||||
* beginning. The pattern matches a single character if it
|
||||
* is one of the listed characters or falls into one of the
|
||||
* listed ranges (inclusive, case sensitive). Ranges with
|
||||
* the first character larger than the second are legal but
|
||||
* never match. Edge cases: [] never matches, and [^] and [!]
|
||||
* always match without consuming a character.
|
||||
*
|
||||
* Note that these patterns attempt to match the entire string, not
|
||||
* just find a substring matching the pattern.
|
||||
*
|
||||
* @param pattern The pattern to match to
|
||||
* @param strings The string we are trying to match
|
||||
* @param flags flags to use in the match. Bitwise OR of:
|
||||
* <pre>
|
||||
* APR_FNM_NOESCAPE Disable backslash escaping
|
||||
* APR_FNM_PATHNAME Slash must be matched by slash
|
||||
* APR_FNM_PERIOD Period must be matched by period
|
||||
* APR_FNM_CASE_BLIND Compare characters case-insensitively.
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_fnmatch(const char *pattern,
|
||||
const char *strings, int flags);
|
||||
|
||||
/**
|
||||
* Determine if the given pattern is a regular expression.
|
||||
* @param pattern The pattern to search for glob characters.
|
||||
* @return non-zero if pattern has any glob characters in it
|
||||
*/
|
||||
APR_DECLARE(int) apr_fnmatch_test(const char *pattern);
|
||||
|
||||
/**
|
||||
* Find all files that match a specified pattern.
|
||||
* @param pattern The pattern to use for finding files.
|
||||
* @param result Array to use when storing the results
|
||||
* @param p The pool to use.
|
||||
* @return non-zero if pattern has any glob characters in it
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_match_glob(const char *pattern,
|
||||
apr_array_header_t **result,
|
||||
apr_pool_t *p);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_APR_FNMATCH_H_ */
|
243
include/apr_general.h
Normal file
243
include/apr_general.h
Normal file
@ -0,0 +1,243 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_GENERAL_H
|
||||
#define APR_GENERAL_H
|
||||
|
||||
/**
|
||||
* @file apr_general.h
|
||||
* This is collection of oddballs that didn't fit anywhere else,
|
||||
* and might move to more appropriate headers with the release
|
||||
* of APR 1.0.
|
||||
* @brief APR Miscellaneous library routines
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
|
||||
#if APR_HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_general Miscellaneous library routines
|
||||
* @ingroup APR
|
||||
* This is collection of oddballs that didn't fit anywhere else,
|
||||
* and might move to more appropriate headers with the release
|
||||
* of APR 1.0.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** FALSE */
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
/** TRUE */
|
||||
#ifndef TRUE
|
||||
#define TRUE (!FALSE)
|
||||
#endif
|
||||
|
||||
/** a space */
|
||||
#define APR_ASCII_BLANK '\040'
|
||||
/** a carrige return */
|
||||
#define APR_ASCII_CR '\015'
|
||||
/** a line feed */
|
||||
#define APR_ASCII_LF '\012'
|
||||
/** a tab */
|
||||
#define APR_ASCII_TAB '\011'
|
||||
|
||||
/** signal numbers typedef */
|
||||
typedef int apr_signum_t;
|
||||
|
||||
/**
|
||||
* Finding offsets of elements within structures.
|
||||
* Taken from the X code... they've sweated portability of this stuff
|
||||
* so we don't have to. Sigh...
|
||||
* @param p_type pointer type name
|
||||
* @param field data field within the structure pointed to
|
||||
* @return offset
|
||||
*/
|
||||
|
||||
#if defined(CRAY) || (defined(__arm) && !defined(LINUX))
|
||||
#ifdef __STDC__
|
||||
#define APR_OFFSET(p_type,field) _Offsetof(p_type,field)
|
||||
#else
|
||||
#ifdef CRAY2
|
||||
#define APR_OFFSET(p_type,field) \
|
||||
(sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
|
||||
|
||||
#else /* !CRAY2 */
|
||||
|
||||
#define APR_OFFSET(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
|
||||
|
||||
#endif /* !CRAY2 */
|
||||
#endif /* __STDC__ */
|
||||
#else /* ! (CRAY || __arm) */
|
||||
|
||||
#define APR_OFFSET(p_type,field) \
|
||||
((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
|
||||
|
||||
#endif /* !CRAY */
|
||||
|
||||
/**
|
||||
* Finding offsets of elements within structures.
|
||||
* @param s_type structure type name
|
||||
* @param field data field within the structure
|
||||
* @return offset
|
||||
*/
|
||||
#if defined(offsetof) && !defined(__cplusplus)
|
||||
#define APR_OFFSETOF(s_type,field) offsetof(s_type,field)
|
||||
#else
|
||||
#define APR_OFFSETOF(s_type,field) APR_OFFSET(s_type*,field)
|
||||
#endif
|
||||
|
||||
#ifndef DOXYGEN
|
||||
|
||||
/* A couple of prototypes for functions in case some platform doesn't
|
||||
* have it
|
||||
*/
|
||||
#if (!APR_HAVE_STRCASECMP) && (APR_HAVE_STRICMP)
|
||||
#define strcasecmp(s1, s2) stricmp(s1, s2)
|
||||
#elif (!APR_HAVE_STRCASECMP)
|
||||
int strcasecmp(const char *a, const char *b);
|
||||
#endif
|
||||
|
||||
#if (!APR_HAVE_STRNCASECMP) && (APR_HAVE_STRNICMP)
|
||||
#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
|
||||
#elif (!APR_HAVE_STRNCASECMP)
|
||||
int strncasecmp(const char *a, const char *b, size_t n);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Alignment macros
|
||||
*/
|
||||
|
||||
/* APR_ALIGN() is only to be used to align on a power of 2 boundary */
|
||||
#define APR_ALIGN(size, boundary) \
|
||||
(((size) + ((boundary) - 1)) & ~((boundary) - 1))
|
||||
|
||||
/** Default alignment */
|
||||
#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
|
||||
|
||||
|
||||
/**
|
||||
* String and memory functions
|
||||
*/
|
||||
|
||||
/* APR_STRINGIFY is defined here, and also in apr_release.h, so wrap it */
|
||||
#ifndef APR_STRINGIFY
|
||||
/** Properly quote a value as a string in the C preprocessor */
|
||||
#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
|
||||
/** Helper macro for APR_STRINGIFY */
|
||||
#define APR_STRINGIFY_HELPER(n) #n
|
||||
#endif
|
||||
|
||||
#if (!APR_HAVE_MEMMOVE)
|
||||
#define memmove(a,b,c) bcopy(b,a,c)
|
||||
#endif
|
||||
|
||||
#if (!APR_HAVE_MEMCHR)
|
||||
void *memchr(const void *s, int c, size_t n);
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup apr_library Library initialization and termination
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Setup any APR internal data structures. This MUST be the first function
|
||||
* called for any APR library. It is safe to call apr_initialize several
|
||||
* times as long as apr_terminate is called the same number of times.
|
||||
* @remark See apr_app_initialize if this is an application, rather than
|
||||
* a library consumer of apr.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_initialize(void);
|
||||
|
||||
/**
|
||||
* Set up an application with normalized argc, argv (and optionally env) in
|
||||
* order to deal with platform-specific oddities, such as Win32 services,
|
||||
* code pages and signals. This must be the first function called for any
|
||||
* APR program.
|
||||
* @param argc Pointer to the argc that may be corrected
|
||||
* @param argv Pointer to the argv that may be corrected
|
||||
* @param env Pointer to the env that may be corrected, may be NULL
|
||||
* @remark See apr_initialize if this is a library consumer of apr.
|
||||
* Otherwise, this call is identical to apr_initialize, and must be closed
|
||||
* with a call to apr_terminate at the end of program execution.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_app_initialize(int *argc,
|
||||
char const * const * *argv,
|
||||
char const * const * *env);
|
||||
|
||||
/**
|
||||
* Tear down any APR internal data structures which aren't torn down
|
||||
* automatically. apr_terminate must be called once for every call to
|
||||
* apr_initialize() or apr_app_initialize().
|
||||
* @remark An APR program must call this function at termination once it
|
||||
* has stopped using APR services. The APR developers suggest using
|
||||
* atexit to ensure this is called. When using APR from a language
|
||||
* other than C that has problems with the calling convention, use
|
||||
* apr_terminate2() instead.
|
||||
*/
|
||||
APR_DECLARE_NONSTD(void) apr_terminate(void);
|
||||
|
||||
/**
|
||||
* Tear down any APR internal data structures which aren't torn down
|
||||
* automatically, same as apr_terminate
|
||||
* @remark An APR program must call either the apr_terminate or apr_terminate2
|
||||
* function once it it has finished using APR services. The APR
|
||||
* developers suggest using atexit(apr_terminate) to ensure this is done.
|
||||
* apr_terminate2 exists to allow non-c language apps to tear down apr,
|
||||
* while apr_terminate is recommended from c language applications.
|
||||
*/
|
||||
APR_DECLARE(void) apr_terminate2(void);
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup apr_random Random Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if APR_HAS_RANDOM || defined(DOXYGEN)
|
||||
|
||||
/* TODO: I'm not sure this is the best place to put this prototype...*/
|
||||
/**
|
||||
* Generate random bytes.
|
||||
* @param buf Buffer to fill with random bytes
|
||||
* @param length Length of buffer in bytes
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char * buf,
|
||||
apr_size_t length);
|
||||
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_GENERAL_H */
|
160
include/apr_getopt.h
Normal file
160
include/apr_getopt.h
Normal file
@ -0,0 +1,160 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_GETOPT_H
|
||||
#define APR_GETOPT_H
|
||||
|
||||
/**
|
||||
* @file apr_getopt.h
|
||||
* @brief APR Command Arguments (getopt)
|
||||
*/
|
||||
|
||||
#include "apr_pools.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_getopt Command Argument Parsing
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* An @c apr_getopt_t error callback function.
|
||||
*
|
||||
* @a arg is this @c apr_getopt_t's @c errarg member.
|
||||
*/
|
||||
typedef void (apr_getopt_err_fn_t)(void *arg, const char *err, ...);
|
||||
|
||||
/** @see apr_getopt_t */
|
||||
typedef struct apr_getopt_t apr_getopt_t;
|
||||
|
||||
/**
|
||||
* Structure to store command line argument information.
|
||||
*/
|
||||
struct apr_getopt_t {
|
||||
/** context for processing */
|
||||
apr_pool_t *cont;
|
||||
/** function to print error message (NULL == no messages) */
|
||||
apr_getopt_err_fn_t *errfn;
|
||||
/** user defined first arg to pass to error message */
|
||||
void *errarg;
|
||||
/** index into parent argv vector */
|
||||
int ind;
|
||||
/** character checked for validity */
|
||||
int opt;
|
||||
/** reset getopt */
|
||||
int reset;
|
||||
/** count of arguments */
|
||||
int argc;
|
||||
/** array of pointers to arguments */
|
||||
const char **argv;
|
||||
/** argument associated with option */
|
||||
char const* place;
|
||||
/** set to nonzero to support interleaving options with regular args */
|
||||
int interleave;
|
||||
/** start of non-option arguments skipped for interleaving */
|
||||
int skip_start;
|
||||
/** end of non-option arguments skipped for interleaving */
|
||||
int skip_end;
|
||||
};
|
||||
|
||||
/** @see apr_getopt_option_t */
|
||||
typedef struct apr_getopt_option_t apr_getopt_option_t;
|
||||
|
||||
/**
|
||||
* Structure used to describe options that getopt should search for.
|
||||
*/
|
||||
struct apr_getopt_option_t {
|
||||
/** long option name, or NULL if option has no long name */
|
||||
const char *name;
|
||||
/** option letter, or a value greater than 255 if option has no letter */
|
||||
int optch;
|
||||
/** nonzero if option takes an argument */
|
||||
int has_arg;
|
||||
/** a description of the option */
|
||||
const char *description;
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize the arguments for parsing by apr_getopt().
|
||||
* @param os The options structure created for apr_getopt()
|
||||
* @param cont The pool to operate on
|
||||
* @param argc The number of arguments to parse
|
||||
* @param argv The array of arguments to parse
|
||||
* @remark Arguments 3 and 4 are most commonly argc and argv from main(argc, argv)
|
||||
* The (*os)->errfn is initialized to fprintf(stderr... but may be overridden.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_getopt_init(apr_getopt_t **os, apr_pool_t *cont,
|
||||
int argc, const char * const *argv);
|
||||
|
||||
/**
|
||||
* Parse the options initialized by apr_getopt_init().
|
||||
* @param os The apr_opt_t structure returned by apr_getopt_init()
|
||||
* @param opts A string of characters that are acceptable options to the
|
||||
* program. Characters followed by ":" are required to have an
|
||||
* option associated
|
||||
* @param option_ch The next option character parsed
|
||||
* @param option_arg The argument following the option character:
|
||||
* @return There are four potential status values on exit. They are:
|
||||
* <PRE>
|
||||
* APR_EOF -- No more options to parse
|
||||
* APR_BADCH -- Found a bad option character
|
||||
* APR_BADARG -- No argument followed the option flag
|
||||
* APR_SUCCESS -- The next option was found.
|
||||
* </PRE>
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_getopt(apr_getopt_t *os, const char *opts,
|
||||
char *option_ch, const char **option_arg);
|
||||
|
||||
/**
|
||||
* Parse the options initialized by apr_getopt_init(), accepting long
|
||||
* options beginning with "--" in addition to single-character
|
||||
* options beginning with "-".
|
||||
* @param os The apr_getopt_t structure created by apr_getopt_init()
|
||||
* @param opts A pointer to a list of apr_getopt_option_t structures, which
|
||||
* can be initialized with { "name", optch, has_args }. has_args
|
||||
* is nonzero if the option requires an argument. A structure
|
||||
* with an optch value of 0 terminates the list.
|
||||
* @param option_ch Receives the value of "optch" from the apr_getopt_option_t
|
||||
* structure corresponding to the next option matched.
|
||||
* @param option_arg Receives the argument following the option, if any.
|
||||
* @return There are four potential status values on exit. They are:
|
||||
* <PRE>
|
||||
* APR_EOF -- No more options to parse
|
||||
* APR_BADCH -- Found a bad option character
|
||||
* APR_BADARG -- No argument followed the option flag
|
||||
* APR_SUCCESS -- The next option was found.
|
||||
* </PRE>
|
||||
* When APR_SUCCESS is returned, os->ind gives the index of the first
|
||||
* non-option argument. On error, a message will be printed to stdout unless
|
||||
* os->err is set to 0. If os->interleave is set to nonzero, options can come
|
||||
* after arguments, and os->argv will be permuted to leave non-option arguments
|
||||
* at the end (the original argv is unaffected).
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_getopt_long(apr_getopt_t *os,
|
||||
const apr_getopt_option_t *opts,
|
||||
int *option_ch,
|
||||
const char **option_arg);
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_GETOPT_H */
|
169
include/apr_global_mutex.h
Normal file
169
include/apr_global_mutex.h
Normal file
@ -0,0 +1,169 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_GLOBAL_MUTEX_H
|
||||
#define APR_GLOBAL_MUTEX_H
|
||||
|
||||
/**
|
||||
* @file apr_global_mutex.h
|
||||
* @brief APR Global Locking Routines
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_proc_mutex.h" /* only for apr_lockmech_e */
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
#if APR_PROC_MUTEX_IS_GLOBAL
|
||||
#include "apr_proc_mutex.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup APR_GlobalMutex Global Locking Routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if !APR_PROC_MUTEX_IS_GLOBAL || defined(DOXYGEN)
|
||||
|
||||
/** Opaque global mutex structure. */
|
||||
typedef struct apr_global_mutex_t apr_global_mutex_t;
|
||||
|
||||
/* Function definitions */
|
||||
|
||||
/**
|
||||
* Create and initialize a mutex that can be used to synchronize both
|
||||
* processes and threads. Note: There is considerable overhead in using
|
||||
* this API if only cross-process or cross-thread mutual exclusion is
|
||||
* required. See apr_proc_mutex.h and apr_thread_mutex.h for more
|
||||
* specialized lock routines.
|
||||
* @param mutex the memory address where the newly created mutex will be
|
||||
* stored.
|
||||
* @param fname A file name to use if the lock mechanism requires one. This
|
||||
* argument should always be provided. The lock code itself will
|
||||
* determine if it should be used.
|
||||
* @param mech The mechanism to use for the interprocess lock, if any; one of
|
||||
* <PRE>
|
||||
* APR_LOCK_FCNTL
|
||||
* APR_LOCK_FLOCK
|
||||
* APR_LOCK_SYSVSEM
|
||||
* APR_LOCK_POSIXSEM
|
||||
* APR_LOCK_PROC_PTHREAD
|
||||
* APR_LOCK_DEFAULT pick the default mechanism for the platform
|
||||
* </PRE>
|
||||
* @param pool the pool from which to allocate the mutex.
|
||||
* @warning Check APR_HAS_foo_SERIALIZE defines to see if the platform supports
|
||||
* APR_LOCK_foo. Only APR_LOCK_DEFAULT is portable.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_global_mutex_create(apr_global_mutex_t **mutex,
|
||||
const char *fname,
|
||||
apr_lockmech_e mech,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Re-open a mutex in a child process.
|
||||
* @param mutex The newly re-opened mutex structure.
|
||||
* @param fname A file name to use if the mutex mechanism requires one. This
|
||||
* argument should always be provided. The mutex code itself will
|
||||
* determine if it should be used. This filename should be the
|
||||
* same one that was passed to apr_global_mutex_create().
|
||||
* @param pool The pool to operate on.
|
||||
* @remark This function must be called to maintain portability, even
|
||||
* if the underlying lock mechanism does not require it.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_global_mutex_child_init(
|
||||
apr_global_mutex_t **mutex,
|
||||
const char *fname,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Acquire the lock for the given mutex. If the mutex is already locked,
|
||||
* the current thread will be put to sleep until the lock becomes available.
|
||||
* @param mutex the mutex on which to acquire the lock.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_global_mutex_lock(apr_global_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Attempt to acquire the lock for the given mutex. If the mutex has already
|
||||
* been acquired, the call returns immediately with APR_EBUSY. Note: it
|
||||
* is important that the APR_STATUS_IS_EBUSY(s) macro be used to determine
|
||||
* if the return value was APR_EBUSY, for portability reasons.
|
||||
* @param mutex the mutex on which to attempt the lock acquiring.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_global_mutex_trylock(apr_global_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Release the lock for the given mutex.
|
||||
* @param mutex the mutex from which to release the lock.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_global_mutex_unlock(apr_global_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Destroy the mutex and free the memory associated with the lock.
|
||||
* @param mutex the mutex to destroy.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_global_mutex_destroy(apr_global_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Return the name of the lockfile for the mutex, or NULL
|
||||
* if the mutex doesn't use a lock file
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_global_mutex_lockfile(apr_global_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Display the name of the mutex, as it relates to the actual method used
|
||||
* for the underlying apr_proc_mutex_t, if any. NULL is returned if
|
||||
* there is no underlying apr_proc_mutex_t.
|
||||
* @param mutex the name of the mutex
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_global_mutex_name(apr_global_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Get the pool used by this global_mutex.
|
||||
* @return apr_pool_t the pool
|
||||
*/
|
||||
APR_POOL_DECLARE_ACCESSOR(global_mutex);
|
||||
|
||||
#else /* APR_PROC_MUTEX_IS_GLOBAL */
|
||||
|
||||
/* Some platforms [e.g. Win32] have cross process locks that are truly
|
||||
* global locks, since there isn't the concept of cross-process locks.
|
||||
* Define these platforms in terms of an apr_proc_mutex_t.
|
||||
*/
|
||||
|
||||
#define apr_global_mutex_t apr_proc_mutex_t
|
||||
#define apr_global_mutex_create apr_proc_mutex_create
|
||||
#define apr_global_mutex_child_init apr_proc_mutex_child_init
|
||||
#define apr_global_mutex_lock apr_proc_mutex_lock
|
||||
#define apr_global_mutex_trylock apr_proc_mutex_trylock
|
||||
#define apr_global_mutex_unlock apr_proc_mutex_unlock
|
||||
#define apr_global_mutex_destroy apr_proc_mutex_destroy
|
||||
#define apr_global_mutex_lockfile apr_proc_mutex_lockfile
|
||||
#define apr_global_mutex_name apr_proc_mutex_name
|
||||
#define apr_global_mutex_pool_get apr_proc_mutex_pool_get
|
||||
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ndef APR_GLOBAL_MUTEX_H */
|
261
include/apr_hash.h
Normal file
261
include/apr_hash.h
Normal file
@ -0,0 +1,261 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_HASH_H
|
||||
#define APR_HASH_H
|
||||
|
||||
/**
|
||||
* @file apr_hash.h
|
||||
* @brief APR Hash Tables
|
||||
*/
|
||||
|
||||
#include "apr_pools.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup apr_hash Hash Tables
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* When passing a key to apr_hash_set or apr_hash_get, this value can be
|
||||
* passed to indicate a string-valued key, and have apr_hash compute the
|
||||
* length automatically.
|
||||
*
|
||||
* @remark apr_hash will use strlen(key) for the length. The NUL terminator
|
||||
* is not included in the hash value (why throw a constant in?).
|
||||
* Since the hash table merely references the provided key (rather
|
||||
* than copying it), apr_hash_this() will return the NUL-term'd key.
|
||||
*/
|
||||
#define APR_HASH_KEY_STRING (-1)
|
||||
|
||||
/**
|
||||
* Abstract type for hash tables.
|
||||
*/
|
||||
typedef struct apr_hash_t apr_hash_t;
|
||||
|
||||
/**
|
||||
* Abstract type for scanning hash tables.
|
||||
*/
|
||||
typedef struct apr_hash_index_t apr_hash_index_t;
|
||||
|
||||
/**
|
||||
* Callback functions for calculating hash values.
|
||||
* @param key The key.
|
||||
* @param klen The length of the key, or APR_HASH_KEY_STRING to use the string
|
||||
* length. If APR_HASH_KEY_STRING then returns the actual key length.
|
||||
*/
|
||||
typedef unsigned int (*apr_hashfunc_t)(const char *key, apr_ssize_t *klen);
|
||||
|
||||
/**
|
||||
* The default hash function.
|
||||
*/
|
||||
APR_DECLARE_NONSTD(unsigned int) apr_hashfunc_default(const char *key,
|
||||
apr_ssize_t *klen);
|
||||
|
||||
/**
|
||||
* Create a hash table.
|
||||
* @param pool The pool to allocate the hash table out of
|
||||
* @return The hash table just created
|
||||
*/
|
||||
APR_DECLARE(apr_hash_t *) apr_hash_make(apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Create a hash table with a custom hash function
|
||||
* @param pool The pool to allocate the hash table out of
|
||||
* @param hash_func A custom hash function.
|
||||
* @return The hash table just created
|
||||
*/
|
||||
APR_DECLARE(apr_hash_t *) apr_hash_make_custom(apr_pool_t *pool,
|
||||
apr_hashfunc_t hash_func);
|
||||
|
||||
/**
|
||||
* Make a copy of a hash table
|
||||
* @param pool The pool from which to allocate the new hash table
|
||||
* @param h The hash table to clone
|
||||
* @return The hash table just created
|
||||
* @remark Makes a shallow copy
|
||||
*/
|
||||
APR_DECLARE(apr_hash_t *) apr_hash_copy(apr_pool_t *pool,
|
||||
const apr_hash_t *h);
|
||||
|
||||
/**
|
||||
* Associate a value with a key in a hash table.
|
||||
* @param ht The hash table
|
||||
* @param key Pointer to the key
|
||||
* @param klen Length of the key. Can be APR_HASH_KEY_STRING to use the string length.
|
||||
* @param val Value to associate with the key
|
||||
* @remark If the value is NULL the hash entry is deleted.
|
||||
*/
|
||||
APR_DECLARE(void) apr_hash_set(apr_hash_t *ht, const void *key,
|
||||
apr_ssize_t klen, const void *val);
|
||||
|
||||
/**
|
||||
* Look up the value associated with a key in a hash table.
|
||||
* @param ht The hash table
|
||||
* @param key Pointer to the key
|
||||
* @param klen Length of the key. Can be APR_HASH_KEY_STRING to use the string length.
|
||||
* @return Returns NULL if the key is not present.
|
||||
*/
|
||||
APR_DECLARE(void *) apr_hash_get(apr_hash_t *ht, const void *key,
|
||||
apr_ssize_t klen);
|
||||
|
||||
/**
|
||||
* Start iterating over the entries in a hash table.
|
||||
* @param p The pool to allocate the apr_hash_index_t iterator. If this
|
||||
* pool is NULL, then an internal, non-thread-safe iterator is used.
|
||||
* @param ht The hash table
|
||||
* @return The iteration state
|
||||
* @remark There is no restriction on adding or deleting hash entries during
|
||||
* an iteration (although the results may be unpredictable unless all you do
|
||||
* is delete the current entry) and multiple iterations can be in
|
||||
* progress at the same time.
|
||||
*
|
||||
* @par Example:
|
||||
*
|
||||
* @code
|
||||
* int sum_values(apr_pool_t *p, apr_hash_t *ht)
|
||||
* {
|
||||
* apr_hash_index_t *hi;
|
||||
* void *val;
|
||||
* int sum = 0;
|
||||
* for (hi = apr_hash_first(p, ht); hi; hi = apr_hash_next(hi)) {
|
||||
* apr_hash_this(hi, NULL, NULL, &val);
|
||||
* sum += *(int *)val;
|
||||
* }
|
||||
* return sum;
|
||||
* }
|
||||
* @endcode
|
||||
*/
|
||||
APR_DECLARE(apr_hash_index_t *) apr_hash_first(apr_pool_t *p, apr_hash_t *ht);
|
||||
|
||||
/**
|
||||
* Continue iterating over the entries in a hash table.
|
||||
* @param hi The iteration state
|
||||
* @return a pointer to the updated iteration state. NULL if there are no more
|
||||
* entries.
|
||||
*/
|
||||
APR_DECLARE(apr_hash_index_t *) apr_hash_next(apr_hash_index_t *hi);
|
||||
|
||||
/**
|
||||
* Get the current entry's details from the iteration state.
|
||||
* @param hi The iteration state
|
||||
* @param key Return pointer for the pointer to the key.
|
||||
* @param klen Return pointer for the key length.
|
||||
* @param val Return pointer for the associated value.
|
||||
* @remark The return pointers should point to a variable that will be set to the
|
||||
* corresponding data, or they may be NULL if the data isn't interesting.
|
||||
*/
|
||||
APR_DECLARE(void) apr_hash_this(apr_hash_index_t *hi, const void **key,
|
||||
apr_ssize_t *klen, void **val);
|
||||
|
||||
/**
|
||||
* Get the number of key/value pairs in the hash table.
|
||||
* @param ht The hash table
|
||||
* @return The number of key/value pairs in the hash table.
|
||||
*/
|
||||
APR_DECLARE(unsigned int) apr_hash_count(apr_hash_t *ht);
|
||||
|
||||
/**
|
||||
* Clear any key/value pairs in the hash table.
|
||||
* @param ht The hash table
|
||||
*/
|
||||
APR_DECLARE(void) apr_hash_clear(apr_hash_t *ht);
|
||||
|
||||
/**
|
||||
* Merge two hash tables into one new hash table. The values of the overlay
|
||||
* hash override the values of the base if both have the same key. Both
|
||||
* hash tables must use the same hash function.
|
||||
* @param p The pool to use for the new hash table
|
||||
* @param overlay The table to add to the initial table
|
||||
* @param base The table that represents the initial values of the new table
|
||||
* @return A new hash table containing all of the data from the two passed in
|
||||
*/
|
||||
APR_DECLARE(apr_hash_t *) apr_hash_overlay(apr_pool_t *p,
|
||||
const apr_hash_t *overlay,
|
||||
const apr_hash_t *base);
|
||||
|
||||
/**
|
||||
* Merge two hash tables into one new hash table. If the same key
|
||||
* is present in both tables, call the supplied merge function to
|
||||
* produce a merged value for the key in the new table. Both
|
||||
* hash tables must use the same hash function.
|
||||
* @param p The pool to use for the new hash table
|
||||
* @param h1 The first of the tables to merge
|
||||
* @param h2 The second of the tables to merge
|
||||
* @param merger A callback function to merge values, or NULL to
|
||||
* make values from h1 override values from h2 (same semantics as
|
||||
* apr_hash_overlay())
|
||||
* @param data Client data to pass to the merger function
|
||||
* @return A new hash table containing all of the data from the two passed in
|
||||
*/
|
||||
APR_DECLARE(apr_hash_t *) apr_hash_merge(apr_pool_t *p,
|
||||
const apr_hash_t *h1,
|
||||
const apr_hash_t *h2,
|
||||
void * (*merger)(apr_pool_t *p,
|
||||
const void *key,
|
||||
apr_ssize_t klen,
|
||||
const void *h1_val,
|
||||
const void *h2_val,
|
||||
const void *data),
|
||||
const void *data);
|
||||
|
||||
/**
|
||||
* Declaration prototype for the iterator callback function of apr_hash_do().
|
||||
*
|
||||
* @param rec The data passed as the first argument to apr_hash_[v]do()
|
||||
* @param key The key from this iteration of the hash table
|
||||
* @param klen The key length from this iteration of the hash table
|
||||
* @param value The value from this iteration of the hash table
|
||||
* @remark Iteration continues while this callback function returns non-zero.
|
||||
* To export the callback function for apr_hash_do() it must be declared
|
||||
* in the _NONSTD convention.
|
||||
*/
|
||||
typedef int (apr_hash_do_callback_fn_t)(void *rec, const void *key,
|
||||
apr_ssize_t klen,
|
||||
const void *value);
|
||||
|
||||
/**
|
||||
* Iterate over a hash table running the provided function once for every
|
||||
* element in the hash table. The @param comp function will be invoked for
|
||||
* every element in the hash table.
|
||||
*
|
||||
* @param comp The function to run
|
||||
* @param rec The data to pass as the first argument to the function
|
||||
* @param ht The hash table to iterate over
|
||||
* @return FALSE if one of the comp() iterations returned zero; TRUE if all
|
||||
* iterations returned non-zero
|
||||
* @see apr_hash_do_callback_fn_t
|
||||
*/
|
||||
APR_DECLARE(int) apr_hash_do(apr_hash_do_callback_fn_t *comp,
|
||||
void *rec, const apr_hash_t *ht);
|
||||
|
||||
/**
|
||||
* Get a pointer to the pool which the hash table was created in
|
||||
*/
|
||||
APR_POOL_DECLARE_ACCESSOR(hash);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !APR_HASH_H */
|
51
include/apr_inherit.h
Normal file
51
include/apr_inherit.h
Normal file
@ -0,0 +1,51 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_INHERIT_H
|
||||
#define APR_INHERIT_H
|
||||
|
||||
/**
|
||||
* @file apr_inherit.h
|
||||
* @brief APR File Handle Inheritance Helpers
|
||||
* @remark This internal header includes internal declaration helpers
|
||||
* for other headers to declare apr_foo_inherit_[un]set functions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Prototype for type-specific declarations of apr_foo_inherit_set
|
||||
* functions.
|
||||
* @remark Doxygen unwraps this macro (via doxygen.conf) to provide
|
||||
* actual help for each specific occurance of apr_foo_inherit_set.
|
||||
* @remark the linkage is specified for APR. It would be possible to expand
|
||||
* the macros to support other linkages.
|
||||
*/
|
||||
#define APR_DECLARE_INHERIT_SET(type) \
|
||||
APR_DECLARE(apr_status_t) apr_##type##_inherit_set( \
|
||||
apr_##type##_t *the##type)
|
||||
|
||||
/**
|
||||
* Prototype for type-specific declarations of apr_foo_inherit_unset
|
||||
* functions.
|
||||
* @remark Doxygen unwraps this macro (via doxygen.conf) to provide
|
||||
* actual help for each specific occurance of apr_foo_inherit_unset.
|
||||
* @remark the linkage is specified for APR. It would be possible to expand
|
||||
* the macros to support other linkages.
|
||||
*/
|
||||
#define APR_DECLARE_INHERIT_UNSET(type) \
|
||||
APR_DECLARE(apr_status_t) apr_##type##_inherit_unset( \
|
||||
apr_##type##_t *the##type)
|
||||
|
||||
#endif /* ! APR_INHERIT_H */
|
241
include/apr_lib.h
Normal file
241
include/apr_lib.h
Normal file
@ -0,0 +1,241 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_LIB_H
|
||||
#define APR_LIB_H
|
||||
|
||||
/**
|
||||
* @file apr_lib.h
|
||||
* This is collection of oddballs that didn't fit anywhere else,
|
||||
* and might move to more appropriate headers with the release
|
||||
* of APR 1.0.
|
||||
* @brief APR general purpose library routines
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_errno.h"
|
||||
|
||||
#if APR_HAVE_CTYPE_H
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
#if APR_HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_lib General Purpose Library Routines
|
||||
* @ingroup APR
|
||||
* This is collection of oddballs that didn't fit anywhere else,
|
||||
* and might move to more appropriate headers with the release
|
||||
* of APR 1.0.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** A constant representing a 'large' string. */
|
||||
#define HUGE_STRING_LEN 8192
|
||||
|
||||
/*
|
||||
* Define the structures used by the APR general-purpose library.
|
||||
*/
|
||||
|
||||
/** @see apr_vformatter_buff_t */
|
||||
typedef struct apr_vformatter_buff_t apr_vformatter_buff_t;
|
||||
|
||||
/**
|
||||
* Structure used by the variable-formatter routines.
|
||||
*/
|
||||
struct apr_vformatter_buff_t {
|
||||
/** The current position */
|
||||
char *curpos;
|
||||
/** The end position of the format string */
|
||||
char *endpos;
|
||||
};
|
||||
|
||||
/**
|
||||
* return the final element of the pathname
|
||||
* @param pathname The path to get the final element of
|
||||
* @return the final element of the path
|
||||
* @remark
|
||||
* <PRE>
|
||||
* For example:
|
||||
* "/foo/bar/gum" -> "gum"
|
||||
* "/foo/bar/gum/" -> ""
|
||||
* "gum" -> "gum"
|
||||
* "bs\\path\\stuff" -> "stuff"
|
||||
* </PRE>
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_filepath_name_get(const char *pathname);
|
||||
|
||||
/**
|
||||
* apr_killpg
|
||||
* Small utility macros to make things easier to read. Not usually a
|
||||
* goal, to be sure..
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#define apr_killpg(x, y)
|
||||
#else /* WIN32 */
|
||||
#ifdef NO_KILLPG
|
||||
#define apr_killpg(x, y) (kill (-(x), (y)))
|
||||
#else /* NO_KILLPG */
|
||||
#define apr_killpg(x, y) (killpg ((x), (y)))
|
||||
#endif /* NO_KILLPG */
|
||||
#endif /* WIN32 */
|
||||
|
||||
/**
|
||||
* apr_vformatter() is a generic printf-style formatting routine
|
||||
* with some extensions.
|
||||
* @param flush_func The function to call when the buffer is full
|
||||
* @param c The buffer to write to
|
||||
* @param fmt The format string
|
||||
* @param ap The arguments to use to fill out the format string.
|
||||
*
|
||||
* @remark
|
||||
* <PRE>
|
||||
* The extensions are:
|
||||
*
|
||||
* %%pA takes a struct in_addr *, and prints it as a.b.c.d
|
||||
* %%pI takes an apr_sockaddr_t * and prints it as a.b.c.d:port or
|
||||
* [ipv6-address]:port
|
||||
* %%pT takes an apr_os_thread_t * and prints it in decimal
|
||||
* ('0' is printed if !APR_HAS_THREADS)
|
||||
* %%pt takes an apr_os_thread_t * and prints it in hexadecimal
|
||||
* ('0' is printed if !APR_HAS_THREADS)
|
||||
* %%pm takes an apr_status_t * and prints the appropriate error
|
||||
* string (from apr_strerror) corresponding to that error code.
|
||||
* %%pp takes a void * and outputs it in hex
|
||||
* %%pB takes a apr_uint32_t * as bytes and outputs it's apr_strfsize
|
||||
* %%pF same as above, but takes a apr_off_t *
|
||||
* %%pS same as above, but takes a apr_size_t *
|
||||
*
|
||||
* %%pA, %%pI, %%pT, %%pp are available from APR 1.0.0 onwards (and in 0.9.x).
|
||||
* %%pt is only available from APR 1.2.0 onwards.
|
||||
* %%pm, %%pB, %%pF and %%pS are only available from APR 1.3.0 onwards.
|
||||
*
|
||||
* The %%p hacks are to force gcc's printf warning code to skip
|
||||
* over a pointer argument without complaining. This does
|
||||
* mean that the ANSI-style %%p (output a void * in hex format) won't
|
||||
* work as expected at all, but that seems to be a fair trade-off
|
||||
* for the increased robustness of having printf-warnings work.
|
||||
*
|
||||
* Additionally, apr_vformatter allows for arbitrary output methods
|
||||
* using the apr_vformatter_buff and flush_func.
|
||||
*
|
||||
* The apr_vformatter_buff has two elements curpos and endpos.
|
||||
* curpos is where apr_vformatter will write the next byte of output.
|
||||
* It proceeds writing output to curpos, and updating curpos, until
|
||||
* either the end of output is reached, or curpos == endpos (i.e. the
|
||||
* buffer is full).
|
||||
*
|
||||
* If the end of output is reached, apr_vformatter returns the
|
||||
* number of bytes written.
|
||||
*
|
||||
* When the buffer is full, the flush_func is called. The flush_func
|
||||
* can return -1 to indicate that no further output should be attempted,
|
||||
* and apr_vformatter will return immediately with -1. Otherwise
|
||||
* the flush_func should flush the buffer in whatever manner is
|
||||
* appropriate, re apr_pool_t nitialize curpos and endpos, and return 0.
|
||||
*
|
||||
* Note that flush_func is only invoked as a result of attempting to
|
||||
* write another byte at curpos when curpos >= endpos. So for
|
||||
* example, it's possible when the output exactly matches the buffer
|
||||
* space available that curpos == endpos will be true when
|
||||
* apr_vformatter returns.
|
||||
*
|
||||
* apr_vformatter does not call out to any other code, it is entirely
|
||||
* self-contained. This allows the callers to do things which are
|
||||
* otherwise "unsafe". For example, apr_psprintf uses the "scratch"
|
||||
* space at the unallocated end of a block, and doesn't actually
|
||||
* complete the allocation until apr_vformatter returns. apr_psprintf
|
||||
* would be completely broken if apr_vformatter were to call anything
|
||||
* that used this same pool. Similarly http_bprintf() uses the "scratch"
|
||||
* space at the end of its output buffer, and doesn't actually note
|
||||
* that the space is in use until it either has to flush the buffer
|
||||
* or until apr_vformatter returns.
|
||||
* </PRE>
|
||||
*/
|
||||
APR_DECLARE(int) apr_vformatter(int (*flush_func)(apr_vformatter_buff_t *b),
|
||||
apr_vformatter_buff_t *c, const char *fmt,
|
||||
va_list ap);
|
||||
|
||||
/**
|
||||
* Display a prompt and read in the password from stdin.
|
||||
* @param prompt The prompt to display
|
||||
* @param pwbuf Buffer to store the password
|
||||
* @param bufsize The length of the password buffer.
|
||||
* @remark If the password entered must be truncated to fit in
|
||||
* the provided buffer, APR_ENAMETOOLONG will be returned.
|
||||
* Note that the bufsize paramater is passed by reference for no
|
||||
* reason; its value will never be modified by the apr_password_get()
|
||||
* function.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_password_get(const char *prompt, char *pwbuf,
|
||||
apr_size_t *bufsize);
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup apr_ctype ctype functions
|
||||
* These macros allow correct support of 8-bit characters on systems which
|
||||
* support 8-bit characters. Pretty dumb how the cast is required, but
|
||||
* that's legacy libc for ya. These new macros do not support EOF like
|
||||
* the standard macros do. Tough.
|
||||
* @{
|
||||
*/
|
||||
/** @see isalnum */
|
||||
#define apr_isalnum(c) (isalnum(((unsigned char)(c))))
|
||||
/** @see isalpha */
|
||||
#define apr_isalpha(c) (isalpha(((unsigned char)(c))))
|
||||
/** @see iscntrl */
|
||||
#define apr_iscntrl(c) (iscntrl(((unsigned char)(c))))
|
||||
/** @see isdigit */
|
||||
#define apr_isdigit(c) (isdigit(((unsigned char)(c))))
|
||||
/** @see isgraph */
|
||||
#define apr_isgraph(c) (isgraph(((unsigned char)(c))))
|
||||
/** @see islower*/
|
||||
#define apr_islower(c) (islower(((unsigned char)(c))))
|
||||
/** @see isascii */
|
||||
#ifdef isascii
|
||||
#define apr_isascii(c) (isascii(((unsigned char)(c))))
|
||||
#else
|
||||
#define apr_isascii(c) (((c) & ~0x7f)==0)
|
||||
#endif
|
||||
/** @see isprint */
|
||||
#define apr_isprint(c) (isprint(((unsigned char)(c))))
|
||||
/** @see ispunct */
|
||||
#define apr_ispunct(c) (ispunct(((unsigned char)(c))))
|
||||
/** @see isspace */
|
||||
#define apr_isspace(c) (isspace(((unsigned char)(c))))
|
||||
/** @see isupper */
|
||||
#define apr_isupper(c) (isupper(((unsigned char)(c))))
|
||||
/** @see isxdigit */
|
||||
#define apr_isxdigit(c) (isxdigit(((unsigned char)(c))))
|
||||
/** @see tolower */
|
||||
#define apr_tolower(c) (tolower(((unsigned char)(c))))
|
||||
/** @see toupper */
|
||||
#define apr_toupper(c) (toupper(((unsigned char)(c))))
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_LIB_H */
|
171
include/apr_mmap.h
Normal file
171
include/apr_mmap.h
Normal file
@ -0,0 +1,171 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_MMAP_H
|
||||
#define APR_MMAP_H
|
||||
|
||||
/**
|
||||
* @file apr_mmap.h
|
||||
* @brief APR MMAP routines
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_ring.h"
|
||||
#include "apr_file_io.h" /* for apr_file_t */
|
||||
|
||||
#ifdef BEOS
|
||||
#include <kernel/OS.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_mmap MMAP (Memory Map) Routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** MMap opened for reading */
|
||||
#define APR_MMAP_READ 1
|
||||
/** MMap opened for writing */
|
||||
#define APR_MMAP_WRITE 2
|
||||
|
||||
/** @see apr_mmap_t */
|
||||
typedef struct apr_mmap_t apr_mmap_t;
|
||||
|
||||
/**
|
||||
* @remark
|
||||
* As far as I can tell the only really sane way to store an MMAP is as a
|
||||
* void * and a length. BeOS requires this area_id, but that's just a little
|
||||
* something extra. I am exposing this type, because it doesn't make much
|
||||
* sense to keep it private, and opening it up makes some stuff easier in
|
||||
* Apache.
|
||||
*/
|
||||
/** The MMAP structure */
|
||||
struct apr_mmap_t {
|
||||
/** The pool the mmap structure was allocated out of. */
|
||||
apr_pool_t *cntxt;
|
||||
#ifdef BEOS
|
||||
/** An area ID. Only valid on BeOS */
|
||||
area_id area;
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
/** The handle of the file mapping */
|
||||
HANDLE mhandle;
|
||||
/** The start of the real memory page area (mapped view) */
|
||||
void *mv;
|
||||
/** The physical start, size and offset */
|
||||
apr_off_t pstart;
|
||||
apr_size_t psize;
|
||||
apr_off_t poffset;
|
||||
#endif
|
||||
/** The start of the memory mapped area */
|
||||
void *mm;
|
||||
/** The amount of data in the mmap */
|
||||
apr_size_t size;
|
||||
/** ring of apr_mmap_t's that reference the same
|
||||
* mmap'ed region; acts in place of a reference count */
|
||||
APR_RING_ENTRY(apr_mmap_t) link;
|
||||
};
|
||||
|
||||
#if APR_HAS_MMAP || defined(DOXYGEN)
|
||||
|
||||
/** @def APR_MMAP_THRESHOLD
|
||||
* Files have to be at least this big before they're mmap()d. This is to deal
|
||||
* with systems where the expense of doing an mmap() and an munmap() outweighs
|
||||
* the benefit for small files. It shouldn't be set lower than 1.
|
||||
*/
|
||||
#ifdef MMAP_THRESHOLD
|
||||
# define APR_MMAP_THRESHOLD MMAP_THRESHOLD
|
||||
#else
|
||||
# ifdef SUNOS4
|
||||
# define APR_MMAP_THRESHOLD (8*1024)
|
||||
# else
|
||||
# define APR_MMAP_THRESHOLD 1
|
||||
# endif /* SUNOS4 */
|
||||
#endif /* MMAP_THRESHOLD */
|
||||
|
||||
/** @def APR_MMAP_LIMIT
|
||||
* Maximum size of MMap region
|
||||
*/
|
||||
#ifdef MMAP_LIMIT
|
||||
# define APR_MMAP_LIMIT MMAP_LIMIT
|
||||
#else
|
||||
# define APR_MMAP_LIMIT (4*1024*1024)
|
||||
#endif /* MMAP_LIMIT */
|
||||
|
||||
/** Can this file be MMaped */
|
||||
#define APR_MMAP_CANDIDATE(filelength) \
|
||||
((filelength >= APR_MMAP_THRESHOLD) && (filelength < APR_MMAP_LIMIT))
|
||||
|
||||
/* Function definitions */
|
||||
|
||||
/**
|
||||
* Create a new mmap'ed file out of an existing APR file.
|
||||
* @param newmmap The newly created mmap'ed file.
|
||||
* @param file The file turn into an mmap.
|
||||
* @param offset The offset into the file to start the data pointer at.
|
||||
* @param size The size of the file
|
||||
* @param flag bit-wise or of:
|
||||
* <PRE>
|
||||
* APR_MMAP_READ MMap opened for reading
|
||||
* APR_MMAP_WRITE MMap opened for writing
|
||||
* </PRE>
|
||||
* @param cntxt The pool to use when creating the mmap.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_mmap_create(apr_mmap_t **newmmap,
|
||||
apr_file_t *file, apr_off_t offset,
|
||||
apr_size_t size, apr_int32_t flag,
|
||||
apr_pool_t *cntxt);
|
||||
|
||||
/**
|
||||
* Duplicate the specified MMAP.
|
||||
* @param new_mmap The structure to duplicate into.
|
||||
* @param old_mmap The mmap to duplicate.
|
||||
* @param p The pool to use for new_mmap.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_mmap_dup(apr_mmap_t **new_mmap,
|
||||
apr_mmap_t *old_mmap,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Remove a mmap'ed.
|
||||
* @param mm The mmap'ed file.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_mmap_delete(apr_mmap_t *mm);
|
||||
|
||||
/**
|
||||
* Move the pointer into the mmap'ed file to the specified offset.
|
||||
* @param addr The pointer to the offset specified.
|
||||
* @param mm The mmap'ed file.
|
||||
* @param offset The offset to move to.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_mmap_offset(void **addr, apr_mmap_t *mm,
|
||||
apr_off_t offset);
|
||||
|
||||
#endif /* APR_HAS_MMAP */
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_MMAP_H */
|
857
include/apr_network_io.h
Normal file
857
include/apr_network_io.h
Normal file
@ -0,0 +1,857 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_NETWORK_IO_H
|
||||
#define APR_NETWORK_IO_H
|
||||
/**
|
||||
* @file apr_network_io.h
|
||||
* @brief APR Network library
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_file_io.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_inherit.h"
|
||||
|
||||
#if APR_HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_network_io Network Routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef APR_MAX_SECS_TO_LINGER
|
||||
/** Maximum seconds to linger */
|
||||
#define APR_MAX_SECS_TO_LINGER 30
|
||||
#endif
|
||||
|
||||
#ifndef APRMAXHOSTLEN
|
||||
/** Maximum hostname length */
|
||||
#define APRMAXHOSTLEN 256
|
||||
#endif
|
||||
|
||||
#ifndef APR_ANYADDR
|
||||
/** Default 'any' address */
|
||||
#define APR_ANYADDR "0.0.0.0"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup apr_sockopt Socket option definitions
|
||||
* @{
|
||||
*/
|
||||
#define APR_SO_LINGER 1 /**< Linger */
|
||||
#define APR_SO_KEEPALIVE 2 /**< Keepalive */
|
||||
#define APR_SO_DEBUG 4 /**< Debug */
|
||||
#define APR_SO_NONBLOCK 8 /**< Non-blocking IO */
|
||||
#define APR_SO_REUSEADDR 16 /**< Reuse addresses */
|
||||
#define APR_SO_SNDBUF 64 /**< Send buffer */
|
||||
#define APR_SO_RCVBUF 128 /**< Receive buffer */
|
||||
#define APR_SO_DISCONNECTED 256 /**< Disconnected */
|
||||
#define APR_TCP_NODELAY 512 /**< For SCTP sockets, this is mapped
|
||||
* to STCP_NODELAY internally.
|
||||
*/
|
||||
#define APR_TCP_NOPUSH 1024 /**< No push */
|
||||
#define APR_RESET_NODELAY 2048 /**< This flag is ONLY set internally
|
||||
* when we set APR_TCP_NOPUSH with
|
||||
* APR_TCP_NODELAY set to tell us that
|
||||
* APR_TCP_NODELAY should be turned on
|
||||
* again when NOPUSH is turned off
|
||||
*/
|
||||
#define APR_INCOMPLETE_READ 4096 /**< Set on non-blocking sockets
|
||||
* (timeout != 0) on which the
|
||||
* previous read() did not fill a buffer
|
||||
* completely. the next apr_socket_recv()
|
||||
* will first call select()/poll() rather than
|
||||
* going straight into read(). (Can also
|
||||
* be set by an application to force a
|
||||
* select()/poll() call before the next
|
||||
* read, in cases where the app expects
|
||||
* that an immediate read would fail.)
|
||||
*/
|
||||
#define APR_INCOMPLETE_WRITE 8192 /**< like APR_INCOMPLETE_READ, but for write
|
||||
* @see APR_INCOMPLETE_READ
|
||||
*/
|
||||
#define APR_IPV6_V6ONLY 16384 /**< Don't accept IPv4 connections on an
|
||||
* IPv6 listening socket.
|
||||
*/
|
||||
#define APR_TCP_DEFER_ACCEPT 32768 /**< Delay accepting of new connections
|
||||
* until data is available.
|
||||
* @see apr_socket_accept_filter
|
||||
*/
|
||||
|
||||
/** @} */
|
||||
|
||||
/** Define what type of socket shutdown should occur. */
|
||||
typedef enum {
|
||||
APR_SHUTDOWN_READ, /**< no longer allow read request */
|
||||
APR_SHUTDOWN_WRITE, /**< no longer allow write requests */
|
||||
APR_SHUTDOWN_READWRITE /**< no longer allow read or write requests */
|
||||
} apr_shutdown_how_e;
|
||||
|
||||
#define APR_IPV4_ADDR_OK 0x01 /**< @see apr_sockaddr_info_get() */
|
||||
#define APR_IPV6_ADDR_OK 0x02 /**< @see apr_sockaddr_info_get() */
|
||||
|
||||
#if (!APR_HAVE_IN_ADDR)
|
||||
/**
|
||||
* We need to make sure we always have an in_addr type, so APR will just
|
||||
* define it ourselves, if the platform doesn't provide it.
|
||||
*/
|
||||
struct in_addr {
|
||||
apr_uint32_t s_addr; /**< storage to hold the IP# */
|
||||
};
|
||||
#endif
|
||||
|
||||
/** @def APR_INADDR_NONE
|
||||
* Not all platforms have a real INADDR_NONE. This macro replaces
|
||||
* INADDR_NONE on all platforms.
|
||||
*/
|
||||
#ifdef INADDR_NONE
|
||||
#define APR_INADDR_NONE INADDR_NONE
|
||||
#else
|
||||
#define APR_INADDR_NONE ((unsigned int) 0xffffffff)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def APR_INET
|
||||
* Not all platforms have these defined, so we'll define them here
|
||||
* The default values come from FreeBSD 4.1.1
|
||||
*/
|
||||
#define APR_INET AF_INET
|
||||
/** @def APR_UNSPEC
|
||||
* Let the system decide which address family to use
|
||||
*/
|
||||
#ifdef AF_UNSPEC
|
||||
#define APR_UNSPEC AF_UNSPEC
|
||||
#else
|
||||
#define APR_UNSPEC 0
|
||||
#endif
|
||||
#if APR_HAVE_IPV6
|
||||
/** @def APR_INET6
|
||||
* IPv6 Address Family. Not all platforms may have this defined.
|
||||
*/
|
||||
|
||||
#define APR_INET6 AF_INET6
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup IP_Proto IP Protocol Definitions for use when creating sockets
|
||||
* @{
|
||||
*/
|
||||
#define APR_PROTO_TCP 6 /**< TCP */
|
||||
#define APR_PROTO_UDP 17 /**< UDP */
|
||||
#define APR_PROTO_SCTP 132 /**< SCTP */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* Enum used to denote either the local and remote endpoint of a
|
||||
* connection.
|
||||
*/
|
||||
typedef enum {
|
||||
APR_LOCAL, /**< Socket information for local end of connection */
|
||||
APR_REMOTE /**< Socket information for remote end of connection */
|
||||
} apr_interface_e;
|
||||
|
||||
/**
|
||||
* The specific declaration of inet_addr's ... some platforms fall back
|
||||
* inet_network (this is not good, but necessary)
|
||||
*/
|
||||
|
||||
#if APR_HAVE_INET_ADDR
|
||||
#define apr_inet_addr inet_addr
|
||||
#elif APR_HAVE_INET_NETWORK /* only DGUX, as far as I know */
|
||||
/**
|
||||
* @warning
|
||||
* not generally safe... inet_network() and inet_addr() perform
|
||||
* different functions */
|
||||
#define apr_inet_addr inet_network
|
||||
#endif
|
||||
|
||||
/** A structure to represent sockets */
|
||||
typedef struct apr_socket_t apr_socket_t;
|
||||
/**
|
||||
* A structure to encapsulate headers and trailers for apr_socket_sendfile
|
||||
*/
|
||||
typedef struct apr_hdtr_t apr_hdtr_t;
|
||||
/** A structure to represent in_addr */
|
||||
typedef struct in_addr apr_in_addr_t;
|
||||
/** A structure to represent an IP subnet */
|
||||
typedef struct apr_ipsubnet_t apr_ipsubnet_t;
|
||||
|
||||
/** @remark use apr_uint16_t just in case some system has a short that isn't 16 bits... */
|
||||
typedef apr_uint16_t apr_port_t;
|
||||
|
||||
/** @remark It's defined here as I think it should all be platform safe...
|
||||
* @see apr_sockaddr_t
|
||||
*/
|
||||
typedef struct apr_sockaddr_t apr_sockaddr_t;
|
||||
/**
|
||||
* APRs socket address type, used to ensure protocol independence
|
||||
*/
|
||||
struct apr_sockaddr_t {
|
||||
/** The pool to use... */
|
||||
apr_pool_t *pool;
|
||||
/** The hostname */
|
||||
char *hostname;
|
||||
/** Either a string of the port number or the service name for the port */
|
||||
char *servname;
|
||||
/** The numeric port */
|
||||
apr_port_t port;
|
||||
/** The family */
|
||||
apr_int32_t family;
|
||||
/** How big is the sockaddr we're using? */
|
||||
apr_socklen_t salen;
|
||||
/** How big is the ip address structure we're using? */
|
||||
int ipaddr_len;
|
||||
/** How big should the address buffer be? 16 for v4 or 46 for v6
|
||||
* used in inet_ntop... */
|
||||
int addr_str_len;
|
||||
/** This points to the IP address structure within the appropriate
|
||||
* sockaddr structure. */
|
||||
void *ipaddr_ptr;
|
||||
/** If multiple addresses were found by apr_sockaddr_info_get(), this
|
||||
* points to a representation of the next address. */
|
||||
apr_sockaddr_t *next;
|
||||
/** Union of either IPv4 or IPv6 sockaddr. */
|
||||
union {
|
||||
/** IPv4 sockaddr structure */
|
||||
struct sockaddr_in sin;
|
||||
#if APR_HAVE_IPV6
|
||||
/** IPv6 sockaddr structure */
|
||||
struct sockaddr_in6 sin6;
|
||||
#endif
|
||||
#if APR_HAVE_SA_STORAGE
|
||||
/** Placeholder to ensure that the size of this union is not
|
||||
* dependent on whether APR_HAVE_IPV6 is defined. */
|
||||
struct sockaddr_storage sas;
|
||||
#endif
|
||||
} sa;
|
||||
};
|
||||
|
||||
#if APR_HAS_SENDFILE
|
||||
/**
|
||||
* Support reusing the socket on platforms which support it (from disconnect,
|
||||
* specifically Win32.
|
||||
* @remark Optional flag passed into apr_socket_sendfile()
|
||||
*/
|
||||
#define APR_SENDFILE_DISCONNECT_SOCKET 1
|
||||
#endif
|
||||
|
||||
/** A structure to encapsulate headers and trailers for apr_socket_sendfile */
|
||||
struct apr_hdtr_t {
|
||||
/** An iovec to store the headers sent before the file. */
|
||||
struct iovec* headers;
|
||||
/** number of headers in the iovec */
|
||||
int numheaders;
|
||||
/** An iovec to store the trailers sent after the file. */
|
||||
struct iovec* trailers;
|
||||
/** number of trailers in the iovec */
|
||||
int numtrailers;
|
||||
};
|
||||
|
||||
/* function definitions */
|
||||
|
||||
/**
|
||||
* Create a socket.
|
||||
* @param new_sock The new socket that has been set up.
|
||||
* @param family The address family of the socket (e.g., APR_INET).
|
||||
* @param type The type of the socket (e.g., SOCK_STREAM).
|
||||
* @param protocol The protocol of the socket (e.g., APR_PROTO_TCP).
|
||||
* @param cont The pool for the apr_socket_t and associated storage.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new_sock,
|
||||
int family, int type,
|
||||
int protocol,
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* Shutdown either reading, writing, or both sides of a socket.
|
||||
* @param thesocket The socket to close
|
||||
* @param how How to shutdown the socket. One of:
|
||||
* <PRE>
|
||||
* APR_SHUTDOWN_READ no longer allow read requests
|
||||
* APR_SHUTDOWN_WRITE no longer allow write requests
|
||||
* APR_SHUTDOWN_READWRITE no longer allow read or write requests
|
||||
* </PRE>
|
||||
* @see apr_shutdown_how_e
|
||||
* @remark This does not actually close the socket descriptor, it just
|
||||
* controls which calls are still valid on the socket.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_shutdown(apr_socket_t *thesocket,
|
||||
apr_shutdown_how_e how);
|
||||
|
||||
/**
|
||||
* Close a socket.
|
||||
* @param thesocket The socket to close
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_close(apr_socket_t *thesocket);
|
||||
|
||||
/**
|
||||
* Bind the socket to its associated port
|
||||
* @param sock The socket to bind
|
||||
* @param sa The socket address to bind to
|
||||
* @remark This may be where we will find out if there is any other process
|
||||
* using the selected port.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_bind(apr_socket_t *sock,
|
||||
apr_sockaddr_t *sa);
|
||||
|
||||
/**
|
||||
* Listen to a bound socket for connections.
|
||||
* @param sock The socket to listen on
|
||||
* @param backlog The number of outstanding connections allowed in the sockets
|
||||
* listen queue. If this value is less than zero, the listen
|
||||
* queue size is set to zero.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_listen(apr_socket_t *sock,
|
||||
apr_int32_t backlog);
|
||||
|
||||
/**
|
||||
* Accept a new connection request
|
||||
* @param new_sock A copy of the socket that is connected to the socket that
|
||||
* made the connection request. This is the socket which should
|
||||
* be used for all future communication.
|
||||
* @param sock The socket we are listening on.
|
||||
* @param connection_pool The pool for the new socket.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new_sock,
|
||||
apr_socket_t *sock,
|
||||
apr_pool_t *connection_pool);
|
||||
|
||||
/**
|
||||
* Issue a connection request to a socket either on the same machine
|
||||
* or a different one.
|
||||
* @param sock The socket we wish to use for our side of the connection
|
||||
* @param sa The address of the machine we wish to connect to.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock,
|
||||
apr_sockaddr_t *sa);
|
||||
|
||||
/**
|
||||
* Determine whether the receive part of the socket has been closed by
|
||||
* the peer (such that a subsequent call to apr_socket_read would
|
||||
* return APR_EOF), if the socket's receive buffer is empty. This
|
||||
* function does not block waiting for I/O.
|
||||
*
|
||||
* @param sock The socket to check
|
||||
* @param atreadeof If APR_SUCCESS is returned, *atreadeof is set to
|
||||
* non-zero if a subsequent read would return APR_EOF
|
||||
* @return an error is returned if it was not possible to determine the
|
||||
* status, in which case *atreadeof is not changed.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_atreadeof(apr_socket_t *sock,
|
||||
int *atreadeof);
|
||||
|
||||
/**
|
||||
* Create apr_sockaddr_t from hostname, address family, and port.
|
||||
* @param sa The new apr_sockaddr_t.
|
||||
* @param hostname The hostname or numeric address string to resolve/parse, or
|
||||
* NULL to build an address that corresponds to 0.0.0.0 or ::
|
||||
* @param family The address family to use, or APR_UNSPEC if the system should
|
||||
* decide.
|
||||
* @param port The port number.
|
||||
* @param flags Special processing flags:
|
||||
* <PRE>
|
||||
* APR_IPV4_ADDR_OK first query for IPv4 addresses; only look
|
||||
* for IPv6 addresses if the first query failed;
|
||||
* only valid if family is APR_UNSPEC and hostname
|
||||
* isn't NULL; mutually exclusive with
|
||||
* APR_IPV6_ADDR_OK
|
||||
* APR_IPV6_ADDR_OK first query for IPv6 addresses; only look
|
||||
* for IPv4 addresses if the first query failed;
|
||||
* only valid if family is APR_UNSPEC and hostname
|
||||
* isn't NULL and APR_HAVE_IPV6; mutually exclusive
|
||||
* with APR_IPV4_ADDR_OK
|
||||
* </PRE>
|
||||
* @param p The pool for the apr_sockaddr_t and associated storage.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_sockaddr_info_get(apr_sockaddr_t **sa,
|
||||
const char *hostname,
|
||||
apr_int32_t family,
|
||||
apr_port_t port,
|
||||
apr_int32_t flags,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Look up the host name from an apr_sockaddr_t.
|
||||
* @param hostname The hostname.
|
||||
* @param sa The apr_sockaddr_t.
|
||||
* @param flags Special processing flags.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_getnameinfo(char **hostname,
|
||||
apr_sockaddr_t *sa,
|
||||
apr_int32_t flags);
|
||||
|
||||
/**
|
||||
* Parse hostname/IP address with scope id and port.
|
||||
*
|
||||
* Any of the following strings are accepted:
|
||||
* 8080 (just the port number)
|
||||
* www.apache.org (just the hostname)
|
||||
* www.apache.org:8080 (hostname and port number)
|
||||
* [fe80::1]:80 (IPv6 numeric address string only)
|
||||
* [fe80::1%eth0] (IPv6 numeric address string and scope id)
|
||||
*
|
||||
* Invalid strings:
|
||||
* (empty string)
|
||||
* [abc] (not valid IPv6 numeric address string)
|
||||
* abc:65536 (invalid port number)
|
||||
*
|
||||
* @param addr The new buffer containing just the hostname. On output, *addr
|
||||
* will be NULL if no hostname/IP address was specfied.
|
||||
* @param scope_id The new buffer containing just the scope id. On output,
|
||||
* *scope_id will be NULL if no scope id was specified.
|
||||
* @param port The port number. On output, *port will be 0 if no port was
|
||||
* specified.
|
||||
* ### FIXME: 0 is a legal port (per RFC 1700). this should
|
||||
* ### return something besides zero if the port is missing.
|
||||
* @param str The input string to be parsed.
|
||||
* @param p The pool from which *addr and *scope_id are allocated.
|
||||
* @remark If scope id shouldn't be allowed, check for scope_id != NULL in
|
||||
* addition to checking the return code. If addr/hostname should be
|
||||
* required, check for addr == NULL in addition to checking the
|
||||
* return code.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_parse_addr_port(char **addr,
|
||||
char **scope_id,
|
||||
apr_port_t *port,
|
||||
const char *str,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Get name of the current machine
|
||||
* @param buf A buffer to store the hostname in.
|
||||
* @param len The maximum length of the hostname that can be stored in the
|
||||
* buffer provided. The suggested length is APRMAXHOSTLEN + 1.
|
||||
* @param cont The pool to use.
|
||||
* @remark If the buffer was not large enough, an error will be returned.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_gethostname(char *buf, int len, apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* Return the data associated with the current socket
|
||||
* @param data The user data associated with the socket.
|
||||
* @param key The key to associate with the user data.
|
||||
* @param sock The currently open socket.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_data_get(void **data, const char *key,
|
||||
apr_socket_t *sock);
|
||||
|
||||
/**
|
||||
* Set the data associated with the current socket.
|
||||
* @param sock The currently open socket.
|
||||
* @param data The user data to associate with the socket.
|
||||
* @param key The key to associate with the data.
|
||||
* @param cleanup The cleanup to call when the socket is destroyed.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_data_set(apr_socket_t *sock, void *data,
|
||||
const char *key,
|
||||
apr_status_t (*cleanup)(void*));
|
||||
|
||||
/**
|
||||
* Send data over a network.
|
||||
* @param sock The socket to send the data over.
|
||||
* @param buf The buffer which contains the data to be sent.
|
||||
* @param len On entry, the number of bytes to send; on exit, the number
|
||||
* of bytes sent.
|
||||
* @remark
|
||||
* <PRE>
|
||||
* This functions acts like a blocking write by default. To change
|
||||
* this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
|
||||
* socket option.
|
||||
*
|
||||
* It is possible for both bytes to be sent and an error to be returned.
|
||||
*
|
||||
* APR_EINTR is never returned.
|
||||
* </PRE>
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const char *buf,
|
||||
apr_size_t *len);
|
||||
|
||||
/**
|
||||
* Send multiple packets of data over a network.
|
||||
* @param sock The socket to send the data over.
|
||||
* @param vec The array of iovec structs containing the data to send
|
||||
* @param nvec The number of iovec structs in the array
|
||||
* @param len Receives the number of bytes actually written
|
||||
* @remark
|
||||
* <PRE>
|
||||
* This functions acts like a blocking write by default. To change
|
||||
* this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
|
||||
* socket option.
|
||||
* The number of bytes actually sent is stored in argument 3.
|
||||
*
|
||||
* It is possible for both bytes to be sent and an error to be returned.
|
||||
*
|
||||
* APR_EINTR is never returned.
|
||||
* </PRE>
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_sendv(apr_socket_t *sock,
|
||||
const struct iovec *vec,
|
||||
apr_int32_t nvec, apr_size_t *len);
|
||||
|
||||
/**
|
||||
* @param sock The socket to send from
|
||||
* @param where The apr_sockaddr_t describing where to send the data
|
||||
* @param flags The flags to use
|
||||
* @param buf The data to send
|
||||
* @param len The length of the data to send
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_sendto(apr_socket_t *sock,
|
||||
apr_sockaddr_t *where,
|
||||
apr_int32_t flags, const char *buf,
|
||||
apr_size_t *len);
|
||||
|
||||
/**
|
||||
* Read data from a socket. On success, the address of the peer from
|
||||
* which the data was sent is copied into the @a from parameter, and the
|
||||
* @a len parameter is updated to give the number of bytes written to
|
||||
* @a buf.
|
||||
*
|
||||
* @param from Updated with the address from which the data was received
|
||||
* @param sock The socket to use
|
||||
* @param flags The flags to use
|
||||
* @param buf The buffer to use
|
||||
* @param len The length of the available buffer
|
||||
*/
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_socket_recvfrom(apr_sockaddr_t *from,
|
||||
apr_socket_t *sock,
|
||||
apr_int32_t flags, char *buf,
|
||||
apr_size_t *len);
|
||||
|
||||
#if APR_HAS_SENDFILE || defined(DOXYGEN)
|
||||
|
||||
/**
|
||||
* Send a file from an open file descriptor to a socket, along with
|
||||
* optional headers and trailers
|
||||
* @param sock The socket to which we're writing
|
||||
* @param file The open file from which to read
|
||||
* @param hdtr A structure containing the headers and trailers to send
|
||||
* @param offset Offset into the file where we should begin writing
|
||||
* @param len (input) - Number of bytes to send from the file
|
||||
* (output) - Number of bytes actually sent,
|
||||
* including headers, file, and trailers
|
||||
* @param flags APR flags that are mapped to OS specific flags
|
||||
* @remark This functions acts like a blocking write by default. To change
|
||||
* this behavior, use apr_socket_timeout_set() or the
|
||||
* APR_SO_NONBLOCK socket option.
|
||||
* The number of bytes actually sent is stored in the len parameter.
|
||||
* The offset parameter is passed by reference for no reason; its
|
||||
* value will never be modified by the apr_socket_sendfile() function.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock,
|
||||
apr_file_t *file,
|
||||
apr_hdtr_t *hdtr,
|
||||
apr_off_t *offset,
|
||||
apr_size_t *len,
|
||||
apr_int32_t flags);
|
||||
|
||||
#endif /* APR_HAS_SENDFILE */
|
||||
|
||||
/**
|
||||
* Read data from a network.
|
||||
* @param sock The socket to read the data from.
|
||||
* @param buf The buffer to store the data in.
|
||||
* @param len On entry, the number of bytes to receive; on exit, the number
|
||||
* of bytes received.
|
||||
* @remark
|
||||
* <PRE>
|
||||
* This functions acts like a blocking read by default. To change
|
||||
* this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
|
||||
* socket option.
|
||||
* The number of bytes actually received is stored in argument 3.
|
||||
*
|
||||
* It is possible for both bytes to be received and an APR_EOF or
|
||||
* other error to be returned.
|
||||
*
|
||||
* APR_EINTR is never returned.
|
||||
* </PRE>
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_recv(apr_socket_t *sock,
|
||||
char *buf, apr_size_t *len);
|
||||
|
||||
/**
|
||||
* Setup socket options for the specified socket
|
||||
* @param sock The socket to set up.
|
||||
* @param opt The option we would like to configure. One of:
|
||||
* <PRE>
|
||||
* APR_SO_DEBUG -- turn on debugging information
|
||||
* APR_SO_KEEPALIVE -- keep connections active
|
||||
* APR_SO_LINGER -- lingers on close if data is present
|
||||
* APR_SO_NONBLOCK -- Turns blocking on/off for socket
|
||||
* When this option is enabled, use
|
||||
* the APR_STATUS_IS_EAGAIN() macro to
|
||||
* see if a send or receive function
|
||||
* could not transfer data without
|
||||
* blocking.
|
||||
* APR_SO_REUSEADDR -- The rules used in validating addresses
|
||||
* supplied to bind should allow reuse
|
||||
* of local addresses.
|
||||
* APR_SO_SNDBUF -- Set the SendBufferSize
|
||||
* APR_SO_RCVBUF -- Set the ReceiveBufferSize
|
||||
* </PRE>
|
||||
* @param on Value for the option.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock,
|
||||
apr_int32_t opt, apr_int32_t on);
|
||||
|
||||
/**
|
||||
* Setup socket timeout for the specified socket
|
||||
* @param sock The socket to set up.
|
||||
* @param t Value for the timeout.
|
||||
* <PRE>
|
||||
* t > 0 -- read and write calls return APR_TIMEUP if specified time
|
||||
* elapsess with no data read or written
|
||||
* t == 0 -- read and write calls never block
|
||||
* t < 0 -- read and write calls block
|
||||
* </PRE>
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_timeout_set(apr_socket_t *sock,
|
||||
apr_interval_time_t t);
|
||||
|
||||
/**
|
||||
* Query socket options for the specified socket
|
||||
* @param sock The socket to query
|
||||
* @param opt The option we would like to query. One of:
|
||||
* <PRE>
|
||||
* APR_SO_DEBUG -- turn on debugging information
|
||||
* APR_SO_KEEPALIVE -- keep connections active
|
||||
* APR_SO_LINGER -- lingers on close if data is present
|
||||
* APR_SO_NONBLOCK -- Turns blocking on/off for socket
|
||||
* APR_SO_REUSEADDR -- The rules used in validating addresses
|
||||
* supplied to bind should allow reuse
|
||||
* of local addresses.
|
||||
* APR_SO_SNDBUF -- Set the SendBufferSize
|
||||
* APR_SO_RCVBUF -- Set the ReceiveBufferSize
|
||||
* APR_SO_DISCONNECTED -- Query the disconnected state of the socket.
|
||||
* (Currently only used on Windows)
|
||||
* </PRE>
|
||||
* @param on Socket option returned on the call.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_opt_get(apr_socket_t *sock,
|
||||
apr_int32_t opt, apr_int32_t *on);
|
||||
|
||||
/**
|
||||
* Query socket timeout for the specified socket
|
||||
* @param sock The socket to query
|
||||
* @param t Socket timeout returned from the query.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_timeout_get(apr_socket_t *sock,
|
||||
apr_interval_time_t *t);
|
||||
|
||||
/**
|
||||
* Query the specified socket if at the OOB/Urgent data mark
|
||||
* @param sock The socket to query
|
||||
* @param atmark Is set to true if socket is at the OOB/urgent mark,
|
||||
* otherwise is set to false.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_atmark(apr_socket_t *sock,
|
||||
int *atmark);
|
||||
|
||||
/**
|
||||
* Return an address associated with a socket; either the address to
|
||||
* which the socket is bound locally or the the address of the peer
|
||||
* to which the socket is connected.
|
||||
* @param sa The returned apr_sockaddr_t.
|
||||
* @param which Whether to retrieve the local or remote address
|
||||
* @param sock The socket to use
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_addr_get(apr_sockaddr_t **sa,
|
||||
apr_interface_e which,
|
||||
apr_socket_t *sock);
|
||||
|
||||
/**
|
||||
* Return the IP address (in numeric address string format) in
|
||||
* an APR socket address. APR will allocate storage for the IP address
|
||||
* string from the pool of the apr_sockaddr_t.
|
||||
* @param addr The IP address.
|
||||
* @param sockaddr The socket address to reference.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_sockaddr_ip_get(char **addr,
|
||||
apr_sockaddr_t *sockaddr);
|
||||
|
||||
/**
|
||||
* Write the IP address (in numeric address string format) of the APR
|
||||
* socket address @a sockaddr into the buffer @a buf (of size @a buflen).
|
||||
* @param sockaddr The socket address to reference.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_sockaddr_ip_getbuf(char *buf, apr_size_t buflen,
|
||||
apr_sockaddr_t *sockaddr);
|
||||
|
||||
/**
|
||||
* See if the IP addresses in two APR socket addresses are
|
||||
* equivalent. Appropriate logic is present for comparing
|
||||
* IPv4-mapped IPv6 addresses with IPv4 addresses.
|
||||
*
|
||||
* @param addr1 One of the APR socket addresses.
|
||||
* @param addr2 The other APR socket address.
|
||||
* @remark The return value will be non-zero if the addresses
|
||||
* are equivalent.
|
||||
*/
|
||||
APR_DECLARE(int) apr_sockaddr_equal(const apr_sockaddr_t *addr1,
|
||||
const apr_sockaddr_t *addr2);
|
||||
|
||||
/**
|
||||
* Return the type of the socket.
|
||||
* @param sock The socket to query.
|
||||
* @param type The returned type (e.g., SOCK_STREAM).
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_type_get(apr_socket_t *sock,
|
||||
int *type);
|
||||
|
||||
/**
|
||||
* Given an apr_sockaddr_t and a service name, set the port for the service
|
||||
* @param sockaddr The apr_sockaddr_t that will have its port set
|
||||
* @param servname The name of the service you wish to use
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_getservbyname(apr_sockaddr_t *sockaddr,
|
||||
const char *servname);
|
||||
/**
|
||||
* Build an ip-subnet representation from an IP address and optional netmask or
|
||||
* number-of-bits.
|
||||
* @param ipsub The new ip-subnet representation
|
||||
* @param ipstr The input IP address string
|
||||
* @param mask_or_numbits The input netmask or number-of-bits string, or NULL
|
||||
* @param p The pool to allocate from
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_ipsubnet_create(apr_ipsubnet_t **ipsub,
|
||||
const char *ipstr,
|
||||
const char *mask_or_numbits,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Test the IP address in an apr_sockaddr_t against a pre-built ip-subnet
|
||||
* representation.
|
||||
* @param ipsub The ip-subnet representation
|
||||
* @param sa The socket address to test
|
||||
* @return non-zero if the socket address is within the subnet, 0 otherwise
|
||||
*/
|
||||
APR_DECLARE(int) apr_ipsubnet_test(apr_ipsubnet_t *ipsub, apr_sockaddr_t *sa);
|
||||
|
||||
#if APR_HAS_SO_ACCEPTFILTER || defined(DOXYGEN)
|
||||
/**
|
||||
* Set an OS level accept filter.
|
||||
* @param sock The socket to put the accept filter on.
|
||||
* @param name The accept filter
|
||||
* @param args Any extra args to the accept filter. Passing NULL here removes
|
||||
* the accept filter.
|
||||
*/
|
||||
apr_status_t apr_socket_accept_filter(apr_socket_t *sock, char *name,
|
||||
char *args);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Return the protocol of the socket.
|
||||
* @param sock The socket to query.
|
||||
* @param protocol The returned protocol (e.g., APR_PROTO_TCP).
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_socket_protocol_get(apr_socket_t *sock,
|
||||
int *protocol);
|
||||
|
||||
/**
|
||||
* Get the pool used by the socket.
|
||||
*/
|
||||
APR_POOL_DECLARE_ACCESSOR(socket);
|
||||
|
||||
/**
|
||||
* Set a socket to be inherited by child processes.
|
||||
*/
|
||||
APR_DECLARE_INHERIT_SET(socket);
|
||||
|
||||
/**
|
||||
* Unset a socket from being inherited by child processes.
|
||||
*/
|
||||
APR_DECLARE_INHERIT_UNSET(socket);
|
||||
|
||||
/**
|
||||
* @defgroup apr_mcast IP Multicast
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Join a Multicast Group
|
||||
* @param sock The socket to join a multicast group
|
||||
* @param join The address of the multicast group to join
|
||||
* @param iface Address of the interface to use. If NULL is passed, the
|
||||
* default multicast interface will be used. (OS Dependent)
|
||||
* @param source Source Address to accept transmissions from (non-NULL
|
||||
* implies Source-Specific Multicast)
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_mcast_join(apr_socket_t *sock,
|
||||
apr_sockaddr_t *join,
|
||||
apr_sockaddr_t *iface,
|
||||
apr_sockaddr_t *source);
|
||||
|
||||
/**
|
||||
* Leave a Multicast Group. All arguments must be the same as
|
||||
* apr_mcast_join.
|
||||
* @param sock The socket to leave a multicast group
|
||||
* @param addr The address of the multicast group to leave
|
||||
* @param iface Address of the interface to use. If NULL is passed, the
|
||||
* default multicast interface will be used. (OS Dependent)
|
||||
* @param source Source Address to accept transmissions from (non-NULL
|
||||
* implies Source-Specific Multicast)
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_mcast_leave(apr_socket_t *sock,
|
||||
apr_sockaddr_t *addr,
|
||||
apr_sockaddr_t *iface,
|
||||
apr_sockaddr_t *source);
|
||||
|
||||
/**
|
||||
* Set the Multicast Time to Live (ttl) for a multicast transmission.
|
||||
* @param sock The socket to set the multicast ttl
|
||||
* @param ttl Time to live to Assign. 0-255, default=1
|
||||
* @remark If the TTL is 0, packets will only be seen by sockets on
|
||||
* the local machine, and only when multicast loopback is enabled.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_mcast_hops(apr_socket_t *sock,
|
||||
apr_byte_t ttl);
|
||||
|
||||
/**
|
||||
* Toggle IP Multicast Loopback
|
||||
* @param sock The socket to set multicast loopback
|
||||
* @param opt 0=disable, 1=enable
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_mcast_loopback(apr_socket_t *sock,
|
||||
apr_byte_t opt);
|
||||
|
||||
|
||||
/**
|
||||
* Set the Interface to be used for outgoing Multicast Transmissions.
|
||||
* @param sock The socket to set the multicast interface on
|
||||
* @param iface Address of the interface to use for Multicast
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_mcast_interface(apr_socket_t *sock,
|
||||
apr_sockaddr_t *iface);
|
||||
|
||||
/** @} */
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_NETWORK_IO_H */
|
||||
|
415
include/apr_poll.h
Normal file
415
include/apr_poll.h
Normal file
@ -0,0 +1,415 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_POLL_H
|
||||
#define APR_POLL_H
|
||||
/**
|
||||
* @file apr_poll.h
|
||||
* @brief APR Poll interface
|
||||
*/
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_inherit.h"
|
||||
#include "apr_file_io.h"
|
||||
#include "apr_network_io.h"
|
||||
|
||||
#if APR_HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_poll Poll Routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Poll options
|
||||
*/
|
||||
#define APR_POLLIN 0x001 /**< Can read without blocking */
|
||||
#define APR_POLLPRI 0x002 /**< Priority data available */
|
||||
#define APR_POLLOUT 0x004 /**< Can write without blocking */
|
||||
#define APR_POLLERR 0x010 /**< Pending error */
|
||||
#define APR_POLLHUP 0x020 /**< Hangup occurred */
|
||||
#define APR_POLLNVAL 0x040 /**< Descriptor invalid */
|
||||
|
||||
/**
|
||||
* Pollset Flags
|
||||
*/
|
||||
#define APR_POLLSET_THREADSAFE 0x001 /**< Adding or removing a descriptor is
|
||||
* thread-safe
|
||||
*/
|
||||
#define APR_POLLSET_NOCOPY 0x002 /**< Descriptors passed to apr_pollset_add()
|
||||
* are not copied
|
||||
*/
|
||||
#define APR_POLLSET_WAKEABLE 0x004 /**< Poll operations are interruptable by
|
||||
* apr_pollset_wakeup()
|
||||
*/
|
||||
#define APR_POLLSET_NODEFAULT 0x010 /**< Do not try to use the default method if
|
||||
* the specified non-default method cannot be
|
||||
* used
|
||||
*/
|
||||
|
||||
/**
|
||||
* Pollset Methods
|
||||
*/
|
||||
typedef enum {
|
||||
APR_POLLSET_DEFAULT, /**< Platform default poll method */
|
||||
APR_POLLSET_SELECT, /**< Poll uses select method */
|
||||
APR_POLLSET_KQUEUE, /**< Poll uses kqueue method */
|
||||
APR_POLLSET_PORT, /**< Poll uses Solaris event port method */
|
||||
APR_POLLSET_EPOLL, /**< Poll uses epoll method */
|
||||
APR_POLLSET_POLL /**< Poll uses poll method */
|
||||
} apr_pollset_method_e;
|
||||
|
||||
/** Used in apr_pollfd_t to determine what the apr_descriptor is */
|
||||
typedef enum {
|
||||
APR_NO_DESC, /**< nothing here */
|
||||
APR_POLL_SOCKET, /**< descriptor refers to a socket */
|
||||
APR_POLL_FILE, /**< descriptor refers to a file */
|
||||
APR_POLL_LASTDESC /**< @deprecated descriptor is the last one in the list */
|
||||
} apr_datatype_e ;
|
||||
|
||||
/** Union of either an APR file or socket. */
|
||||
typedef union {
|
||||
apr_file_t *f; /**< file */
|
||||
apr_socket_t *s; /**< socket */
|
||||
} apr_descriptor;
|
||||
|
||||
/** @see apr_pollfd_t */
|
||||
typedef struct apr_pollfd_t apr_pollfd_t;
|
||||
|
||||
/** Poll descriptor set. */
|
||||
struct apr_pollfd_t {
|
||||
apr_pool_t *p; /**< associated pool */
|
||||
apr_datatype_e desc_type; /**< descriptor type */
|
||||
apr_int16_t reqevents; /**< requested events */
|
||||
apr_int16_t rtnevents; /**< returned events */
|
||||
apr_descriptor desc; /**< @see apr_descriptor */
|
||||
void *client_data; /**< allows app to associate context */
|
||||
};
|
||||
|
||||
|
||||
/* General-purpose poll API for arbitrarily large numbers of
|
||||
* file descriptors
|
||||
*/
|
||||
|
||||
/** Opaque structure used for pollset API */
|
||||
typedef struct apr_pollset_t apr_pollset_t;
|
||||
|
||||
/**
|
||||
* Set up a pollset object
|
||||
* @param pollset The pointer in which to return the newly created object
|
||||
* @param size The maximum number of descriptors that this pollset can hold
|
||||
* @param p The pool from which to allocate the pollset
|
||||
* @param flags Optional flags to modify the operation of the pollset.
|
||||
*
|
||||
* @remark If flags contains APR_POLLSET_THREADSAFE, then a pollset is
|
||||
* created on which it is safe to make concurrent calls to
|
||||
* apr_pollset_add(), apr_pollset_remove() and apr_pollset_poll()
|
||||
* from separate threads. This feature is only supported on some
|
||||
* platforms; the apr_pollset_create() call will fail with
|
||||
* APR_ENOTIMPL on platforms where it is not supported.
|
||||
* @remark If flags contains APR_POLLSET_WAKEABLE, then a pollset is
|
||||
* created with an additional internal pipe object used for the
|
||||
* apr_pollset_wakeup() call. The actual size of pollset is
|
||||
* in that case size + 1. This feature is only supported on some
|
||||
* platforms; the apr_pollset_create() call will fail with
|
||||
* APR_ENOTIMPL on platforms where it is not supported.
|
||||
* @remark If flags contains APR_POLLSET_NOCOPY, then the apr_pollfd_t
|
||||
* structures passed to apr_pollset_add() are not copied and
|
||||
* must have a lifetime at least as long as the pollset.
|
||||
* @remark Some poll methods (including APR_POLLSET_KQUEUE,
|
||||
* APR_POLLSET_PORT, and APR_POLLSET_EPOLL) do not have a
|
||||
* fixed limit on the size of the pollset. For these methods,
|
||||
* the size parameter controls the maximum number of
|
||||
* descriptors that will be returned by a single call to
|
||||
* apr_pollset_poll().
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pollset_create(apr_pollset_t **pollset,
|
||||
apr_uint32_t size,
|
||||
apr_pool_t *p,
|
||||
apr_uint32_t flags);
|
||||
|
||||
/**
|
||||
* Set up a pollset object
|
||||
* @param pollset The pointer in which to return the newly created object
|
||||
* @param size The maximum number of descriptors that this pollset can hold
|
||||
* @param p The pool from which to allocate the pollset
|
||||
* @param flags Optional flags to modify the operation of the pollset.
|
||||
* @param method Poll method to use. See #apr_pollset_method_e. If this
|
||||
* method cannot be used, the default method will be used unless the
|
||||
* APR_POLLSET_NODEFAULT flag has been specified.
|
||||
*
|
||||
* @remark If flags contains APR_POLLSET_THREADSAFE, then a pollset is
|
||||
* created on which it is safe to make concurrent calls to
|
||||
* apr_pollset_add(), apr_pollset_remove() and apr_pollset_poll()
|
||||
* from separate threads. This feature is only supported on some
|
||||
* platforms; the apr_pollset_create_ex() call will fail with
|
||||
* APR_ENOTIMPL on platforms where it is not supported.
|
||||
* @remark If flags contains APR_POLLSET_WAKEABLE, then a pollset is
|
||||
* created with additional internal pipe object used for the
|
||||
* apr_pollset_wakeup() call. The actual size of pollset is
|
||||
* in that case size + 1. This feature is only supported on some
|
||||
* platforms; the apr_pollset_create_ex() call will fail with
|
||||
* APR_ENOTIMPL on platforms where it is not supported.
|
||||
* @remark If flags contains APR_POLLSET_NOCOPY, then the apr_pollfd_t
|
||||
* structures passed to apr_pollset_add() are not copied and
|
||||
* must have a lifetime at least as long as the pollset.
|
||||
* @remark Some poll methods (including APR_POLLSET_KQUEUE,
|
||||
* APR_POLLSET_PORT, and APR_POLLSET_EPOLL) do not have a
|
||||
* fixed limit on the size of the pollset. For these methods,
|
||||
* the size parameter controls the maximum number of
|
||||
* descriptors that will be returned by a single call to
|
||||
* apr_pollset_poll().
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pollset_create_ex(apr_pollset_t **pollset,
|
||||
apr_uint32_t size,
|
||||
apr_pool_t *p,
|
||||
apr_uint32_t flags,
|
||||
apr_pollset_method_e method);
|
||||
|
||||
/**
|
||||
* Destroy a pollset object
|
||||
* @param pollset The pollset to destroy
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pollset_destroy(apr_pollset_t *pollset);
|
||||
|
||||
/**
|
||||
* Add a socket or file descriptor to a pollset
|
||||
* @param pollset The pollset to which to add the descriptor
|
||||
* @param descriptor The descriptor to add
|
||||
* @remark If you set client_data in the descriptor, that value
|
||||
* will be returned in the client_data field whenever this
|
||||
* descriptor is signalled in apr_pollset_poll().
|
||||
* @remark If the pollset has been created with APR_POLLSET_THREADSAFE
|
||||
* and thread T1 is blocked in a call to apr_pollset_poll() for
|
||||
* this same pollset that is being modified via apr_pollset_add()
|
||||
* in thread T2, the currently executing apr_pollset_poll() call in
|
||||
* T1 will either: (1) automatically include the newly added descriptor
|
||||
* in the set of descriptors it is watching or (2) return immediately
|
||||
* with APR_EINTR. Option (1) is recommended, but option (2) is
|
||||
* allowed for implementations where option (1) is impossible
|
||||
* or impractical.
|
||||
* @remark If the pollset has been created with APR_POLLSET_NOCOPY, the
|
||||
* apr_pollfd_t structure referenced by descriptor will not be copied
|
||||
* and must have a lifetime at least as long as the pollset.
|
||||
* @remark Do not add the same socket or file descriptor to the same pollset
|
||||
* multiple times, even if the requested events differ for the
|
||||
* different calls to apr_pollset_add(). If the events of interest
|
||||
* for a descriptor change, you must first remove the descriptor
|
||||
* from the pollset with apr_pollset_remove(), then add it again
|
||||
* specifying all requested events.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pollset_add(apr_pollset_t *pollset,
|
||||
const apr_pollfd_t *descriptor);
|
||||
|
||||
/**
|
||||
* Remove a descriptor from a pollset
|
||||
* @param pollset The pollset from which to remove the descriptor
|
||||
* @param descriptor The descriptor to remove
|
||||
* @remark If the pollset has been created with APR_POLLSET_THREADSAFE
|
||||
* and thread T1 is blocked in a call to apr_pollset_poll() for
|
||||
* this same pollset that is being modified via apr_pollset_remove()
|
||||
* in thread T2, the currently executing apr_pollset_poll() call in
|
||||
* T1 will either: (1) automatically exclude the newly added descriptor
|
||||
* in the set of descriptors it is watching or (2) return immediately
|
||||
* with APR_EINTR. Option (1) is recommended, but option (2) is
|
||||
* allowed for implementations where option (1) is impossible
|
||||
* or impractical.
|
||||
* @remark apr_pollset_remove() cannot be used to remove a subset of requested
|
||||
* events for a descriptor. The reqevents field in the apr_pollfd_t
|
||||
* parameter must contain the same value when removing as when adding.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pollset_remove(apr_pollset_t *pollset,
|
||||
const apr_pollfd_t *descriptor);
|
||||
|
||||
/**
|
||||
* Block for activity on the descriptor(s) in a pollset
|
||||
* @param pollset The pollset to use
|
||||
* @param timeout The amount of time in microseconds to wait. This is a
|
||||
* maximum, not a minimum. If a descriptor is signalled, the
|
||||
* function will return before this time. If timeout is
|
||||
* negative, the function will block until a descriptor is
|
||||
* signalled or until apr_pollset_wakeup() has been called.
|
||||
* @param num Number of signalled descriptors (output parameter)
|
||||
* @param descriptors Array of signalled descriptors (output parameter)
|
||||
* @remark APR_EINTR will be returned if the pollset has been created with
|
||||
* APR_POLLSET_WAKEABLE, apr_pollset_wakeup() has been called while
|
||||
* waiting for activity, and there were no signalled descriptors at the
|
||||
* time of the wakeup call.
|
||||
* @remark Multiple signalled conditions for the same descriptor may be reported
|
||||
* in one or more returned apr_pollfd_t structures, depending on the
|
||||
* implementation.
|
||||
* @bug With versions 1.4.2 and prior on Windows, a call with no descriptors
|
||||
* and timeout will return immediately with the wrong error code.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset,
|
||||
apr_interval_time_t timeout,
|
||||
apr_int32_t *num,
|
||||
const apr_pollfd_t **descriptors);
|
||||
|
||||
/**
|
||||
* Interrupt the blocked apr_pollset_poll() call.
|
||||
* @param pollset The pollset to use
|
||||
* @remark If the pollset was not created with APR_POLLSET_WAKEABLE the
|
||||
* return value is APR_EINIT.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pollset_wakeup(apr_pollset_t *pollset);
|
||||
|
||||
/**
|
||||
* Poll the descriptors in the poll structure
|
||||
* @param aprset The poll structure we will be using.
|
||||
* @param numsock The number of descriptors we are polling
|
||||
* @param nsds The number of descriptors signalled (output parameter)
|
||||
* @param timeout The amount of time in microseconds to wait. This is a
|
||||
* maximum, not a minimum. If a descriptor is signalled, the
|
||||
* function will return before this time. If timeout is
|
||||
* negative, the function will block until a descriptor is
|
||||
* signalled or until apr_pollset_wakeup() has been called.
|
||||
* @remark The number of descriptors signalled is returned in the third argument.
|
||||
* This is a blocking call, and it will not return until either a
|
||||
* descriptor has been signalled or the timeout has expired.
|
||||
* @remark The rtnevents field in the apr_pollfd_t array will only be filled-
|
||||
* in if the return value is APR_SUCCESS.
|
||||
* @bug With versions 1.4.2 and prior on Windows, a call with no descriptors
|
||||
* and timeout will return immediately with the wrong error code.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, apr_int32_t numsock,
|
||||
apr_int32_t *nsds,
|
||||
apr_interval_time_t timeout);
|
||||
|
||||
/**
|
||||
* Return a printable representation of the pollset method.
|
||||
* @param pollset The pollset to use
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_pollset_method_name(apr_pollset_t *pollset);
|
||||
|
||||
/**
|
||||
* Return a printable representation of the default pollset method
|
||||
* (APR_POLLSET_DEFAULT).
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_poll_method_defname(void);
|
||||
|
||||
/** Opaque structure used for pollset API */
|
||||
typedef struct apr_pollcb_t apr_pollcb_t;
|
||||
|
||||
/**
|
||||
* Set up a pollcb object
|
||||
* @param pollcb The pointer in which to return the newly created object
|
||||
* @param size The maximum number of descriptors that a single _poll can return.
|
||||
* @param p The pool from which to allocate the pollcb
|
||||
* @param flags Optional flags to modify the operation of the pollcb.
|
||||
*
|
||||
* @remark Pollcb is only supported on some platforms; the apr_pollcb_create()
|
||||
* call will fail with APR_ENOTIMPL on platforms where it is not supported.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pollcb_create(apr_pollcb_t **pollcb,
|
||||
apr_uint32_t size,
|
||||
apr_pool_t *p,
|
||||
apr_uint32_t flags);
|
||||
|
||||
/**
|
||||
* Set up a pollcb object
|
||||
* @param pollcb The pointer in which to return the newly created object
|
||||
* @param size The maximum number of descriptors that a single _poll can return.
|
||||
* @param p The pool from which to allocate the pollcb
|
||||
* @param flags Optional flags to modify the operation of the pollcb.
|
||||
* @param method Poll method to use. See #apr_pollset_method_e. If this
|
||||
* method cannot be used, the default method will be used unless the
|
||||
* APR_POLLSET_NODEFAULT flag has been specified.
|
||||
*
|
||||
* @remark Pollcb is only supported on some platforms; the apr_pollcb_create_ex()
|
||||
* call will fail with APR_ENOTIMPL on platforms where it is not supported.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pollcb_create_ex(apr_pollcb_t **pollcb,
|
||||
apr_uint32_t size,
|
||||
apr_pool_t *p,
|
||||
apr_uint32_t flags,
|
||||
apr_pollset_method_e method);
|
||||
|
||||
/**
|
||||
* Add a socket or file descriptor to a pollcb
|
||||
* @param pollcb The pollcb to which to add the descriptor
|
||||
* @param descriptor The descriptor to add
|
||||
* @remark If you set client_data in the descriptor, that value will be
|
||||
* returned in the client_data field whenever this descriptor is
|
||||
* signalled in apr_pollcb_poll().
|
||||
* @remark Unlike the apr_pollset API, the descriptor is not copied, and users
|
||||
* must retain the memory used by descriptor, as the same pointer will
|
||||
* be returned to them from apr_pollcb_poll.
|
||||
* @remark Do not add the same socket or file descriptor to the same pollcb
|
||||
* multiple times, even if the requested events differ for the
|
||||
* different calls to apr_pollcb_add(). If the events of interest
|
||||
* for a descriptor change, you must first remove the descriptor
|
||||
* from the pollcb with apr_pollcb_remove(), then add it again
|
||||
* specifying all requested events.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pollcb_add(apr_pollcb_t *pollcb,
|
||||
apr_pollfd_t *descriptor);
|
||||
/**
|
||||
* Remove a descriptor from a pollcb
|
||||
* @param pollcb The pollcb from which to remove the descriptor
|
||||
* @param descriptor The descriptor to remove
|
||||
* @remark apr_pollcb_remove() cannot be used to remove a subset of requested
|
||||
* events for a descriptor. The reqevents field in the apr_pollfd_t
|
||||
* parameter must contain the same value when removing as when adding.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pollcb_remove(apr_pollcb_t *pollcb,
|
||||
apr_pollfd_t *descriptor);
|
||||
|
||||
/** Function prototype for pollcb handlers
|
||||
* @param baton Opaque baton passed into apr_pollcb_poll()
|
||||
* @param descriptor Contains the notification for an active descriptor,
|
||||
* the rtnevents member contains what events were triggered
|
||||
* for this descriptor.
|
||||
*/
|
||||
typedef apr_status_t (*apr_pollcb_cb_t)(void *baton, apr_pollfd_t *descriptor);
|
||||
|
||||
/**
|
||||
* Block for activity on the descriptor(s) in a pollcb
|
||||
* @param pollcb The pollcb to use
|
||||
* @param timeout The amount of time in microseconds to wait. This is a
|
||||
* maximum, not a minimum. If a descriptor is signalled, the
|
||||
* function will return before this time. If timeout is
|
||||
* negative, the function will block until a descriptor is
|
||||
* signalled.
|
||||
* @param func Callback function to call for each active descriptor.
|
||||
* @param baton Opaque baton passed to the callback function.
|
||||
* @remark Multiple signalled conditions for the same descriptor may be reported
|
||||
* in one or more calls to the callback function, depending on the
|
||||
* implementation.
|
||||
* @bug With versions 1.4.2 and prior on Windows, a call with no descriptors
|
||||
* and timeout will return immediately with the wrong error code.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pollcb_poll(apr_pollcb_t *pollcb,
|
||||
apr_interval_time_t timeout,
|
||||
apr_pollcb_cb_t func,
|
||||
void *baton);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_POLL_H */
|
||||
|
788
include/apr_pools.h
Normal file
788
include/apr_pools.h
Normal file
@ -0,0 +1,788 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_POOLS_H
|
||||
#define APR_POOLS_H
|
||||
|
||||
/**
|
||||
* @file apr_pools.h
|
||||
* @brief APR memory allocation
|
||||
*
|
||||
* Resource allocation routines...
|
||||
*
|
||||
* designed so that we don't have to keep track of EVERYTHING so that
|
||||
* it can be explicitly freed later (a fundamentally unsound strategy ---
|
||||
* particularly in the presence of die()).
|
||||
*
|
||||
* Instead, we maintain pools, and allocate items (both memory and I/O
|
||||
* handlers) from the pools --- currently there are two, one for
|
||||
* per-transaction info, and one for config info. When a transaction is
|
||||
* over, we can delete everything in the per-transaction apr_pool_t without
|
||||
* fear, and without thinking too hard about it either.
|
||||
*
|
||||
* Note that most operations on pools are not thread-safe: a single pool
|
||||
* should only be accessed by a single thread at any given time. The one
|
||||
* exception to this rule is creating a subpool of a given pool: one or more
|
||||
* threads can safely create subpools at the same time that another thread
|
||||
* accesses the parent pool.
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_general.h" /* for APR_STRINGIFY */
|
||||
#define APR_WANT_MEMFUNC /**< for no good reason? */
|
||||
#include "apr_want.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup apr_pools Memory Pool Functions
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** The fundamental pool type */
|
||||
typedef struct apr_pool_t apr_pool_t;
|
||||
|
||||
|
||||
/**
|
||||
* Declaration helper macro to construct apr_foo_pool_get()s.
|
||||
*
|
||||
* This standardized macro is used by opaque (APR) data types to return
|
||||
* the apr_pool_t that is associated with the data type.
|
||||
*
|
||||
* APR_POOL_DECLARE_ACCESSOR() is used in a header file to declare the
|
||||
* accessor function. A typical usage and result would be:
|
||||
* <pre>
|
||||
* APR_POOL_DECLARE_ACCESSOR(file);
|
||||
* becomes:
|
||||
* APR_DECLARE(apr_pool_t *) apr_file_pool_get(apr_file_t *ob);
|
||||
* </pre>
|
||||
* @remark Doxygen unwraps this macro (via doxygen.conf) to provide
|
||||
* actual help for each specific occurance of apr_foo_pool_get.
|
||||
* @remark the linkage is specified for APR. It would be possible to expand
|
||||
* the macros to support other linkages.
|
||||
*/
|
||||
#define APR_POOL_DECLARE_ACCESSOR(type) \
|
||||
APR_DECLARE(apr_pool_t *) apr_##type##_pool_get \
|
||||
(const apr_##type##_t *the##type)
|
||||
|
||||
/**
|
||||
* Implementation helper macro to provide apr_foo_pool_get()s.
|
||||
*
|
||||
* In the implementation, the APR_POOL_IMPLEMENT_ACCESSOR() is used to
|
||||
* actually define the function. It assumes the field is named "pool".
|
||||
*/
|
||||
#define APR_POOL_IMPLEMENT_ACCESSOR(type) \
|
||||
APR_DECLARE(apr_pool_t *) apr_##type##_pool_get \
|
||||
(const apr_##type##_t *the##type) \
|
||||
{ return the##type->pool; }
|
||||
|
||||
|
||||
/**
|
||||
* Pool debug levels
|
||||
*
|
||||
* <pre>
|
||||
* | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|
||||
* ---------------------------------
|
||||
* | | | | | | | | x | General debug code enabled (useful in
|
||||
* combination with --with-efence).
|
||||
*
|
||||
* | | | | | | | x | | Verbose output on stderr (report
|
||||
* CREATE, CLEAR, DESTROY).
|
||||
*
|
||||
* | | | | x | | | | | Verbose output on stderr (report
|
||||
* PALLOC, PCALLOC).
|
||||
*
|
||||
* | | | | | | x | | | Lifetime checking. On each use of a
|
||||
* pool, check its lifetime. If the pool
|
||||
* is out of scope, abort().
|
||||
* In combination with the verbose flag
|
||||
* above, it will output LIFE in such an
|
||||
* event prior to aborting.
|
||||
*
|
||||
* | | | | | x | | | | Pool owner checking. On each use of a
|
||||
* pool, check if the current thread is the
|
||||
* pools owner. If not, abort(). In
|
||||
* combination with the verbose flag above,
|
||||
* it will output OWNER in such an event
|
||||
* prior to aborting. Use the debug
|
||||
* function apr_pool_owner_set() to switch
|
||||
* a pools ownership.
|
||||
*
|
||||
* When no debug level was specified, assume general debug mode.
|
||||
* If level 0 was specified, debugging is switched off
|
||||
* </pre>
|
||||
*/
|
||||
#if defined(APR_POOL_DEBUG)
|
||||
/* If APR_POOL_DEBUG is blank, we get 1; if it is a number, we get -1. */
|
||||
#if (APR_POOL_DEBUG - APR_POOL_DEBUG -1 == 1)
|
||||
#undef APR_POOL_DEBUG
|
||||
#define APR_POOL_DEBUG 1
|
||||
#endif
|
||||
#else
|
||||
#define APR_POOL_DEBUG 0
|
||||
#endif
|
||||
|
||||
/** the place in the code where the particular function was called */
|
||||
#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__)
|
||||
|
||||
|
||||
|
||||
/** A function that is called when allocation fails. */
|
||||
typedef int (*apr_abortfunc_t)(int retcode);
|
||||
|
||||
/*
|
||||
* APR memory structure manipulators (pools, tables, and arrays).
|
||||
*/
|
||||
|
||||
/*
|
||||
* Initialization
|
||||
*/
|
||||
|
||||
/**
|
||||
* Setup all of the internal structures required to use pools
|
||||
* @remark Programs do NOT need to call this directly. APR will call this
|
||||
* automatically from apr_initialize.
|
||||
* @internal
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_initialize(void);
|
||||
|
||||
/**
|
||||
* Tear down all of the internal structures required to use pools
|
||||
* @remark Programs do NOT need to call this directly. APR will call this
|
||||
* automatically from apr_terminate.
|
||||
* @internal
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_terminate(void);
|
||||
|
||||
|
||||
/*
|
||||
* Pool creation/destruction
|
||||
*/
|
||||
|
||||
#include "apr_allocator.h"
|
||||
|
||||
/**
|
||||
* Create a new pool.
|
||||
* @param newpool The pool we have just created.
|
||||
* @param parent The parent pool. If this is NULL, the new pool is a root
|
||||
* pool. If it is non-NULL, the new pool will inherit all
|
||||
* of its parent pool's attributes, except the apr_pool_t will
|
||||
* be a sub-pool.
|
||||
* @param abort_fn A function to use if the pool cannot allocate more memory.
|
||||
* @param allocator The allocator to use with the new pool. If NULL the
|
||||
* allocator of the parent pool will be used.
|
||||
* @remark This function is thread-safe, in the sense that multiple threads
|
||||
* can safely create subpools of the same parent pool concurrently.
|
||||
* Similarly, a subpool can be created by one thread at the same
|
||||
* time that another thread accesses the parent pool.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool,
|
||||
apr_pool_t *parent,
|
||||
apr_abortfunc_t abort_fn,
|
||||
apr_allocator_t *allocator);
|
||||
|
||||
/**
|
||||
* Create a new pool.
|
||||
* @deprecated @see apr_pool_create_unmanaged_ex.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_create_core_ex(apr_pool_t **newpool,
|
||||
apr_abortfunc_t abort_fn,
|
||||
apr_allocator_t *allocator);
|
||||
|
||||
/**
|
||||
* Create a new unmanaged pool.
|
||||
* @param newpool The pool we have just created.
|
||||
* @param abort_fn A function to use if the pool cannot allocate more memory.
|
||||
* @param allocator The allocator to use with the new pool. If NULL a
|
||||
* new allocator will be crated with newpool as owner.
|
||||
* @remark An unmanaged pool is a special pool without a parent; it will
|
||||
* NOT be destroyed upon apr_terminate. It must be explicitly
|
||||
* destroyed by calling apr_pool_destroy, to prevent memory leaks.
|
||||
* Use of this function is discouraged, think twice about whether
|
||||
* you really really need it.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex(apr_pool_t **newpool,
|
||||
apr_abortfunc_t abort_fn,
|
||||
apr_allocator_t *allocator);
|
||||
|
||||
/**
|
||||
* Debug version of apr_pool_create_ex.
|
||||
* @param newpool @see apr_pool_create.
|
||||
* @param parent @see apr_pool_create.
|
||||
* @param abort_fn @see apr_pool_create.
|
||||
* @param allocator @see apr_pool_create.
|
||||
* @param file_line Where the function is called from.
|
||||
* This is usually APR_POOL__FILE_LINE__.
|
||||
* @remark Only available when APR_POOL_DEBUG is defined.
|
||||
* Call this directly if you have you apr_pool_create_ex
|
||||
* calls in a wrapper function and wish to override
|
||||
* the file_line argument to reflect the caller of
|
||||
* your wrapper function. If you do not have
|
||||
* apr_pool_create_ex in a wrapper, trust the macro
|
||||
* and don't call apr_pool_create_ex_debug directly.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_create_ex_debug(apr_pool_t **newpool,
|
||||
apr_pool_t *parent,
|
||||
apr_abortfunc_t abort_fn,
|
||||
apr_allocator_t *allocator,
|
||||
const char *file_line);
|
||||
|
||||
#if APR_POOL_DEBUG
|
||||
#define apr_pool_create_ex(newpool, parent, abort_fn, allocator) \
|
||||
apr_pool_create_ex_debug(newpool, parent, abort_fn, allocator, \
|
||||
APR_POOL__FILE_LINE__)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Debug version of apr_pool_create_core_ex.
|
||||
* @deprecated @see apr_pool_create_unmanaged_ex_debug.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_create_core_ex_debug(apr_pool_t **newpool,
|
||||
apr_abortfunc_t abort_fn,
|
||||
apr_allocator_t *allocator,
|
||||
const char *file_line);
|
||||
|
||||
/**
|
||||
* Debug version of apr_pool_create_unmanaged_ex.
|
||||
* @param newpool @see apr_pool_create_unmanaged.
|
||||
* @param abort_fn @see apr_pool_create_unmanaged.
|
||||
* @param allocator @see apr_pool_create_unmanaged.
|
||||
* @param file_line Where the function is called from.
|
||||
* This is usually APR_POOL__FILE_LINE__.
|
||||
* @remark Only available when APR_POOL_DEBUG is defined.
|
||||
* Call this directly if you have you apr_pool_create_unmanaged_ex
|
||||
* calls in a wrapper function and wish to override
|
||||
* the file_line argument to reflect the caller of
|
||||
* your wrapper function. If you do not have
|
||||
* apr_pool_create_core_ex in a wrapper, trust the macro
|
||||
* and don't call apr_pool_create_core_ex_debug directly.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_create_unmanaged_ex_debug(apr_pool_t **newpool,
|
||||
apr_abortfunc_t abort_fn,
|
||||
apr_allocator_t *allocator,
|
||||
const char *file_line);
|
||||
|
||||
#if APR_POOL_DEBUG
|
||||
#define apr_pool_create_core_ex(newpool, abort_fn, allocator) \
|
||||
apr_pool_create_unmanaged_ex_debug(newpool, abort_fn, allocator, \
|
||||
APR_POOL__FILE_LINE__)
|
||||
|
||||
#define apr_pool_create_unmanaged_ex(newpool, abort_fn, allocator) \
|
||||
apr_pool_create_unmanaged_ex_debug(newpool, abort_fn, allocator, \
|
||||
APR_POOL__FILE_LINE__)
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Create a new pool.
|
||||
* @param newpool The pool we have just created.
|
||||
* @param parent The parent pool. If this is NULL, the new pool is a root
|
||||
* pool. If it is non-NULL, the new pool will inherit all
|
||||
* of its parent pool's attributes, except the apr_pool_t will
|
||||
* be a sub-pool.
|
||||
* @remark This function is thread-safe, in the sense that multiple threads
|
||||
* can safely create subpools of the same parent pool concurrently.
|
||||
* Similarly, a subpool can be created by one thread at the same
|
||||
* time that another thread accesses the parent pool.
|
||||
*/
|
||||
#if defined(DOXYGEN)
|
||||
APR_DECLARE(apr_status_t) apr_pool_create(apr_pool_t **newpool,
|
||||
apr_pool_t *parent);
|
||||
#else
|
||||
#if APR_POOL_DEBUG
|
||||
#define apr_pool_create(newpool, parent) \
|
||||
apr_pool_create_ex_debug(newpool, parent, NULL, NULL, \
|
||||
APR_POOL__FILE_LINE__)
|
||||
#else
|
||||
#define apr_pool_create(newpool, parent) \
|
||||
apr_pool_create_ex(newpool, parent, NULL, NULL)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Create a new pool.
|
||||
* @param newpool The pool we have just created.
|
||||
*/
|
||||
#if defined(DOXYGEN)
|
||||
APR_DECLARE(apr_status_t) apr_pool_create_core(apr_pool_t **newpool);
|
||||
APR_DECLARE(apr_status_t) apr_pool_create_unmanaged(apr_pool_t **newpool);
|
||||
#else
|
||||
#if APR_POOL_DEBUG
|
||||
#define apr_pool_create_core(newpool) \
|
||||
apr_pool_create_unmanaged_ex_debug(newpool, NULL, NULL, \
|
||||
APR_POOL__FILE_LINE__)
|
||||
#define apr_pool_create_unmanaged(newpool) \
|
||||
apr_pool_create_unmanaged_ex_debug(newpool, NULL, NULL, \
|
||||
APR_POOL__FILE_LINE__)
|
||||
#else
|
||||
#define apr_pool_create_core(newpool) \
|
||||
apr_pool_create_unmanaged_ex(newpool, NULL, NULL)
|
||||
#define apr_pool_create_unmanaged(newpool) \
|
||||
apr_pool_create_unmanaged_ex(newpool, NULL, NULL)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Find the pool's allocator
|
||||
* @param pool The pool to get the allocator from.
|
||||
*/
|
||||
APR_DECLARE(apr_allocator_t *) apr_pool_allocator_get(apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Clear all memory in the pool and run all the cleanups. This also destroys all
|
||||
* subpools.
|
||||
* @param p The pool to clear
|
||||
* @remark This does not actually free the memory, it just allows the pool
|
||||
* to re-use this memory for the next allocation.
|
||||
* @see apr_pool_destroy()
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_clear(apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Debug version of apr_pool_clear.
|
||||
* @param p See: apr_pool_clear.
|
||||
* @param file_line Where the function is called from.
|
||||
* This is usually APR_POOL__FILE_LINE__.
|
||||
* @remark Only available when APR_POOL_DEBUG is defined.
|
||||
* Call this directly if you have you apr_pool_clear
|
||||
* calls in a wrapper function and wish to override
|
||||
* the file_line argument to reflect the caller of
|
||||
* your wrapper function. If you do not have
|
||||
* apr_pool_clear in a wrapper, trust the macro
|
||||
* and don't call apr_pool_destroy_clear directly.
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_clear_debug(apr_pool_t *p,
|
||||
const char *file_line);
|
||||
|
||||
#if APR_POOL_DEBUG
|
||||
#define apr_pool_clear(p) \
|
||||
apr_pool_clear_debug(p, APR_POOL__FILE_LINE__)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Destroy the pool. This takes similar action as apr_pool_clear() and then
|
||||
* frees all the memory.
|
||||
* @param p The pool to destroy
|
||||
* @remark This will actually free the memory
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_destroy(apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Debug version of apr_pool_destroy.
|
||||
* @param p See: apr_pool_destroy.
|
||||
* @param file_line Where the function is called from.
|
||||
* This is usually APR_POOL__FILE_LINE__.
|
||||
* @remark Only available when APR_POOL_DEBUG is defined.
|
||||
* Call this directly if you have you apr_pool_destroy
|
||||
* calls in a wrapper function and wish to override
|
||||
* the file_line argument to reflect the caller of
|
||||
* your wrapper function. If you do not have
|
||||
* apr_pool_destroy in a wrapper, trust the macro
|
||||
* and don't call apr_pool_destroy_debug directly.
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_destroy_debug(apr_pool_t *p,
|
||||
const char *file_line);
|
||||
|
||||
#if APR_POOL_DEBUG
|
||||
#define apr_pool_destroy(p) \
|
||||
apr_pool_destroy_debug(p, APR_POOL__FILE_LINE__)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Memory allocation
|
||||
*/
|
||||
|
||||
/**
|
||||
* Allocate a block of memory from a pool
|
||||
* @param p The pool to allocate from
|
||||
* @param size The amount of memory to allocate
|
||||
* @return The allocated memory
|
||||
*/
|
||||
APR_DECLARE(void *) apr_palloc(apr_pool_t *p, apr_size_t size);
|
||||
|
||||
/**
|
||||
* Debug version of apr_palloc
|
||||
* @param p See: apr_palloc
|
||||
* @param size See: apr_palloc
|
||||
* @param file_line Where the function is called from.
|
||||
* This is usually APR_POOL__FILE_LINE__.
|
||||
* @return See: apr_palloc
|
||||
*/
|
||||
APR_DECLARE(void *) apr_palloc_debug(apr_pool_t *p, apr_size_t size,
|
||||
const char *file_line);
|
||||
|
||||
#if APR_POOL_DEBUG
|
||||
#define apr_palloc(p, size) \
|
||||
apr_palloc_debug(p, size, APR_POOL__FILE_LINE__)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Allocate a block of memory from a pool and set all of the memory to 0
|
||||
* @param p The pool to allocate from
|
||||
* @param size The amount of memory to allocate
|
||||
* @return The allocated memory
|
||||
*/
|
||||
#if defined(DOXYGEN)
|
||||
APR_DECLARE(void *) apr_pcalloc(apr_pool_t *p, apr_size_t size);
|
||||
#elif !APR_POOL_DEBUG
|
||||
#define apr_pcalloc(p, size) memset(apr_palloc(p, size), 0, size)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Debug version of apr_pcalloc
|
||||
* @param p See: apr_pcalloc
|
||||
* @param size See: apr_pcalloc
|
||||
* @param file_line Where the function is called from.
|
||||
* This is usually APR_POOL__FILE_LINE__.
|
||||
* @return See: apr_pcalloc
|
||||
*/
|
||||
APR_DECLARE(void *) apr_pcalloc_debug(apr_pool_t *p, apr_size_t size,
|
||||
const char *file_line);
|
||||
|
||||
#if APR_POOL_DEBUG
|
||||
#define apr_pcalloc(p, size) \
|
||||
apr_pcalloc_debug(p, size, APR_POOL__FILE_LINE__)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Pool Properties
|
||||
*/
|
||||
|
||||
/**
|
||||
* Set the function to be called when an allocation failure occurs.
|
||||
* @remark If the program wants APR to exit on a memory allocation error,
|
||||
* then this function can be called to set the callback to use (for
|
||||
* performing cleanup and then exiting). If this function is not called,
|
||||
* then APR will return an error and expect the calling program to
|
||||
* deal with the error accordingly.
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_abort_set(apr_abortfunc_t abortfunc,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Get the abort function associated with the specified pool.
|
||||
* @param pool The pool for retrieving the abort function.
|
||||
* @return The abort function for the given pool.
|
||||
*/
|
||||
APR_DECLARE(apr_abortfunc_t) apr_pool_abort_get(apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Get the parent pool of the specified pool.
|
||||
* @param pool The pool for retrieving the parent pool.
|
||||
* @return The parent of the given pool.
|
||||
*/
|
||||
APR_DECLARE(apr_pool_t *) apr_pool_parent_get(apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Determine if pool a is an ancestor of pool b.
|
||||
* @param a The pool to search
|
||||
* @param b The pool to search for
|
||||
* @return True if a is an ancestor of b, NULL is considered an ancestor
|
||||
* of all pools.
|
||||
* @remark if compiled with APR_POOL_DEBUG, this function will also
|
||||
* return true if A is a pool which has been guaranteed by the caller
|
||||
* (using apr_pool_join) to have a lifetime at least as long as some
|
||||
* ancestor of pool B.
|
||||
*/
|
||||
APR_DECLARE(int) apr_pool_is_ancestor(apr_pool_t *a, apr_pool_t *b);
|
||||
|
||||
/**
|
||||
* Tag a pool (give it a name)
|
||||
* @param pool The pool to tag
|
||||
* @param tag The tag
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_tag(apr_pool_t *pool, const char *tag);
|
||||
|
||||
|
||||
/*
|
||||
* User data management
|
||||
*/
|
||||
|
||||
/**
|
||||
* Set the data associated with the current pool
|
||||
* @param data The user data associated with the pool.
|
||||
* @param key The key to use for association
|
||||
* @param cleanup The cleanup program to use to cleanup the data (NULL if none)
|
||||
* @param pool The current pool
|
||||
* @warning The data to be attached to the pool should have a life span
|
||||
* at least as long as the pool it is being attached to.
|
||||
*
|
||||
* Users of APR must take EXTREME care when choosing a key to
|
||||
* use for their data. It is possible to accidentally overwrite
|
||||
* data by choosing a key that another part of the program is using.
|
||||
* Therefore it is advised that steps are taken to ensure that unique
|
||||
* keys are used for all of the userdata objects in a particular pool
|
||||
* (the same key in two different pools or a pool and one of its
|
||||
* subpools is okay) at all times. Careful namespace prefixing of
|
||||
* key names is a typical way to help ensure this uniqueness.
|
||||
*
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_userdata_set(
|
||||
const void *data,
|
||||
const char *key,
|
||||
apr_status_t (*cleanup)(void *),
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Set the data associated with the current pool
|
||||
* @param data The user data associated with the pool.
|
||||
* @param key The key to use for association
|
||||
* @param cleanup The cleanup program to use to cleanup the data (NULL if none)
|
||||
* @param pool The current pool
|
||||
* @note same as apr_pool_userdata_set(), except that this version doesn't
|
||||
* make a copy of the key (this function is useful, for example, when
|
||||
* the key is a string literal)
|
||||
* @warning This should NOT be used if the key could change addresses by
|
||||
* any means between the apr_pool_userdata_setn() call and a
|
||||
* subsequent apr_pool_userdata_get() on that key, such as if a
|
||||
* static string is used as a userdata key in a DSO and the DSO could
|
||||
* be unloaded and reloaded between the _setn() and the _get(). You
|
||||
* MUST use apr_pool_userdata_set() in such cases.
|
||||
* @warning More generally, the key and the data to be attached to the
|
||||
* pool should have a life span at least as long as the pool itself.
|
||||
*
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_userdata_setn(
|
||||
const void *data,
|
||||
const char *key,
|
||||
apr_status_t (*cleanup)(void *),
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Return the data associated with the current pool.
|
||||
* @param data The user data associated with the pool.
|
||||
* @param key The key for the data to retrieve
|
||||
* @param pool The current pool.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_userdata_get(void **data, const char *key,
|
||||
apr_pool_t *pool);
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup PoolCleanup Pool Cleanup Functions
|
||||
*
|
||||
* Cleanups are performed in the reverse order they were registered. That is:
|
||||
* Last In, First Out. A cleanup function can safely allocate memory from
|
||||
* the pool that is being cleaned up. It can also safely register additional
|
||||
* cleanups which will be run LIFO, directly after the current cleanup
|
||||
* terminates. Cleanups have to take caution in calling functions that
|
||||
* create subpools. Subpools, created during cleanup will NOT automatically
|
||||
* be cleaned up. In other words, cleanups are to clean up after themselves.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Register a function to be called when a pool is cleared or destroyed
|
||||
* @param p The pool register the cleanup with
|
||||
* @param data The data to pass to the cleanup function.
|
||||
* @param plain_cleanup The function to call when the pool is cleared
|
||||
* or destroyed
|
||||
* @param child_cleanup The function to call when a child process is about
|
||||
* to exec - this function is called in the child, obviously!
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_cleanup_register(
|
||||
apr_pool_t *p,
|
||||
const void *data,
|
||||
apr_status_t (*plain_cleanup)(void *),
|
||||
apr_status_t (*child_cleanup)(void *));
|
||||
|
||||
/**
|
||||
* Register a function to be called when a pool is cleared or destroyed.
|
||||
*
|
||||
* Unlike apr_pool_cleanup_register which register a cleanup
|
||||
* that is called AFTER all subpools are destroyed this function register
|
||||
* a function that will be called before any of the subpool is destoryed.
|
||||
*
|
||||
* @param p The pool register the cleanup with
|
||||
* @param data The data to pass to the cleanup function.
|
||||
* @param plain_cleanup The function to call when the pool is cleared
|
||||
* or destroyed
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_pre_cleanup_register(
|
||||
apr_pool_t *p,
|
||||
const void *data,
|
||||
apr_status_t (*plain_cleanup)(void *));
|
||||
|
||||
/**
|
||||
* Remove a previously registered cleanup function.
|
||||
*
|
||||
* The cleanup most recently registered with @a p having the same values of
|
||||
* @a data and @a cleanup will be removed.
|
||||
*
|
||||
* @param p The pool to remove the cleanup from
|
||||
* @param data The data of the registered cleanup
|
||||
* @param cleanup The function to remove from cleanup
|
||||
* @remarks For some strange reason only the plain_cleanup is handled by this
|
||||
* function
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_cleanup_kill(apr_pool_t *p, const void *data,
|
||||
apr_status_t (*cleanup)(void *));
|
||||
|
||||
/**
|
||||
* Replace the child cleanup function of a previously registered cleanup.
|
||||
*
|
||||
* The cleanup most recently registered with @a p having the same values of
|
||||
* @a data and @a plain_cleanup will have the registered child cleanup
|
||||
* function replaced with @a child_cleanup.
|
||||
*
|
||||
* @param p The pool of the registered cleanup
|
||||
* @param data The data of the registered cleanup
|
||||
* @param plain_cleanup The plain cleanup function of the registered cleanup
|
||||
* @param child_cleanup The function to register as the child cleanup
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_child_cleanup_set(
|
||||
apr_pool_t *p,
|
||||
const void *data,
|
||||
apr_status_t (*plain_cleanup)(void *),
|
||||
apr_status_t (*child_cleanup)(void *));
|
||||
|
||||
/**
|
||||
* Run the specified cleanup function immediately and unregister it.
|
||||
*
|
||||
* The cleanup most recently registered with @a p having the same values of
|
||||
* @a data and @a cleanup will be removed and @a cleanup will be called
|
||||
* with @a data as the argument.
|
||||
*
|
||||
* @param p The pool to remove the cleanup from
|
||||
* @param data The data to remove from cleanup
|
||||
* @param cleanup The function to remove from cleanup
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_pool_cleanup_run(
|
||||
apr_pool_t *p,
|
||||
void *data,
|
||||
apr_status_t (*cleanup)(void *));
|
||||
|
||||
/**
|
||||
* An empty cleanup function.
|
||||
*
|
||||
* Passed to apr_pool_cleanup_register() when no cleanup is required.
|
||||
*
|
||||
* @param data The data to cleanup, will not be used by this function.
|
||||
*/
|
||||
APR_DECLARE_NONSTD(apr_status_t) apr_pool_cleanup_null(void *data);
|
||||
|
||||
/**
|
||||
* Run all registered child cleanups, in preparation for an exec()
|
||||
* call in a forked child -- close files, etc., but *don't* flush I/O
|
||||
* buffers, *don't* wait for subprocesses, and *don't* free any
|
||||
* memory.
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_cleanup_for_exec(void);
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup PoolDebug Pool Debugging functions.
|
||||
*
|
||||
* pools have nested lifetimes -- sub_pools are destroyed when the
|
||||
* parent pool is cleared. We allow certain liberties with operations
|
||||
* on things such as tables (and on other structures in a more general
|
||||
* sense) where we allow the caller to insert values into a table which
|
||||
* were not allocated from the table's pool. The table's data will
|
||||
* remain valid as long as all the pools from which its values are
|
||||
* allocated remain valid.
|
||||
*
|
||||
* For example, if B is a sub pool of A, and you build a table T in
|
||||
* pool B, then it's safe to insert data allocated in A or B into T
|
||||
* (because B lives at most as long as A does, and T is destroyed when
|
||||
* B is cleared/destroyed). On the other hand, if S is a table in
|
||||
* pool A, it is safe to insert data allocated in A into S, but it
|
||||
* is *not safe* to insert data allocated from B into S... because
|
||||
* B can be cleared/destroyed before A is (which would leave dangling
|
||||
* pointers in T's data structures).
|
||||
*
|
||||
* In general we say that it is safe to insert data into a table T
|
||||
* if the data is allocated in any ancestor of T's pool. This is the
|
||||
* basis on which the APR_POOL_DEBUG code works -- it tests these ancestor
|
||||
* relationships for all data inserted into tables. APR_POOL_DEBUG also
|
||||
* provides tools (apr_pool_find, and apr_pool_is_ancestor) for other
|
||||
* folks to implement similar restrictions for their own data
|
||||
* structures.
|
||||
*
|
||||
* However, sometimes this ancestor requirement is inconvenient --
|
||||
* sometimes it's necessary to create a sub pool where the sub pool is
|
||||
* guaranteed to have the same lifetime as the parent pool. This is a
|
||||
* guarantee implemented by the *caller*, not by the pool code. That
|
||||
* is, the caller guarantees they won't destroy the sub pool
|
||||
* individually prior to destroying the parent pool.
|
||||
*
|
||||
* In this case the caller must call apr_pool_join() to indicate this
|
||||
* guarantee to the APR_POOL_DEBUG code.
|
||||
*
|
||||
* These functions are only implemented when #APR_POOL_DEBUG is set.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
#if APR_POOL_DEBUG || defined(DOXYGEN)
|
||||
/**
|
||||
* Guarantee that a subpool has the same lifetime as the parent.
|
||||
* @param p The parent pool
|
||||
* @param sub The subpool
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_join(apr_pool_t *p, apr_pool_t *sub);
|
||||
|
||||
/**
|
||||
* Find a pool from something allocated in it.
|
||||
* @param mem The thing allocated in the pool
|
||||
* @return The pool it is allocated in
|
||||
*/
|
||||
APR_DECLARE(apr_pool_t *) apr_pool_find(const void *mem);
|
||||
|
||||
/**
|
||||
* Report the number of bytes currently in the pool
|
||||
* @param p The pool to inspect
|
||||
* @param recurse Recurse/include the subpools' sizes
|
||||
* @return The number of bytes
|
||||
*/
|
||||
APR_DECLARE(apr_size_t) apr_pool_num_bytes(apr_pool_t *p, int recurse);
|
||||
|
||||
/**
|
||||
* Lock a pool
|
||||
* @param pool The pool to lock
|
||||
* @param flag The flag
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_lock(apr_pool_t *pool, int flag);
|
||||
|
||||
/* @} */
|
||||
|
||||
#else /* APR_POOL_DEBUG or DOXYGEN */
|
||||
|
||||
#ifdef apr_pool_join
|
||||
#undef apr_pool_join
|
||||
#endif
|
||||
#define apr_pool_join(a,b)
|
||||
|
||||
#ifdef apr_pool_lock
|
||||
#undef apr_pool_lock
|
||||
#endif
|
||||
#define apr_pool_lock(pool, lock)
|
||||
|
||||
#endif /* APR_POOL_DEBUG or DOXYGEN */
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !APR_POOLS_H */
|
508
include/apr_portable.h
Normal file
508
include/apr_portable.h
Normal file
@ -0,0 +1,508 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* This header file is where you should put ANY platform specific information.
|
||||
* This should be the only header file that programs need to include that
|
||||
* actually has platform dependent code which refers to the .
|
||||
*/
|
||||
#ifndef APR_PORTABLE_H
|
||||
#define APR_PORTABLE_H
|
||||
/**
|
||||
* @file apr_portable.h
|
||||
* @brief APR Portability Routines
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_thread_proc.h"
|
||||
#include "apr_file_io.h"
|
||||
#include "apr_network_io.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_global_mutex.h"
|
||||
#include "apr_proc_mutex.h"
|
||||
#include "apr_time.h"
|
||||
#include "apr_dso.h"
|
||||
#include "apr_shm.h"
|
||||
|
||||
#if APR_HAVE_DIRENT_H
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
#if APR_HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#if APR_HAVE_PTHREAD_H
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_portabile Portability Routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
/* The primitives for Windows types */
|
||||
typedef HANDLE apr_os_file_t;
|
||||
typedef HANDLE apr_os_dir_t;
|
||||
typedef SOCKET apr_os_sock_t;
|
||||
typedef HANDLE apr_os_proc_mutex_t;
|
||||
typedef HANDLE apr_os_thread_t;
|
||||
typedef HANDLE apr_os_proc_t;
|
||||
typedef DWORD apr_os_threadkey_t;
|
||||
typedef FILETIME apr_os_imp_time_t;
|
||||
typedef SYSTEMTIME apr_os_exp_time_t;
|
||||
typedef HANDLE apr_os_dso_handle_t;
|
||||
typedef HANDLE apr_os_shm_t;
|
||||
|
||||
#elif defined(OS2)
|
||||
typedef HFILE apr_os_file_t;
|
||||
typedef HDIR apr_os_dir_t;
|
||||
typedef int apr_os_sock_t;
|
||||
typedef HMTX apr_os_proc_mutex_t;
|
||||
typedef TID apr_os_thread_t;
|
||||
typedef PID apr_os_proc_t;
|
||||
typedef PULONG apr_os_threadkey_t;
|
||||
typedef struct timeval apr_os_imp_time_t;
|
||||
typedef struct tm apr_os_exp_time_t;
|
||||
typedef HMODULE apr_os_dso_handle_t;
|
||||
typedef void* apr_os_shm_t;
|
||||
|
||||
#elif defined(__BEOS__)
|
||||
#include <kernel/OS.h>
|
||||
#include <kernel/image.h>
|
||||
|
||||
struct apr_os_proc_mutex_t {
|
||||
sem_id sem;
|
||||
int32 ben;
|
||||
};
|
||||
|
||||
typedef int apr_os_file_t;
|
||||
typedef DIR apr_os_dir_t;
|
||||
typedef int apr_os_sock_t;
|
||||
typedef struct apr_os_proc_mutex_t apr_os_proc_mutex_t;
|
||||
typedef thread_id apr_os_thread_t;
|
||||
typedef thread_id apr_os_proc_t;
|
||||
typedef int apr_os_threadkey_t;
|
||||
typedef struct timeval apr_os_imp_time_t;
|
||||
typedef struct tm apr_os_exp_time_t;
|
||||
typedef image_id apr_os_dso_handle_t;
|
||||
typedef void* apr_os_shm_t;
|
||||
|
||||
#elif defined(NETWARE)
|
||||
typedef int apr_os_file_t;
|
||||
typedef DIR apr_os_dir_t;
|
||||
typedef int apr_os_sock_t;
|
||||
typedef NXMutex_t apr_os_proc_mutex_t;
|
||||
typedef NXThreadId_t apr_os_thread_t;
|
||||
typedef long apr_os_proc_t;
|
||||
typedef NXKey_t apr_os_threadkey_t;
|
||||
typedef struct timeval apr_os_imp_time_t;
|
||||
typedef struct tm apr_os_exp_time_t;
|
||||
typedef void * apr_os_dso_handle_t;
|
||||
typedef void* apr_os_shm_t;
|
||||
|
||||
#else
|
||||
/* Any other OS should go above this one. This is the lowest common
|
||||
* denominator typedefs for all UNIX-like systems. :)
|
||||
*/
|
||||
|
||||
/** Basic OS process mutex structure. */
|
||||
struct apr_os_proc_mutex_t {
|
||||
#if APR_HAS_SYSVSEM_SERIALIZE || APR_HAS_FCNTL_SERIALIZE || APR_HAS_FLOCK_SERIALIZE
|
||||
/** Value used for SYS V Semaphore, FCNTL and FLOCK serialization */
|
||||
int crossproc;
|
||||
#endif
|
||||
#if APR_HAS_PROC_PTHREAD_SERIALIZE
|
||||
/** Value used for PTHREAD serialization */
|
||||
pthread_mutex_t *pthread_interproc;
|
||||
#endif
|
||||
#if APR_HAS_THREADS
|
||||
/* If no threads, no need for thread locks */
|
||||
#if APR_USE_PTHREAD_SERIALIZE
|
||||
/** This value is currently unused within APR and Apache */
|
||||
pthread_mutex_t *intraproc;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef int apr_os_file_t; /**< native file */
|
||||
typedef DIR apr_os_dir_t; /**< native dir */
|
||||
typedef int apr_os_sock_t; /**< native dir */
|
||||
typedef struct apr_os_proc_mutex_t apr_os_proc_mutex_t; /**< native process
|
||||
* mutex
|
||||
*/
|
||||
#if APR_HAS_THREADS && APR_HAVE_PTHREAD_H
|
||||
typedef pthread_t apr_os_thread_t; /**< native thread */
|
||||
typedef pthread_key_t apr_os_threadkey_t; /**< native thread address
|
||||
* space */
|
||||
#endif
|
||||
typedef pid_t apr_os_proc_t; /**< native pid */
|
||||
typedef struct timeval apr_os_imp_time_t; /**< native timeval */
|
||||
typedef struct tm apr_os_exp_time_t; /**< native tm */
|
||||
/** @var apr_os_dso_handle_t
|
||||
* native dso types
|
||||
*/
|
||||
#if defined(HPUX) || defined(HPUX10) || defined(HPUX11)
|
||||
#include <dl.h>
|
||||
typedef shl_t apr_os_dso_handle_t;
|
||||
#elif defined(DARWIN)
|
||||
#include <mach-o/dyld.h>
|
||||
typedef NSModule apr_os_dso_handle_t;
|
||||
#else
|
||||
typedef void * apr_os_dso_handle_t;
|
||||
#endif
|
||||
typedef void* apr_os_shm_t; /**< native SHM */
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @typedef apr_os_sock_info_t
|
||||
* @brief alias for local OS socket
|
||||
*/
|
||||
/**
|
||||
* everything APR needs to know about an active socket to construct
|
||||
* an APR socket from it; currently, this is platform-independent
|
||||
*/
|
||||
struct apr_os_sock_info_t {
|
||||
apr_os_sock_t *os_sock; /**< always required */
|
||||
struct sockaddr *local; /**< NULL if not yet bound */
|
||||
struct sockaddr *remote; /**< NULL if not connected */
|
||||
int family; /**< always required (APR_INET, APR_INET6, etc.) */
|
||||
int type; /**< always required (SOCK_STREAM, SOCK_DGRAM, etc.) */
|
||||
int protocol; /**< 0 or actual protocol (APR_PROTO_SCTP, APR_PROTO_TCP, etc.) */
|
||||
};
|
||||
|
||||
typedef struct apr_os_sock_info_t apr_os_sock_info_t;
|
||||
|
||||
#if APR_PROC_MUTEX_IS_GLOBAL || defined(DOXYGEN)
|
||||
/** Opaque global mutex type */
|
||||
#define apr_os_global_mutex_t apr_os_proc_mutex_t
|
||||
/** @return apr_os_global_mutex */
|
||||
#define apr_os_global_mutex_get apr_os_proc_mutex_get
|
||||
#else
|
||||
/** Thread and process mutex for those platforms where process mutexes
|
||||
* are not held in threads.
|
||||
*/
|
||||
struct apr_os_global_mutex_t {
|
||||
apr_pool_t *pool;
|
||||
apr_proc_mutex_t *proc_mutex;
|
||||
#if APR_HAS_THREADS
|
||||
apr_thread_mutex_t *thread_mutex;
|
||||
#endif /* APR_HAS_THREADS */
|
||||
};
|
||||
typedef struct apr_os_global_mutex_t apr_os_global_mutex_t;
|
||||
|
||||
APR_DECLARE(apr_status_t) apr_os_global_mutex_get(apr_os_global_mutex_t *ospmutex,
|
||||
apr_global_mutex_t *pmutex);
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* convert the file from apr type to os specific type.
|
||||
* @param thefile The os specific file we are converting to
|
||||
* @param file The apr file to convert.
|
||||
* @remark On Unix, it is only possible to get a file descriptor from
|
||||
* an apr file type.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_file_get(apr_os_file_t *thefile,
|
||||
apr_file_t *file);
|
||||
|
||||
/**
|
||||
* convert the dir from apr type to os specific type.
|
||||
* @param thedir The os specific dir we are converting to
|
||||
* @param dir The apr dir to convert.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_dir_get(apr_os_dir_t **thedir,
|
||||
apr_dir_t *dir);
|
||||
|
||||
/**
|
||||
* Convert the socket from an apr type to an OS specific socket
|
||||
* @param thesock The socket to convert.
|
||||
* @param sock The os specific equivalent of the apr socket..
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_sock_get(apr_os_sock_t *thesock,
|
||||
apr_socket_t *sock);
|
||||
|
||||
/**
|
||||
* Convert the proc mutex from os specific type to apr type
|
||||
* @param ospmutex The os specific proc mutex we are converting to.
|
||||
* @param pmutex The apr proc mutex to convert.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_proc_mutex_get(apr_os_proc_mutex_t *ospmutex,
|
||||
apr_proc_mutex_t *pmutex);
|
||||
|
||||
/**
|
||||
* Get the exploded time in the platforms native format.
|
||||
* @param ostime the native time format
|
||||
* @param aprtime the time to convert
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_exp_time_get(apr_os_exp_time_t **ostime,
|
||||
apr_time_exp_t *aprtime);
|
||||
|
||||
/**
|
||||
* Get the imploded time in the platforms native format.
|
||||
* @param ostime the native time format
|
||||
* @param aprtime the time to convert
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_imp_time_get(apr_os_imp_time_t **ostime,
|
||||
apr_time_t *aprtime);
|
||||
|
||||
/**
|
||||
* convert the shm from apr type to os specific type.
|
||||
* @param osshm The os specific shm representation
|
||||
* @param shm The apr shm to convert.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_shm_get(apr_os_shm_t *osshm,
|
||||
apr_shm_t *shm);
|
||||
|
||||
#if APR_HAS_THREADS || defined(DOXYGEN)
|
||||
/**
|
||||
* @defgroup apr_os_thread Thread portability Routines
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* convert the thread to os specific type from apr type.
|
||||
* @param thethd The apr thread to convert
|
||||
* @param thd The os specific thread we are converting to
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd,
|
||||
apr_thread_t *thd);
|
||||
|
||||
/**
|
||||
* convert the thread private memory key to os specific type from an apr type.
|
||||
* @param thekey The apr handle we are converting from.
|
||||
* @param key The os specific handle we are converting to.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_threadkey_get(apr_os_threadkey_t *thekey,
|
||||
apr_threadkey_t *key);
|
||||
|
||||
/**
|
||||
* convert the thread from os specific type to apr type.
|
||||
* @param thd The apr thread we are converting to.
|
||||
* @param thethd The os specific thread to convert
|
||||
* @param cont The pool to use if it is needed.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd,
|
||||
apr_os_thread_t *thethd,
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* convert the thread private memory key from os specific type to apr type.
|
||||
* @param key The apr handle we are converting to.
|
||||
* @param thekey The os specific handle to convert
|
||||
* @param cont The pool to use if it is needed.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_threadkey_put(apr_threadkey_t **key,
|
||||
apr_os_threadkey_t *thekey,
|
||||
apr_pool_t *cont);
|
||||
/**
|
||||
* Get the thread ID
|
||||
*/
|
||||
APR_DECLARE(apr_os_thread_t) apr_os_thread_current(void);
|
||||
|
||||
/**
|
||||
* Compare two thread id's
|
||||
* @param tid1 1st Thread ID to compare
|
||||
* @param tid2 2nd Thread ID to compare
|
||||
* @return non-zero if the two threads are equal, zero otherwise
|
||||
*/
|
||||
APR_DECLARE(int) apr_os_thread_equal(apr_os_thread_t tid1,
|
||||
apr_os_thread_t tid2);
|
||||
|
||||
/** @} */
|
||||
#endif /* APR_HAS_THREADS */
|
||||
|
||||
/**
|
||||
* convert the file from os specific type to apr type.
|
||||
* @param file The apr file we are converting to.
|
||||
* @param thefile The os specific file to convert
|
||||
* @param flags The flags that were used to open this file.
|
||||
* @param cont The pool to use if it is needed.
|
||||
* @remark On Unix, it is only possible to put a file descriptor into
|
||||
* an apr file type.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file,
|
||||
apr_os_file_t *thefile,
|
||||
apr_int32_t flags, apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* convert the file from os specific type to apr type.
|
||||
* @param file The apr file we are converting to.
|
||||
* @param thefile The os specific pipe to convert
|
||||
* @param cont The pool to use if it is needed.
|
||||
* @remark On Unix, it is only possible to put a file descriptor into
|
||||
* an apr file type.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file,
|
||||
apr_os_file_t *thefile,
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* convert the file from os specific type to apr type.
|
||||
* @param file The apr file we are converting to.
|
||||
* @param thefile The os specific pipe to convert
|
||||
* @param register_cleanup A cleanup will be registered on the apr_file_t
|
||||
* to issue apr_file_close().
|
||||
* @param cont The pool to use if it is needed.
|
||||
* @remark On Unix, it is only possible to put a file descriptor into
|
||||
* an apr file type.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file,
|
||||
apr_os_file_t *thefile,
|
||||
int register_cleanup,
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* convert the dir from os specific type to apr type.
|
||||
* @param dir The apr dir we are converting to.
|
||||
* @param thedir The os specific dir to convert
|
||||
* @param cont The pool to use when creating to apr directory.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_dir_put(apr_dir_t **dir,
|
||||
apr_os_dir_t *thedir,
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* Convert a socket from the os specific type to the apr type
|
||||
* @param sock The pool to use.
|
||||
* @param thesock The socket to convert to.
|
||||
* @param cont The socket we are converting to an apr type.
|
||||
* @remark If it is a true socket, it is best to call apr_os_sock_make()
|
||||
* and provide APR with more information about the socket.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_sock_put(apr_socket_t **sock,
|
||||
apr_os_sock_t *thesock,
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* Create a socket from an existing descriptor and local and remote
|
||||
* socket addresses.
|
||||
* @param apr_sock The new socket that has been set up
|
||||
* @param os_sock_info The os representation of the socket handle and
|
||||
* other characteristics of the socket
|
||||
* @param cont The pool to use
|
||||
* @remark If you only know the descriptor/handle or if it isn't really
|
||||
* a true socket, use apr_os_sock_put() instead.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_sock_make(apr_socket_t **apr_sock,
|
||||
apr_os_sock_info_t *os_sock_info,
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* Convert the proc mutex from os specific type to apr type
|
||||
* @param pmutex The apr proc mutex we are converting to.
|
||||
* @param ospmutex The os specific proc mutex to convert.
|
||||
* @param cont The pool to use if it is needed.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_proc_mutex_put(apr_proc_mutex_t **pmutex,
|
||||
apr_os_proc_mutex_t *ospmutex,
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* Put the imploded time in the APR format.
|
||||
* @param aprtime the APR time format
|
||||
* @param ostime the time to convert
|
||||
* @param cont the pool to use if necessary
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_imp_time_put(apr_time_t *aprtime,
|
||||
apr_os_imp_time_t **ostime,
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* Put the exploded time in the APR format.
|
||||
* @param aprtime the APR time format
|
||||
* @param ostime the time to convert
|
||||
* @param cont the pool to use if necessary
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_exp_time_put(apr_time_exp_t *aprtime,
|
||||
apr_os_exp_time_t **ostime,
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* convert the shared memory from os specific type to apr type.
|
||||
* @param shm The apr shm representation of osshm
|
||||
* @param osshm The os specific shm identity
|
||||
* @param cont The pool to use if it is needed.
|
||||
* @remark On fork()ed architectures, this is typically nothing more than
|
||||
* the memory block mapped. On non-fork architectures, this is typically
|
||||
* some internal handle to pass the mapping from process to process.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_shm_put(apr_shm_t **shm,
|
||||
apr_os_shm_t *osshm,
|
||||
apr_pool_t *cont);
|
||||
|
||||
|
||||
#if APR_HAS_DSO || defined(DOXYGEN)
|
||||
/**
|
||||
* @defgroup apr_os_dso DSO (Dynamic Loading) Portability Routines
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* convert the dso handle from os specific to apr
|
||||
* @param dso The apr handle we are converting to
|
||||
* @param thedso the os specific handle to convert
|
||||
* @param pool the pool to use if it is needed
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_dso_handle_put(apr_dso_handle_t **dso,
|
||||
apr_os_dso_handle_t thedso,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* convert the apr dso handle into an os specific one
|
||||
* @param aprdso The apr dso handle to convert
|
||||
* @param dso The os specific dso to return
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_dso_handle_get(apr_os_dso_handle_t *dso,
|
||||
apr_dso_handle_t *aprdso);
|
||||
|
||||
/** @} */
|
||||
#endif /* APR_HAS_DSO */
|
||||
|
||||
|
||||
#if APR_HAS_OS_UUID
|
||||
/**
|
||||
* Private: apr-util's apr_uuid module when supported by the platform
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_os_uuid_get(unsigned char *uuid_data);
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Get the name of the system default character set.
|
||||
* @param pool the pool to allocate the name from, if needed
|
||||
*/
|
||||
APR_DECLARE(const char*) apr_os_default_encoding(apr_pool_t *pool);
|
||||
|
||||
|
||||
/**
|
||||
* Get the name of the current locale character set.
|
||||
* @param pool the pool to allocate the name from, if needed
|
||||
* @remark Defers to apr_os_default_encoding if the current locale's
|
||||
* data can't be retrieved on this system.
|
||||
*/
|
||||
APR_DECLARE(const char*) apr_os_locale_encoding(apr_pool_t *pool);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_PORTABLE_H */
|
166
include/apr_proc_mutex.h
Normal file
166
include/apr_proc_mutex.h
Normal file
@ -0,0 +1,166 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_PROC_MUTEX_H
|
||||
#define APR_PROC_MUTEX_H
|
||||
|
||||
/**
|
||||
* @file apr_proc_mutex.h
|
||||
* @brief APR Process Locking Routines
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_proc_mutex Process Locking Routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Enumerated potential types for APR process locking methods
|
||||
* @warning Check APR_HAS_foo_SERIALIZE defines to see if the platform supports
|
||||
* APR_LOCK_foo. Only APR_LOCK_DEFAULT is portable.
|
||||
*/
|
||||
typedef enum {
|
||||
APR_LOCK_FCNTL, /**< fcntl() */
|
||||
APR_LOCK_FLOCK, /**< flock() */
|
||||
APR_LOCK_SYSVSEM, /**< System V Semaphores */
|
||||
APR_LOCK_PROC_PTHREAD, /**< POSIX pthread process-based locking */
|
||||
APR_LOCK_POSIXSEM, /**< POSIX semaphore process-based locking */
|
||||
APR_LOCK_DEFAULT /**< Use the default process lock */
|
||||
} apr_lockmech_e;
|
||||
|
||||
/** Opaque structure representing a process mutex. */
|
||||
typedef struct apr_proc_mutex_t apr_proc_mutex_t;
|
||||
|
||||
/* Function definitions */
|
||||
|
||||
/**
|
||||
* Create and initialize a mutex that can be used to synchronize processes.
|
||||
* @param mutex the memory address where the newly created mutex will be
|
||||
* stored.
|
||||
* @param fname A file name to use if the lock mechanism requires one. This
|
||||
* argument should always be provided. The lock code itself will
|
||||
* determine if it should be used.
|
||||
* @param mech The mechanism to use for the interprocess lock, if any; one of
|
||||
* <PRE>
|
||||
* APR_LOCK_FCNTL
|
||||
* APR_LOCK_FLOCK
|
||||
* APR_LOCK_SYSVSEM
|
||||
* APR_LOCK_POSIXSEM
|
||||
* APR_LOCK_PROC_PTHREAD
|
||||
* APR_LOCK_DEFAULT pick the default mechanism for the platform
|
||||
* </PRE>
|
||||
* @param pool the pool from which to allocate the mutex.
|
||||
* @see apr_lockmech_e
|
||||
* @warning Check APR_HAS_foo_SERIALIZE defines to see if the platform supports
|
||||
* APR_LOCK_foo. Only APR_LOCK_DEFAULT is portable.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex,
|
||||
const char *fname,
|
||||
apr_lockmech_e mech,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Re-open a mutex in a child process.
|
||||
* @param mutex The newly re-opened mutex structure.
|
||||
* @param fname A file name to use if the mutex mechanism requires one. This
|
||||
* argument should always be provided. The mutex code itself will
|
||||
* determine if it should be used. This filename should be the
|
||||
* same one that was passed to apr_proc_mutex_create().
|
||||
* @param pool The pool to operate on.
|
||||
* @remark This function must be called to maintain portability, even
|
||||
* if the underlying lock mechanism does not require it.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_mutex_child_init(apr_proc_mutex_t **mutex,
|
||||
const char *fname,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Acquire the lock for the given mutex. If the mutex is already locked,
|
||||
* the current thread will be put to sleep until the lock becomes available.
|
||||
* @param mutex the mutex on which to acquire the lock.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_mutex_lock(apr_proc_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Attempt to acquire the lock for the given mutex. If the mutex has already
|
||||
* been acquired, the call returns immediately with APR_EBUSY. Note: it
|
||||
* is important that the APR_STATUS_IS_EBUSY(s) macro be used to determine
|
||||
* if the return value was APR_EBUSY, for portability reasons.
|
||||
* @param mutex the mutex on which to attempt the lock acquiring.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_mutex_trylock(apr_proc_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Release the lock for the given mutex.
|
||||
* @param mutex the mutex from which to release the lock.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_mutex_unlock(apr_proc_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Destroy the mutex and free the memory associated with the lock.
|
||||
* @param mutex the mutex to destroy.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_mutex_destroy(apr_proc_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Destroy the mutex and free the memory associated with the lock.
|
||||
* @param mutex the mutex to destroy.
|
||||
* @note This function is generally used to kill a cleanup on an already
|
||||
* created mutex
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_mutex_cleanup(void *mutex);
|
||||
|
||||
/**
|
||||
* Return the name of the lockfile for the mutex, or NULL
|
||||
* if the mutex doesn't use a lock file
|
||||
*/
|
||||
|
||||
APR_DECLARE(const char *) apr_proc_mutex_lockfile(apr_proc_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Display the name of the mutex, as it relates to the actual method used.
|
||||
* This matches the valid options for Apache's AcceptMutex directive
|
||||
* @param mutex the name of the mutex
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_proc_mutex_name(apr_proc_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Display the name of the default mutex: APR_LOCK_DEFAULT
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_proc_mutex_defname(void);
|
||||
|
||||
/**
|
||||
* Get the pool used by this proc_mutex.
|
||||
* @return apr_pool_t the pool
|
||||
*/
|
||||
APR_POOL_DECLARE_ACCESSOR(proc_mutex);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_PROC_MUTEX_H */
|
153
include/apr_random.h
Normal file
153
include/apr_random.h
Normal file
@ -0,0 +1,153 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_RANDOM_H
|
||||
#define APR_RANDOM_H
|
||||
|
||||
/**
|
||||
* @file apr_random.h
|
||||
* @brief APR PRNG routines
|
||||
*/
|
||||
|
||||
#include "apr_pools.h"
|
||||
#include "apr_thread_proc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_random PRNG Routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef struct apr_crypto_hash_t apr_crypto_hash_t;
|
||||
|
||||
typedef void apr_crypto_hash_init_t(apr_crypto_hash_t *hash);
|
||||
typedef void apr_crypto_hash_add_t(apr_crypto_hash_t *hash, const void *data,
|
||||
apr_size_t bytes);
|
||||
typedef void apr_crypto_hash_finish_t(apr_crypto_hash_t *hash,
|
||||
unsigned char *result);
|
||||
|
||||
|
||||
/* FIXME: make this opaque */
|
||||
struct apr_crypto_hash_t {
|
||||
apr_crypto_hash_init_t *init;
|
||||
apr_crypto_hash_add_t *add;
|
||||
apr_crypto_hash_finish_t *finish;
|
||||
apr_size_t size;
|
||||
void *data;
|
||||
};
|
||||
|
||||
/**
|
||||
* Allocate and initialize the SHA-256 context
|
||||
* @param p The pool to allocate from
|
||||
*/
|
||||
APR_DECLARE(apr_crypto_hash_t *) apr_crypto_sha256_new(apr_pool_t *p);
|
||||
|
||||
/** Opaque PRNG structure. */
|
||||
typedef struct apr_random_t apr_random_t;
|
||||
|
||||
/**
|
||||
* Initialize a PRNG state
|
||||
* @param g The PRNG state
|
||||
* @param p The pool to allocate from
|
||||
* @param pool_hash Pool hash functions
|
||||
* @param key_hash Key hash functions
|
||||
* @param prng_hash PRNG hash functions
|
||||
*/
|
||||
APR_DECLARE(void) apr_random_init(apr_random_t *g, apr_pool_t *p,
|
||||
apr_crypto_hash_t *pool_hash,
|
||||
apr_crypto_hash_t *key_hash,
|
||||
apr_crypto_hash_t *prng_hash);
|
||||
/**
|
||||
* Allocate and initialize (apr_crypto_sha256_new) a new PRNG state.
|
||||
* @param p The pool to allocate from
|
||||
*/
|
||||
APR_DECLARE(apr_random_t *) apr_random_standard_new(apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Mix the randomness pools.
|
||||
* @param g The PRNG state
|
||||
* @param entropy_ Entropy buffer
|
||||
* @param bytes Length of entropy_ in bytes
|
||||
*/
|
||||
APR_DECLARE(void) apr_random_add_entropy(apr_random_t *g,
|
||||
const void *entropy_,
|
||||
apr_size_t bytes);
|
||||
/**
|
||||
* Generate cryptographically insecure random bytes.
|
||||
* @param g The RNG state
|
||||
* @param random Buffer to fill with random bytes
|
||||
* @param bytes Length of buffer in bytes
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_random_insecure_bytes(apr_random_t *g,
|
||||
void *random,
|
||||
apr_size_t bytes);
|
||||
|
||||
/**
|
||||
* Generate cryptographically secure random bytes.
|
||||
* @param g The RNG state
|
||||
* @param random Buffer to fill with random bytes
|
||||
* @param bytes Length of buffer in bytes
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_random_secure_bytes(apr_random_t *g,
|
||||
void *random,
|
||||
apr_size_t bytes);
|
||||
/**
|
||||
* Ensures that E bits of conditional entropy are mixed into the PRNG
|
||||
* before any further randomness is extracted.
|
||||
* @param g The RNG state
|
||||
*/
|
||||
APR_DECLARE(void) apr_random_barrier(apr_random_t *g);
|
||||
|
||||
/**
|
||||
* Return APR_SUCCESS if the cryptographic PRNG has been seeded with
|
||||
* enough data, APR_ENOTENOUGHENTROPY otherwise.
|
||||
* @param r The RNG state
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_random_secure_ready(apr_random_t *r);
|
||||
|
||||
/**
|
||||
* Return APR_SUCCESS if the PRNG has been seeded with enough data,
|
||||
* APR_ENOTENOUGHENTROPY otherwise.
|
||||
* @param r The PRNG state
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_random_insecure_ready(apr_random_t *r);
|
||||
|
||||
/**
|
||||
* Mix the randomness pools after forking.
|
||||
* @param proc The resulting process handle from apr_proc_fork()
|
||||
* @remark Call this in the child after forking to mix the randomness
|
||||
* pools. Note that its generally a bad idea to fork a process with a
|
||||
* real PRNG in it - better to have the PRNG externally and get the
|
||||
* randomness from there. However, if you really must do it, then you
|
||||
* should supply all your entropy to all the PRNGs - don't worry, they
|
||||
* won't produce the same output.
|
||||
* @remark Note that apr_proc_fork() calls this for you, so only weird
|
||||
* applications need ever call it themselves.
|
||||
* @internal
|
||||
*/
|
||||
APR_DECLARE(void) apr_random_after_fork(apr_proc_t *proc);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !APR_RANDOM_H */
|
513
include/apr_ring.h
Normal file
513
include/apr_ring.h
Normal file
@ -0,0 +1,513 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This code draws heavily from the 4.4BSD <sys/queue.h> macros
|
||||
* and Dean Gaudet's "splim/ring.h".
|
||||
* <http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/sys/queue.h>
|
||||
* <http://www.arctic.org/~dean/splim/>
|
||||
*
|
||||
* We'd use Dean's code directly if we could guarantee the
|
||||
* availability of inline functions.
|
||||
*/
|
||||
|
||||
#ifndef APR_RING_H
|
||||
#define APR_RING_H
|
||||
|
||||
/**
|
||||
* @file apr_ring.h
|
||||
* @brief APR Rings
|
||||
*/
|
||||
|
||||
/*
|
||||
* for offsetof()
|
||||
*/
|
||||
#include "apr_general.h"
|
||||
|
||||
/**
|
||||
* @defgroup apr_ring Ring Macro Implementations
|
||||
* @ingroup APR
|
||||
* A ring is a kind of doubly-linked list that can be manipulated
|
||||
* without knowing where its head is.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* The Ring Element
|
||||
*
|
||||
* A ring element struct is linked to the other elements in the ring
|
||||
* through its ring entry field, e.g.
|
||||
* <pre>
|
||||
* struct my_element_t {
|
||||
* APR_RING_ENTRY(my_element_t) link;
|
||||
* int foo;
|
||||
* char *bar;
|
||||
* };
|
||||
* </pre>
|
||||
*
|
||||
* An element struct may be put on more than one ring if it has more
|
||||
* than one APR_RING_ENTRY field. Each APR_RING_ENTRY has a corresponding
|
||||
* APR_RING_HEAD declaration.
|
||||
*
|
||||
* @warning For strict C standards compliance you should put the APR_RING_ENTRY
|
||||
* first in the element struct unless the head is always part of a larger
|
||||
* object with enough earlier fields to accommodate the offsetof() used
|
||||
* to compute the ring sentinel below. You can usually ignore this caveat.
|
||||
*/
|
||||
#define APR_RING_ENTRY(elem) \
|
||||
struct { \
|
||||
struct elem * volatile next; \
|
||||
struct elem * volatile prev; \
|
||||
}
|
||||
|
||||
/**
|
||||
* The Ring Head
|
||||
*
|
||||
* Each ring is managed via its head, which is a struct declared like this:
|
||||
* <pre>
|
||||
* APR_RING_HEAD(my_ring_t, my_element_t);
|
||||
* struct my_ring_t ring, *ringp;
|
||||
* </pre>
|
||||
*
|
||||
* This struct looks just like the element link struct so that we can
|
||||
* be sure that the typecasting games will work as expected.
|
||||
*
|
||||
* The first element in the ring is next after the head, and the last
|
||||
* element is just before the head.
|
||||
*/
|
||||
#define APR_RING_HEAD(head, elem) \
|
||||
struct head { \
|
||||
struct elem * volatile next; \
|
||||
struct elem * volatile prev; \
|
||||
}
|
||||
|
||||
/**
|
||||
* The Ring Sentinel
|
||||
*
|
||||
* This is the magic pointer value that occurs before the first and
|
||||
* after the last elements in the ring, computed from the address of
|
||||
* the ring's head. The head itself isn't an element, but in order to
|
||||
* get rid of all the special cases when dealing with the ends of the
|
||||
* ring, we play typecasting games to make it look like one.
|
||||
*
|
||||
* Here is a diagram to illustrate the arrangements of the next and
|
||||
* prev pointers of each element in a single ring. Note that they point
|
||||
* to the start of each element, not to the APR_RING_ENTRY structure.
|
||||
*
|
||||
* <pre>
|
||||
* +->+------+<-+ +->+------+<-+ +->+------+<-+
|
||||
* | |struct| | | |struct| | | |struct| |
|
||||
* / | elem | \/ | elem | \/ | elem | \
|
||||
* ... | | /\ | | /\ | | ...
|
||||
* +------+ | | +------+ | | +------+
|
||||
* ...--|prev | | +--|ring | | +--|prev |
|
||||
* | next|--+ | entry|--+ | next|--...
|
||||
* +------+ +------+ +------+
|
||||
* | etc. | | etc. | | etc. |
|
||||
* : : : : : :
|
||||
* </pre>
|
||||
*
|
||||
* The APR_RING_HEAD is nothing but a bare APR_RING_ENTRY. The prev
|
||||
* and next pointers in the first and last elements don't actually
|
||||
* point to the head, they point to a phantom place called the
|
||||
* sentinel. Its value is such that last->next->next == first because
|
||||
* the offset from the sentinel to the head's next pointer is the same
|
||||
* as the offset from the start of an element to its next pointer.
|
||||
* This also works in the opposite direction.
|
||||
*
|
||||
* <pre>
|
||||
* last first
|
||||
* +->+------+<-+ +->sentinel<-+ +->+------+<-+
|
||||
* | |struct| | | | | |struct| |
|
||||
* / | elem | \/ \/ | elem | \
|
||||
* ... | | /\ /\ | | ...
|
||||
* +------+ | | +------+ | | +------+
|
||||
* ...--|prev | | +--|ring | | +--|prev |
|
||||
* | next|--+ | head|--+ | next|--...
|
||||
* +------+ +------+ +------+
|
||||
* | etc. | | etc. |
|
||||
* : : : :
|
||||
* </pre>
|
||||
*
|
||||
* Note that the offset mentioned above is different for each kind of
|
||||
* ring that the element may be on, and each kind of ring has a unique
|
||||
* name for its APR_RING_ENTRY in each element, and has its own type
|
||||
* for its APR_RING_HEAD.
|
||||
*
|
||||
* Note also that if the offset is non-zero (which is required if an
|
||||
* element has more than one APR_RING_ENTRY), the unreality of the
|
||||
* sentinel may have bad implications on very perverse implementations
|
||||
* of C -- see the warning in APR_RING_ENTRY.
|
||||
*
|
||||
* @param hp The head of the ring
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_SENTINEL(hp, elem, link) \
|
||||
(struct elem *)((char *)(&(hp)->next) - APR_OFFSETOF(struct elem, link))
|
||||
|
||||
/**
|
||||
* The first element of the ring
|
||||
* @param hp The head of the ring
|
||||
*/
|
||||
#define APR_RING_FIRST(hp) (hp)->next
|
||||
/**
|
||||
* The last element of the ring
|
||||
* @param hp The head of the ring
|
||||
*/
|
||||
#define APR_RING_LAST(hp) (hp)->prev
|
||||
/**
|
||||
* The next element in the ring
|
||||
* @param ep The current element
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_NEXT(ep, link) (ep)->link.next
|
||||
/**
|
||||
* The previous element in the ring
|
||||
* @param ep The current element
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_PREV(ep, link) (ep)->link.prev
|
||||
|
||||
|
||||
/**
|
||||
* Initialize a ring
|
||||
* @param hp The head of the ring
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_INIT(hp, elem, link) do { \
|
||||
APR_RING_FIRST((hp)) = APR_RING_SENTINEL((hp), elem, link); \
|
||||
APR_RING_LAST((hp)) = APR_RING_SENTINEL((hp), elem, link); \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Determine if a ring is empty
|
||||
* @param hp The head of the ring
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
* @return true or false
|
||||
*/
|
||||
#define APR_RING_EMPTY(hp, elem, link) \
|
||||
(APR_RING_FIRST((hp)) == APR_RING_SENTINEL((hp), elem, link))
|
||||
|
||||
/**
|
||||
* Initialize a singleton element
|
||||
* @param ep The element
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_ELEM_INIT(ep, link) do { \
|
||||
APR_RING_NEXT((ep), link) = (ep); \
|
||||
APR_RING_PREV((ep), link) = (ep); \
|
||||
} while (0)
|
||||
|
||||
|
||||
/**
|
||||
* Splice the sequence ep1..epN into the ring before element lep
|
||||
* (..lep.. becomes ..ep1..epN..lep..)
|
||||
* @warning This doesn't work for splicing before the first element or on
|
||||
* empty rings... see APR_RING_SPLICE_HEAD for one that does
|
||||
* @param lep Element in the ring to splice before
|
||||
* @param ep1 First element in the sequence to splice in
|
||||
* @param epN Last element in the sequence to splice in
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_SPLICE_BEFORE(lep, ep1, epN, link) do { \
|
||||
APR_RING_NEXT((epN), link) = (lep); \
|
||||
APR_RING_PREV((ep1), link) = APR_RING_PREV((lep), link); \
|
||||
APR_RING_NEXT(APR_RING_PREV((lep), link), link) = (ep1); \
|
||||
APR_RING_PREV((lep), link) = (epN); \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Splice the sequence ep1..epN into the ring after element lep
|
||||
* (..lep.. becomes ..lep..ep1..epN..)
|
||||
* @warning This doesn't work for splicing after the last element or on
|
||||
* empty rings... see APR_RING_SPLICE_TAIL for one that does
|
||||
* @param lep Element in the ring to splice after
|
||||
* @param ep1 First element in the sequence to splice in
|
||||
* @param epN Last element in the sequence to splice in
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_SPLICE_AFTER(lep, ep1, epN, link) do { \
|
||||
APR_RING_PREV((ep1), link) = (lep); \
|
||||
APR_RING_NEXT((epN), link) = APR_RING_NEXT((lep), link); \
|
||||
APR_RING_PREV(APR_RING_NEXT((lep), link), link) = (epN); \
|
||||
APR_RING_NEXT((lep), link) = (ep1); \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Insert the element nep into the ring before element lep
|
||||
* (..lep.. becomes ..nep..lep..)
|
||||
* @warning This doesn't work for inserting before the first element or on
|
||||
* empty rings... see APR_RING_INSERT_HEAD for one that does
|
||||
* @param lep Element in the ring to insert before
|
||||
* @param nep Element to insert
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_INSERT_BEFORE(lep, nep, link) \
|
||||
APR_RING_SPLICE_BEFORE((lep), (nep), (nep), link)
|
||||
|
||||
/**
|
||||
* Insert the element nep into the ring after element lep
|
||||
* (..lep.. becomes ..lep..nep..)
|
||||
* @warning This doesn't work for inserting after the last element or on
|
||||
* empty rings... see APR_RING_INSERT_TAIL for one that does
|
||||
* @param lep Element in the ring to insert after
|
||||
* @param nep Element to insert
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_INSERT_AFTER(lep, nep, link) \
|
||||
APR_RING_SPLICE_AFTER((lep), (nep), (nep), link)
|
||||
|
||||
|
||||
/**
|
||||
* Splice the sequence ep1..epN into the ring before the first element
|
||||
* (..hp.. becomes ..hp..ep1..epN..)
|
||||
* @param hp Head of the ring
|
||||
* @param ep1 First element in the sequence to splice in
|
||||
* @param epN Last element in the sequence to splice in
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_SPLICE_HEAD(hp, ep1, epN, elem, link) \
|
||||
APR_RING_SPLICE_AFTER(APR_RING_SENTINEL((hp), elem, link), \
|
||||
(ep1), (epN), link)
|
||||
|
||||
/**
|
||||
* Splice the sequence ep1..epN into the ring after the last element
|
||||
* (..hp.. becomes ..ep1..epN..hp..)
|
||||
* @param hp Head of the ring
|
||||
* @param ep1 First element in the sequence to splice in
|
||||
* @param epN Last element in the sequence to splice in
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_SPLICE_TAIL(hp, ep1, epN, elem, link) \
|
||||
APR_RING_SPLICE_BEFORE(APR_RING_SENTINEL((hp), elem, link), \
|
||||
(ep1), (epN), link)
|
||||
|
||||
/**
|
||||
* Insert the element nep into the ring before the first element
|
||||
* (..hp.. becomes ..hp..nep..)
|
||||
* @param hp Head of the ring
|
||||
* @param nep Element to insert
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_INSERT_HEAD(hp, nep, elem, link) \
|
||||
APR_RING_SPLICE_HEAD((hp), (nep), (nep), elem, link)
|
||||
|
||||
/**
|
||||
* Insert the element nep into the ring after the last element
|
||||
* (..hp.. becomes ..nep..hp..)
|
||||
* @param hp Head of the ring
|
||||
* @param nep Element to insert
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_INSERT_TAIL(hp, nep, elem, link) \
|
||||
APR_RING_SPLICE_TAIL((hp), (nep), (nep), elem, link)
|
||||
|
||||
/**
|
||||
* Concatenate ring h2 onto the end of ring h1, leaving h2 empty.
|
||||
* @param h1 Head of the ring to concatenate onto
|
||||
* @param h2 Head of the ring to concatenate
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_CONCAT(h1, h2, elem, link) do { \
|
||||
if (!APR_RING_EMPTY((h2), elem, link)) { \
|
||||
APR_RING_SPLICE_BEFORE(APR_RING_SENTINEL((h1), elem, link), \
|
||||
APR_RING_FIRST((h2)), \
|
||||
APR_RING_LAST((h2)), link); \
|
||||
APR_RING_INIT((h2), elem, link); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Prepend ring h2 onto the beginning of ring h1, leaving h2 empty.
|
||||
* @param h1 Head of the ring to prepend onto
|
||||
* @param h2 Head of the ring to prepend
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_PREPEND(h1, h2, elem, link) do { \
|
||||
if (!APR_RING_EMPTY((h2), elem, link)) { \
|
||||
APR_RING_SPLICE_AFTER(APR_RING_SENTINEL((h1), elem, link), \
|
||||
APR_RING_FIRST((h2)), \
|
||||
APR_RING_LAST((h2)), link); \
|
||||
APR_RING_INIT((h2), elem, link); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Unsplice a sequence of elements from a ring
|
||||
* @warning The unspliced sequence is left with dangling pointers at either end
|
||||
* @param ep1 First element in the sequence to unsplice
|
||||
* @param epN Last element in the sequence to unsplice
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_UNSPLICE(ep1, epN, link) do { \
|
||||
APR_RING_NEXT(APR_RING_PREV((ep1), link), link) = \
|
||||
APR_RING_NEXT((epN), link); \
|
||||
APR_RING_PREV(APR_RING_NEXT((epN), link), link) = \
|
||||
APR_RING_PREV((ep1), link); \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Remove a single element from a ring
|
||||
* @warning The unspliced element is left with dangling pointers at either end
|
||||
* @param ep Element to remove
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_REMOVE(ep, link) \
|
||||
APR_RING_UNSPLICE((ep), (ep), link)
|
||||
|
||||
/**
|
||||
* Iterate over a ring
|
||||
* @param ep The current element
|
||||
* @param head The head of the ring
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_FOREACH(ep, head, elem, link) \
|
||||
for (ep = APR_RING_FIRST(head); \
|
||||
ep != APR_RING_SENTINEL(head, elem, link); \
|
||||
ep = APR_RING_NEXT(ep, link))
|
||||
|
||||
/**
|
||||
* Iterate over a ring safe against removal of the current element
|
||||
* @param ep1 The current element
|
||||
* @param ep2 Iteration cursor
|
||||
* @param head The head of the ring
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_FOREACH_SAFE(ep1, ep2, head, elem, link) \
|
||||
for (ep1 = APR_RING_FIRST(head), ep2 = APR_RING_NEXT(ep1, link); \
|
||||
ep1 != APR_RING_SENTINEL(head, elem, link); \
|
||||
ep1 = ep2, ep2 = APR_RING_NEXT(ep1, link))
|
||||
|
||||
/* Debugging tools: */
|
||||
|
||||
#ifdef APR_RING_DEBUG
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define APR_RING_CHECK_ONE(msg, ptr) \
|
||||
fprintf(stderr, "*** %s %p\n", msg, ptr)
|
||||
|
||||
#define APR_RING_CHECK(hp, elem, link, msg) \
|
||||
APR_RING_CHECK_ELEM(APR_RING_SENTINEL(hp, elem, link), elem, link, msg)
|
||||
|
||||
#define APR_RING_CHECK_ELEM(ep, elem, link, msg) do { \
|
||||
struct elem *start = (ep); \
|
||||
struct elem *here = start; \
|
||||
fprintf(stderr, "*** ring check start -- %s\n", msg); \
|
||||
do { \
|
||||
fprintf(stderr, "\telem %p\n", here); \
|
||||
fprintf(stderr, "\telem->next %p\n", \
|
||||
APR_RING_NEXT(here, link)); \
|
||||
fprintf(stderr, "\telem->prev %p\n", \
|
||||
APR_RING_PREV(here, link)); \
|
||||
fprintf(stderr, "\telem->next->prev %p\n", \
|
||||
APR_RING_PREV(APR_RING_NEXT(here, link), link)); \
|
||||
fprintf(stderr, "\telem->prev->next %p\n", \
|
||||
APR_RING_NEXT(APR_RING_PREV(here, link), link)); \
|
||||
if (APR_RING_PREV(APR_RING_NEXT(here, link), link) != here) { \
|
||||
fprintf(stderr, "\t*** elem->next->prev != elem\n"); \
|
||||
break; \
|
||||
} \
|
||||
if (APR_RING_NEXT(APR_RING_PREV(here, link), link) != here) { \
|
||||
fprintf(stderr, "\t*** elem->prev->next != elem\n"); \
|
||||
break; \
|
||||
} \
|
||||
here = APR_RING_NEXT(here, link); \
|
||||
} while (here != start); \
|
||||
fprintf(stderr, "*** ring check end\n"); \
|
||||
} while (0)
|
||||
|
||||
#define APR_RING_CHECK_CONSISTENCY(hp, elem, link) \
|
||||
APR_RING_CHECK_ELEM_CONSISTENCY(APR_RING_SENTINEL(hp, elem, link),\
|
||||
elem, link)
|
||||
|
||||
#define APR_RING_CHECK_ELEM_CONSISTENCY(ep, elem, link) do { \
|
||||
struct elem *start = (ep); \
|
||||
struct elem *here = start; \
|
||||
do { \
|
||||
assert(APR_RING_PREV(APR_RING_NEXT(here, link), link) == here); \
|
||||
assert(APR_RING_NEXT(APR_RING_PREV(here, link), link) == here); \
|
||||
here = APR_RING_NEXT(here, link); \
|
||||
} while (here != start); \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
/**
|
||||
* Print a single pointer value to STDERR
|
||||
* (This is a no-op unless APR_RING_DEBUG is defined.)
|
||||
* @param msg Descriptive message
|
||||
* @param ptr Pointer value to print
|
||||
*/
|
||||
#define APR_RING_CHECK_ONE(msg, ptr)
|
||||
/**
|
||||
* Dump all ring pointers to STDERR, starting with the head and looping all
|
||||
* the way around the ring back to the head. Aborts if an inconsistency
|
||||
* is found.
|
||||
* (This is a no-op unless APR_RING_DEBUG is defined.)
|
||||
* @param hp Head of the ring
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
* @param msg Descriptive message
|
||||
*/
|
||||
#define APR_RING_CHECK(hp, elem, link, msg)
|
||||
/**
|
||||
* Loops around a ring and checks all the pointers for consistency. Pops
|
||||
* an assertion if any inconsistency is found. Same idea as APR_RING_CHECK()
|
||||
* except that it's silent if all is well.
|
||||
* (This is a no-op unless APR_RING_DEBUG is defined.)
|
||||
* @param hp Head of the ring
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_CHECK_CONSISTENCY(hp, elem, link)
|
||||
/**
|
||||
* Dump all ring pointers to STDERR, starting with the given element and
|
||||
* looping all the way around the ring back to that element. Aborts if
|
||||
* an inconsistency is found.
|
||||
* (This is a no-op unless APR_RING_DEBUG is defined.)
|
||||
* @param ep The element
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
* @param msg Descriptive message
|
||||
*/
|
||||
#define APR_RING_CHECK_ELEM(ep, elem, link, msg)
|
||||
/**
|
||||
* Loops around a ring, starting with the given element, and checks all
|
||||
* the pointers for consistency. Pops an assertion if any inconsistency
|
||||
* is found. Same idea as APR_RING_CHECK_ELEM() except that it's silent
|
||||
* if all is well.
|
||||
* (This is a no-op unless APR_RING_DEBUG is defined.)
|
||||
* @param ep The element
|
||||
* @param elem The name of the element struct
|
||||
* @param link The name of the APR_RING_ENTRY in the element struct
|
||||
*/
|
||||
#define APR_RING_CHECK_ELEM_CONSISTENCY(ep, elem, link)
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* !APR_RING_H */
|
146
include/apr_shm.h
Normal file
146
include/apr_shm.h
Normal file
@ -0,0 +1,146 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_SHM_H
|
||||
#define APR_SHM_H
|
||||
|
||||
/**
|
||||
* @file apr_shm.h
|
||||
* @brief APR Shared Memory Routines
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_shm Shared Memory Routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Private, platform-specific data struture representing a shared memory
|
||||
* segment.
|
||||
*/
|
||||
typedef struct apr_shm_t apr_shm_t;
|
||||
|
||||
/**
|
||||
* Create and make accessable a shared memory segment.
|
||||
* @param m The shared memory structure to create.
|
||||
* @param reqsize The desired size of the segment.
|
||||
* @param filename The file to use for shared memory on platforms that
|
||||
* require it.
|
||||
* @param pool the pool from which to allocate the shared memory
|
||||
* structure.
|
||||
* @remark A note about Anonymous vs. Named shared memory segments:
|
||||
* Not all plaforms support anonymous shared memory segments, but in
|
||||
* some cases it is prefered over other types of shared memory
|
||||
* implementations. Passing a NULL 'file' parameter to this function
|
||||
* will cause the subsystem to use anonymous shared memory segments.
|
||||
* If such a system is not available, APR_ENOTIMPL is returned.
|
||||
* @remark A note about allocation sizes:
|
||||
* On some platforms it is necessary to store some metainformation
|
||||
* about the segment within the actual segment. In order to supply
|
||||
* the caller with the requested size it may be necessary for the
|
||||
* implementation to request a slightly greater segment length
|
||||
* from the subsystem. In all cases, the apr_shm_baseaddr_get()
|
||||
* function will return the first usable byte of memory.
|
||||
*
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m,
|
||||
apr_size_t reqsize,
|
||||
const char *filename,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Remove named resource associated with a shared memory segment,
|
||||
* preventing attachments to the resource, but not destroying it.
|
||||
* @param filename The filename associated with shared-memory segment which
|
||||
* needs to be removed
|
||||
* @param pool The pool used for file operations
|
||||
* @remark This function is only supported on platforms which support
|
||||
* name-based shared memory segments, and will return APR_ENOTIMPL on
|
||||
* platforms without such support. Removing the file while the shm
|
||||
* is in use is not entirely portable, caller may use this to enhance
|
||||
* obscurity of the resource, but be prepared for the the call to fail,
|
||||
* and for concurrent attempts to create a resource of the same name
|
||||
* to also fail. The pool cleanup of apr_shm_create (apr_shm_destroy)
|
||||
* also removes the named resource.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_shm_remove(const char *filename,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Destroy a shared memory segment and associated memory.
|
||||
* @param m The shared memory segment structure to destroy.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_shm_destroy(apr_shm_t *m);
|
||||
|
||||
/**
|
||||
* Attach to a shared memory segment that was created
|
||||
* by another process.
|
||||
* @param m The shared memory structure to create.
|
||||
* @param filename The file used to create the original segment.
|
||||
* (This MUST match the original filename.)
|
||||
* @param pool the pool from which to allocate the shared memory
|
||||
* structure for this process.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m,
|
||||
const char *filename,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Detach from a shared memory segment without destroying it.
|
||||
* @param m The shared memory structure representing the segment
|
||||
* to detach from.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_shm_detach(apr_shm_t *m);
|
||||
|
||||
/**
|
||||
* Retrieve the base address of the shared memory segment.
|
||||
* NOTE: This address is only usable within the callers address
|
||||
* space, since this API does not guarantee that other attaching
|
||||
* processes will maintain the same address mapping.
|
||||
* @param m The shared memory segment from which to retrieve
|
||||
* the base address.
|
||||
* @return address, aligned by APR_ALIGN_DEFAULT.
|
||||
*/
|
||||
APR_DECLARE(void *) apr_shm_baseaddr_get(const apr_shm_t *m);
|
||||
|
||||
/**
|
||||
* Retrieve the length of a shared memory segment in bytes.
|
||||
* @param m The shared memory segment from which to retrieve
|
||||
* the segment length.
|
||||
*/
|
||||
APR_DECLARE(apr_size_t) apr_shm_size_get(const apr_shm_t *m);
|
||||
|
||||
/**
|
||||
* Get the pool used by this shared memory segment.
|
||||
*/
|
||||
APR_POOL_DECLARE_ACCESSOR(shm);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* APR_SHM_T */
|
109
include/apr_signal.h
Normal file
109
include/apr_signal.h
Normal file
@ -0,0 +1,109 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_SIGNAL_H
|
||||
#define APR_SIGNAL_H
|
||||
|
||||
/**
|
||||
* @file apr_signal.h
|
||||
* @brief APR Signal Handling
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
|
||||
#if APR_HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_signal Signal Handling
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if APR_HAVE_SIGACTION || defined(DOXYGEN)
|
||||
|
||||
#if defined(DARWIN) && !defined(__cplusplus) && !defined(_ANSI_SOURCE)
|
||||
/* work around Darwin header file bugs
|
||||
* http://www.opensource.apple.com/bugs/X/BSD%20Kernel/2657228.html
|
||||
*/
|
||||
#undef SIG_DFL
|
||||
#undef SIG_IGN
|
||||
#undef SIG_ERR
|
||||
#define SIG_DFL (void (*)(int))0
|
||||
#define SIG_IGN (void (*)(int))1
|
||||
#define SIG_ERR (void (*)(int))-1
|
||||
#endif
|
||||
|
||||
/** Function prototype for signal handlers */
|
||||
typedef void apr_sigfunc_t(int);
|
||||
|
||||
/**
|
||||
* Set the signal handler function for a given signal
|
||||
* @param signo The signal (eg... SIGWINCH)
|
||||
* @param func the function to get called
|
||||
*/
|
||||
APR_DECLARE(apr_sigfunc_t *) apr_signal(int signo, apr_sigfunc_t * func);
|
||||
|
||||
#if defined(SIG_IGN) && !defined(SIG_ERR)
|
||||
#define SIG_ERR ((apr_sigfunc_t *) -1)
|
||||
#endif
|
||||
|
||||
#else /* !APR_HAVE_SIGACTION */
|
||||
#define apr_signal(a, b) signal(a, b)
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Get the description for a specific signal number
|
||||
* @param signum The signal number
|
||||
* @return The description of the signal
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_signal_description_get(int signum);
|
||||
|
||||
/**
|
||||
* APR-private function for initializing the signal package
|
||||
* @internal
|
||||
* @param pglobal The internal, global pool
|
||||
*/
|
||||
void apr_signal_init(apr_pool_t *pglobal);
|
||||
|
||||
/**
|
||||
* Block the delivery of a particular signal
|
||||
* @param signum The signal number
|
||||
* @return status
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_signal_block(int signum);
|
||||
|
||||
/**
|
||||
* Enable the delivery of a particular signal
|
||||
* @param signum The signal number
|
||||
* @return status
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_signal_unblock(int signum);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* APR_SIGNAL_H */
|
366
include/apr_strings.h
Normal file
366
include/apr_strings.h
Normal file
@ -0,0 +1,366 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/* Portions of this file are covered by */
|
||||
/* -*- mode: c; c-file-style: "k&r" -*-
|
||||
|
||||
strnatcmp.c -- Perform 'natural order' comparisons of strings in C.
|
||||
Copyright (C) 2000 by Martin Pool <mbp@humbug.org.au>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#ifndef APR_STRINGS_H
|
||||
#define APR_STRINGS_H
|
||||
|
||||
/**
|
||||
* @file apr_strings.h
|
||||
* @brief APR Strings library
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_pools.h"
|
||||
#define APR_WANT_IOVEC
|
||||
#include "apr_want.h"
|
||||
|
||||
#if APR_HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_strings String routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Do a natural order comparison of two strings.
|
||||
* @param a The first string to compare
|
||||
* @param b The second string to compare
|
||||
* @return Either <0, 0, or >0. If the first string is less than the second
|
||||
* this returns <0, if they are equivalent it returns 0, and if the
|
||||
* first string is greater than second string it retuns >0.
|
||||
*/
|
||||
APR_DECLARE(int) apr_strnatcmp(char const *a, char const *b);
|
||||
|
||||
/**
|
||||
* Do a natural order comparison of two strings ignoring the case of the
|
||||
* strings.
|
||||
* @param a The first string to compare
|
||||
* @param b The second string to compare
|
||||
* @return Either <0, 0, or >0. If the first string is less than the second
|
||||
* this returns <0, if they are equivalent it returns 0, and if the
|
||||
* first string is greater than second string it retuns >0.
|
||||
*/
|
||||
APR_DECLARE(int) apr_strnatcasecmp(char const *a, char const *b);
|
||||
|
||||
/**
|
||||
* duplicate a string into memory allocated out of a pool
|
||||
* @param p The pool to allocate out of
|
||||
* @param s The string to duplicate
|
||||
* @return The new string
|
||||
*/
|
||||
APR_DECLARE(char *) apr_pstrdup(apr_pool_t *p, const char *s);
|
||||
|
||||
/**
|
||||
* Create a null-terminated string by making a copy of a sequence
|
||||
* of characters and appending a null byte
|
||||
* @param p The pool to allocate out of
|
||||
* @param s The block of characters to duplicate
|
||||
* @param n The number of characters to duplicate
|
||||
* @return The new string
|
||||
* @remark This is a faster alternative to apr_pstrndup, for use
|
||||
* when you know that the string being duplicated really
|
||||
* has 'n' or more characters. If the string might contain
|
||||
* fewer characters, use apr_pstrndup.
|
||||
*/
|
||||
APR_DECLARE(char *) apr_pstrmemdup(apr_pool_t *p, const char *s, apr_size_t n);
|
||||
|
||||
/**
|
||||
* Duplicate at most n characters of a string into memory allocated
|
||||
* out of a pool; the new string will be NUL-terminated
|
||||
* @param p The pool to allocate out of
|
||||
* @param s The string to duplicate
|
||||
* @param n The maximum number of characters to duplicate
|
||||
* @return The new string
|
||||
* @remark The amount of memory allocated from the pool is the length
|
||||
* of the returned string including the NUL terminator
|
||||
*/
|
||||
APR_DECLARE(char *) apr_pstrndup(apr_pool_t *p, const char *s, apr_size_t n);
|
||||
|
||||
/**
|
||||
* Duplicate a block of memory.
|
||||
*
|
||||
* @param p The pool to allocate from
|
||||
* @param m The memory to duplicate
|
||||
* @param n The number of bytes to duplicate
|
||||
* @return The new block of memory
|
||||
*/
|
||||
APR_DECLARE(void *) apr_pmemdup(apr_pool_t *p, const void *m, apr_size_t n);
|
||||
|
||||
/**
|
||||
* Concatenate multiple strings, allocating memory out a pool
|
||||
* @param p The pool to allocate out of
|
||||
* @param ... The strings to concatenate. The final string must be NULL
|
||||
* @return The new string
|
||||
*/
|
||||
APR_DECLARE_NONSTD(char *) apr_pstrcat(apr_pool_t *p, ...)
|
||||
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||
__attribute__((sentinel))
|
||||
#endif
|
||||
;
|
||||
|
||||
/**
|
||||
* Concatenate multiple strings specified in a writev-style vector
|
||||
* @param p The pool from which to allocate
|
||||
* @param vec The strings to concatenate
|
||||
* @param nvec The number of strings to concatenate
|
||||
* @param nbytes (output) strlen of new string (pass in NULL to omit)
|
||||
* @return The new string
|
||||
*/
|
||||
APR_DECLARE(char *) apr_pstrcatv(apr_pool_t *p, const struct iovec *vec,
|
||||
apr_size_t nvec, apr_size_t *nbytes);
|
||||
|
||||
/**
|
||||
* printf-style style printing routine. The data is output to a string
|
||||
* allocated from a pool
|
||||
* @param p The pool to allocate out of
|
||||
* @param fmt The format of the string
|
||||
* @param ap The arguments to use while printing the data
|
||||
* @return The new string
|
||||
*/
|
||||
APR_DECLARE(char *) apr_pvsprintf(apr_pool_t *p, const char *fmt, va_list ap);
|
||||
|
||||
/**
|
||||
* printf-style style printing routine. The data is output to a string
|
||||
* allocated from a pool
|
||||
* @param p The pool to allocate out of
|
||||
* @param fmt The format of the string
|
||||
* @param ... The arguments to use while printing the data
|
||||
* @return The new string
|
||||
*/
|
||||
APR_DECLARE_NONSTD(char *) apr_psprintf(apr_pool_t *p, const char *fmt, ...)
|
||||
__attribute__((format(printf,2,3)));
|
||||
|
||||
/**
|
||||
* Copy up to dst_size characters from src to dst; does not copy
|
||||
* past a NUL terminator in src, but always terminates dst with a NUL
|
||||
* regardless.
|
||||
* @param dst The destination string
|
||||
* @param src The source string
|
||||
* @param dst_size The space available in dst; dst always receives
|
||||
* NUL termination, so if src is longer than
|
||||
* dst_size, the actual number of characters copied is
|
||||
* dst_size - 1.
|
||||
* @return Pointer to the NUL terminator of the destination string, dst
|
||||
* @remark
|
||||
* <PRE>
|
||||
* Note the differences between this function and strncpy():
|
||||
* 1) strncpy() doesn't always NUL terminate; apr_cpystrn() does.
|
||||
* 2) strncpy() pads the destination string with NULs, which is often
|
||||
* unnecessary; apr_cpystrn() does not.
|
||||
* 3) strncpy() returns a pointer to the beginning of the dst string;
|
||||
* apr_cpystrn() returns a pointer to the NUL terminator of dst,
|
||||
* to allow a check for truncation.
|
||||
* </PRE>
|
||||
*/
|
||||
APR_DECLARE(char *) apr_cpystrn(char *dst, const char *src,
|
||||
apr_size_t dst_size);
|
||||
|
||||
/**
|
||||
* Remove all whitespace from a string
|
||||
* @param dest The destination string. It is okay to modify the string
|
||||
* in place. Namely dest == src
|
||||
* @param src The string to rid the spaces from.
|
||||
* @return A pointer to the destination string's null terminator.
|
||||
*/
|
||||
APR_DECLARE(char *) apr_collapse_spaces(char *dest, const char *src);
|
||||
|
||||
/**
|
||||
* Convert the arguments to a program from one string to an array of
|
||||
* strings terminated by a NULL pointer
|
||||
* @param arg_str The arguments to convert
|
||||
* @param argv_out Output location. This is a pointer to an array of strings.
|
||||
* @param token_context Pool to use.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_tokenize_to_argv(const char *arg_str,
|
||||
char ***argv_out,
|
||||
apr_pool_t *token_context);
|
||||
|
||||
/**
|
||||
* Split a string into separate null-terminated tokens. The tokens are
|
||||
* delimited in the string by one or more characters from the sep
|
||||
* argument.
|
||||
* @param str The string to separate; this should be specified on the
|
||||
* first call to apr_strtok() for a given string, and NULL
|
||||
* on subsequent calls.
|
||||
* @param sep The set of delimiters
|
||||
* @param last Internal state saved by apr_strtok() between calls.
|
||||
* @return The next token from the string
|
||||
*/
|
||||
APR_DECLARE(char *) apr_strtok(char *str, const char *sep, char **last);
|
||||
|
||||
/**
|
||||
* @defgroup APR_Strings_Snprintf snprintf implementations
|
||||
* @warning
|
||||
* These are snprintf implementations based on apr_vformatter().
|
||||
*
|
||||
* Note that various standards and implementations disagree on the return
|
||||
* value of snprintf, and side-effects due to %n in the formatting string.
|
||||
* apr_snprintf (and apr_vsnprintf) behaves as follows:
|
||||
*
|
||||
* Process the format string until the entire string is exhausted, or
|
||||
* the buffer fills. If the buffer fills then stop processing immediately
|
||||
* (so no further %n arguments are processed), and return the buffer
|
||||
* length. In all cases the buffer is NUL terminated. It will return the
|
||||
* number of characters inserted into the buffer, not including the
|
||||
* terminating NUL. As a special case, if len is 0, apr_snprintf will
|
||||
* return the number of characters that would have been inserted if
|
||||
* the buffer had been infinite (in this case, *buffer can be NULL)
|
||||
*
|
||||
* In no event does apr_snprintf return a negative number.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* snprintf routine based on apr_vformatter. This means it understands the
|
||||
* same extensions.
|
||||
* @param buf The buffer to write to
|
||||
* @param len The size of the buffer
|
||||
* @param format The format string
|
||||
* @param ... The arguments to use to fill out the format string.
|
||||
*/
|
||||
APR_DECLARE_NONSTD(int) apr_snprintf(char *buf, apr_size_t len,
|
||||
const char *format, ...)
|
||||
__attribute__((format(printf,3,4)));
|
||||
|
||||
/**
|
||||
* vsnprintf routine based on apr_vformatter. This means it understands the
|
||||
* same extensions.
|
||||
* @param buf The buffer to write to
|
||||
* @param len The size of the buffer
|
||||
* @param format The format string
|
||||
* @param ap The arguments to use to fill out the format string.
|
||||
*/
|
||||
APR_DECLARE(int) apr_vsnprintf(char *buf, apr_size_t len, const char *format,
|
||||
va_list ap);
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* create a string representation of an int, allocated from a pool
|
||||
* @param p The pool from which to allocate
|
||||
* @param n The number to format
|
||||
* @return The string representation of the number
|
||||
*/
|
||||
APR_DECLARE(char *) apr_itoa(apr_pool_t *p, int n);
|
||||
|
||||
/**
|
||||
* create a string representation of a long, allocated from a pool
|
||||
* @param p The pool from which to allocate
|
||||
* @param n The number to format
|
||||
* @return The string representation of the number
|
||||
*/
|
||||
APR_DECLARE(char *) apr_ltoa(apr_pool_t *p, long n);
|
||||
|
||||
/**
|
||||
* create a string representation of an apr_off_t, allocated from a pool
|
||||
* @param p The pool from which to allocate
|
||||
* @param n The number to format
|
||||
* @return The string representation of the number
|
||||
*/
|
||||
APR_DECLARE(char *) apr_off_t_toa(apr_pool_t *p, apr_off_t n);
|
||||
|
||||
/**
|
||||
* Convert a numeric string into an apr_off_t numeric value.
|
||||
* @param offset The value of the parsed string.
|
||||
* @param buf The string to parse. It may contain optional whitespace,
|
||||
* followed by an optional '+' (positive, default) or '-' (negative)
|
||||
* character, followed by an optional '0x' prefix if base is 0 or 16,
|
||||
* followed by numeric digits appropriate for base.
|
||||
* @param end A pointer to the end of the valid character in buf. If
|
||||
* not NULL, it is set to the first invalid character in buf.
|
||||
* @param base A numeric base in the range between 2 and 36 inclusive,
|
||||
* or 0. If base is zero, buf will be treated as base ten unless its
|
||||
* digits are prefixed with '0x', in which case it will be treated as
|
||||
* base 16.
|
||||
* @bug *end breaks type safety; where *buf is const, *end needs to be
|
||||
* declared as const in APR 2.0
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_strtoff(apr_off_t *offset, const char *buf,
|
||||
char **end, int base);
|
||||
|
||||
/**
|
||||
* parse a numeric string into a 64-bit numeric value
|
||||
* @param buf The string to parse. It may contain optional whitespace,
|
||||
* followed by an optional '+' (positive, default) or '-' (negative)
|
||||
* character, followed by an optional '0x' prefix if base is 0 or 16,
|
||||
* followed by numeric digits appropriate for base.
|
||||
* @param end A pointer to the end of the valid character in buf. If
|
||||
* not NULL, it is set to the first invalid character in buf.
|
||||
* @param base A numeric base in the range between 2 and 36 inclusive,
|
||||
* or 0. If base is zero, buf will be treated as base ten unless its
|
||||
* digits are prefixed with '0x', in which case it will be treated as
|
||||
* base 16.
|
||||
* @return The numeric value of the string. On overflow, errno is set
|
||||
* to ERANGE. On success, errno is set to 0.
|
||||
*/
|
||||
APR_DECLARE(apr_int64_t) apr_strtoi64(const char *buf, char **end, int base);
|
||||
|
||||
/**
|
||||
* parse a base-10 numeric string into a 64-bit numeric value.
|
||||
* Equivalent to apr_strtoi64(buf, (char**)NULL, 10).
|
||||
* @param buf The string to parse
|
||||
* @return The numeric value of the string. On overflow, errno is set
|
||||
* to ERANGE. On success, errno is set to 0.
|
||||
*/
|
||||
APR_DECLARE(apr_int64_t) apr_atoi64(const char *buf);
|
||||
|
||||
/**
|
||||
* Format a binary size (magnitiudes are 2^10 rather than 10^3) from an apr_off_t,
|
||||
* as bytes, K, M, T, etc, to a four character compacted human readable string.
|
||||
* @param size The size to format
|
||||
* @param buf The 5 byte text buffer (counting the trailing null)
|
||||
* @return The buf passed to apr_strfsize()
|
||||
* @remark All negative sizes report ' - ', apr_strfsize only formats positive values.
|
||||
*/
|
||||
APR_DECLARE(char *) apr_strfsize(apr_off_t size, char *buf);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !APR_STRINGS_H */
|
57
include/apr_support.h
Normal file
57
include/apr_support.h
Normal file
@ -0,0 +1,57 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_SUPPORT_H
|
||||
#define APR_SUPPORT_H
|
||||
|
||||
/**
|
||||
* @file apr_support.h
|
||||
* @brief APR Support functions
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_network_io.h"
|
||||
#include "apr_file_io.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_support Internal APR support functions
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Wait for IO to occur or timeout.
|
||||
*
|
||||
* @param f The file to wait on.
|
||||
* @param s The socket to wait on if @a f is @c NULL.
|
||||
* @param for_read If non-zero wait for data to be available to read,
|
||||
* otherwise wait for data to be able to be written.
|
||||
* @return APR_TIMEUP if we run out of time.
|
||||
*/
|
||||
apr_status_t apr_wait_for_io_or_timeout(apr_file_t *f, apr_socket_t *s,
|
||||
int for_read);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_SUPPORT_H */
|
487
include/apr_tables.h
Normal file
487
include/apr_tables.h
Normal file
@ -0,0 +1,487 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_TABLES_H
|
||||
#define APR_TABLES_H
|
||||
|
||||
/**
|
||||
* @file apr_tables.h
|
||||
* @brief APR Table library
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
|
||||
#if APR_HAVE_STDARG_H
|
||||
#include <stdarg.h> /* for va_list */
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_tables Table and Array Functions
|
||||
* @ingroup APR
|
||||
* Arrays are used to store data which is referenced sequentially or
|
||||
* as a stack. Functions are provided to push and pop individual
|
||||
* elements as well as to operate on the entire array.
|
||||
*
|
||||
* Tables are used to store data which can be referenced by key.
|
||||
* Limited capabilities are provided for tables with multiple elements
|
||||
* which share a key; while key lookup will return only a single
|
||||
* element, iteration is available. Additionally, a table can be
|
||||
* compressed to resolve duplicates.
|
||||
*
|
||||
* Both arrays and tables may store string or binary data; some features,
|
||||
* such as concatenation or merging of elements, work only for string
|
||||
* data.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** the table abstract data type */
|
||||
typedef struct apr_table_t apr_table_t;
|
||||
|
||||
/** @see apr_array_header_t */
|
||||
typedef struct apr_array_header_t apr_array_header_t;
|
||||
|
||||
/** An opaque array type */
|
||||
struct apr_array_header_t {
|
||||
/** The pool the array is allocated out of */
|
||||
apr_pool_t *pool;
|
||||
/** The amount of memory allocated for each element of the array */
|
||||
int elt_size;
|
||||
/** The number of active elements in the array */
|
||||
int nelts;
|
||||
/** The number of elements allocated in the array */
|
||||
int nalloc;
|
||||
/** The elements in the array */
|
||||
char *elts;
|
||||
};
|
||||
|
||||
/**
|
||||
* The (opaque) structure for string-content tables.
|
||||
*/
|
||||
typedef struct apr_table_entry_t apr_table_entry_t;
|
||||
|
||||
/** The type for each entry in a string-content table */
|
||||
struct apr_table_entry_t {
|
||||
/** The key for the current table entry */
|
||||
char *key; /* maybe NULL in future;
|
||||
* check when iterating thru table_elts
|
||||
*/
|
||||
/** The value for the current table entry */
|
||||
char *val;
|
||||
|
||||
/** A checksum for the key, for use by the apr_table internals */
|
||||
apr_uint32_t key_checksum;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the elements from a table.
|
||||
* @param t The table
|
||||
* @return An array containing the contents of the table
|
||||
*/
|
||||
APR_DECLARE(const apr_array_header_t *) apr_table_elts(const apr_table_t *t);
|
||||
|
||||
/**
|
||||
* Determine if the table is empty (either NULL or having no elements).
|
||||
* @param t The table to check
|
||||
* @return True if empty, False otherwise
|
||||
*/
|
||||
APR_DECLARE(int) apr_is_empty_table(const apr_table_t *t);
|
||||
|
||||
/**
|
||||
* Determine if the array is empty (either NULL or having no elements).
|
||||
* @param a The array to check
|
||||
* @return True if empty, False otherwise
|
||||
*/
|
||||
APR_DECLARE(int) apr_is_empty_array(const apr_array_header_t *a);
|
||||
|
||||
/**
|
||||
* Create an array.
|
||||
* @param p The pool to allocate the memory out of
|
||||
* @param nelts the number of elements in the initial array
|
||||
* @param elt_size The size of each element in the array.
|
||||
* @return The new array
|
||||
*/
|
||||
APR_DECLARE(apr_array_header_t *) apr_array_make(apr_pool_t *p,
|
||||
int nelts, int elt_size);
|
||||
|
||||
/**
|
||||
* Add a new element to an array (as a first-in, last-out stack).
|
||||
* @param arr The array to add an element to.
|
||||
* @return Location for the new element in the array.
|
||||
* @remark If there are no free spots in the array, then this function will
|
||||
* allocate new space for the new element.
|
||||
*/
|
||||
APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr);
|
||||
|
||||
/** A helper macro for accessing a member of an APR array.
|
||||
*
|
||||
* @param ary the array
|
||||
* @param i the index into the array to return
|
||||
* @param type the type of the objects stored in the array
|
||||
*
|
||||
* @return the item at index i
|
||||
*/
|
||||
#define APR_ARRAY_IDX(ary,i,type) (((type *)(ary)->elts)[i])
|
||||
|
||||
/** A helper macro for pushing elements into an APR array.
|
||||
*
|
||||
* @param ary the array
|
||||
* @param type the type of the objects stored in the array
|
||||
*
|
||||
* @return the location where the new object should be placed
|
||||
*/
|
||||
#define APR_ARRAY_PUSH(ary,type) (*((type *)apr_array_push(ary)))
|
||||
|
||||
/**
|
||||
* Remove an element from an array (as a first-in, last-out stack).
|
||||
* @param arr The array to remove an element from.
|
||||
* @return Location of the element in the array.
|
||||
* @remark If there are no elements in the array, NULL is returned.
|
||||
*/
|
||||
APR_DECLARE(void *) apr_array_pop(apr_array_header_t *arr);
|
||||
|
||||
/**
|
||||
* Remove all elements from an array.
|
||||
* @param arr The array to remove all elements from.
|
||||
* @remark As the underlying storage is allocated from a pool, no
|
||||
* memory is freed by this operation, but is available for reuse.
|
||||
*/
|
||||
APR_DECLARE(void) apr_array_clear(apr_array_header_t *arr);
|
||||
|
||||
/**
|
||||
* Concatenate two arrays together.
|
||||
* @param dst The destination array, and the one to go first in the combined
|
||||
* array
|
||||
* @param src The source array to add to the destination array
|
||||
*/
|
||||
APR_DECLARE(void) apr_array_cat(apr_array_header_t *dst,
|
||||
const apr_array_header_t *src);
|
||||
|
||||
/**
|
||||
* Copy the entire array.
|
||||
* @param p The pool to allocate the copy of the array out of
|
||||
* @param arr The array to copy
|
||||
* @return An exact copy of the array passed in
|
||||
* @remark The alternate apr_array_copy_hdr copies only the header, and arranges
|
||||
* for the elements to be copied if (and only if) the code subsequently
|
||||
* does a push or arraycat.
|
||||
*/
|
||||
APR_DECLARE(apr_array_header_t *) apr_array_copy(apr_pool_t *p,
|
||||
const apr_array_header_t *arr);
|
||||
/**
|
||||
* Copy the headers of the array, and arrange for the elements to be copied if
|
||||
* and only if the code subsequently does a push or arraycat.
|
||||
* @param p The pool to allocate the copy of the array out of
|
||||
* @param arr The array to copy
|
||||
* @return An exact copy of the array passed in
|
||||
* @remark The alternate apr_array_copy copies the *entire* array.
|
||||
*/
|
||||
APR_DECLARE(apr_array_header_t *) apr_array_copy_hdr(apr_pool_t *p,
|
||||
const apr_array_header_t *arr);
|
||||
|
||||
/**
|
||||
* Append one array to the end of another, creating a new array in the process.
|
||||
* @param p The pool to allocate the new array out of
|
||||
* @param first The array to put first in the new array.
|
||||
* @param second The array to put second in the new array.
|
||||
* @return A new array containing the data from the two arrays passed in.
|
||||
*/
|
||||
APR_DECLARE(apr_array_header_t *) apr_array_append(apr_pool_t *p,
|
||||
const apr_array_header_t *first,
|
||||
const apr_array_header_t *second);
|
||||
|
||||
/**
|
||||
* Generate a new string from the apr_pool_t containing the concatenated
|
||||
* sequence of substrings referenced as elements within the array. The string
|
||||
* will be empty if all substrings are empty or null, or if there are no
|
||||
* elements in the array. If sep is non-NUL, it will be inserted between
|
||||
* elements as a separator.
|
||||
* @param p The pool to allocate the string out of
|
||||
* @param arr The array to generate the string from
|
||||
* @param sep The separator to use
|
||||
* @return A string containing all of the data in the array.
|
||||
*/
|
||||
APR_DECLARE(char *) apr_array_pstrcat(apr_pool_t *p,
|
||||
const apr_array_header_t *arr,
|
||||
const char sep);
|
||||
|
||||
/**
|
||||
* Make a new table.
|
||||
* @param p The pool to allocate the pool out of
|
||||
* @param nelts The number of elements in the initial table.
|
||||
* @return The new table.
|
||||
* @warning This table can only store text data
|
||||
*/
|
||||
APR_DECLARE(apr_table_t *) apr_table_make(apr_pool_t *p, int nelts);
|
||||
|
||||
/**
|
||||
* Create a new table and copy another table into it.
|
||||
* @param p The pool to allocate the new table out of
|
||||
* @param t The table to copy
|
||||
* @return A copy of the table passed in
|
||||
* @warning The table keys and respective values are not copied
|
||||
*/
|
||||
APR_DECLARE(apr_table_t *) apr_table_copy(apr_pool_t *p,
|
||||
const apr_table_t *t);
|
||||
|
||||
/**
|
||||
* Create a new table whose contents are deep copied from the given
|
||||
* table. A deep copy operation copies all fields, and makes copies
|
||||
* of dynamically allocated memory pointed to by the fields.
|
||||
* @param p The pool to allocate the new table out of
|
||||
* @param t The table to clone
|
||||
* @return A deep copy of the table passed in
|
||||
*/
|
||||
APR_DECLARE(apr_table_t *) apr_table_clone(apr_pool_t *p,
|
||||
const apr_table_t *t);
|
||||
|
||||
/**
|
||||
* Delete all of the elements from a table.
|
||||
* @param t The table to clear
|
||||
*/
|
||||
APR_DECLARE(void) apr_table_clear(apr_table_t *t);
|
||||
|
||||
/**
|
||||
* Get the value associated with a given key from the table. After this call,
|
||||
* the data is still in the table.
|
||||
* @param t The table to search for the key
|
||||
* @param key The key to search for (case does not matter)
|
||||
* @return The value associated with the key, or NULL if the key does not exist.
|
||||
*/
|
||||
APR_DECLARE(const char *) apr_table_get(const apr_table_t *t, const char *key);
|
||||
|
||||
/**
|
||||
* Add a key/value pair to a table. If another element already exists with the
|
||||
* same key, this will overwrite the old data.
|
||||
* @param t The table to add the data to.
|
||||
* @param key The key to use (case does not matter)
|
||||
* @param val The value to add
|
||||
* @remark When adding data, this function makes a copy of both the key and the
|
||||
* value.
|
||||
*/
|
||||
APR_DECLARE(void) apr_table_set(apr_table_t *t, const char *key,
|
||||
const char *val);
|
||||
|
||||
/**
|
||||
* Add a key/value pair to a table. If another element already exists with the
|
||||
* same key, this will overwrite the old data.
|
||||
* @param t The table to add the data to.
|
||||
* @param key The key to use (case does not matter)
|
||||
* @param val The value to add
|
||||
* @warning When adding data, this function does not make a copy of the key or
|
||||
* the value, so care should be taken to ensure that the values will
|
||||
* not change after they have been added..
|
||||
*/
|
||||
APR_DECLARE(void) apr_table_setn(apr_table_t *t, const char *key,
|
||||
const char *val);
|
||||
|
||||
/**
|
||||
* Remove data from the table.
|
||||
* @param t The table to remove data from
|
||||
* @param key The key of the data being removed (case does not matter)
|
||||
*/
|
||||
APR_DECLARE(void) apr_table_unset(apr_table_t *t, const char *key);
|
||||
|
||||
/**
|
||||
* Add data to a table by merging the value with data that has already been
|
||||
* stored. The merging is done by concatenating the two values, separated
|
||||
* by the string ", ".
|
||||
* @param t The table to search for the data
|
||||
* @param key The key to merge data for (case does not matter)
|
||||
* @param val The data to add
|
||||
* @remark If the key is not found, then this function acts like apr_table_add
|
||||
*/
|
||||
APR_DECLARE(void) apr_table_merge(apr_table_t *t, const char *key,
|
||||
const char *val);
|
||||
|
||||
/**
|
||||
* Add data to a table by merging the value with data that has already been
|
||||
* stored. The merging is done by concatenating the two values, separated
|
||||
* by the string ", ".
|
||||
* @param t The table to search for the data
|
||||
* @param key The key to merge data for (case does not matter)
|
||||
* @param val The data to add
|
||||
* @remark If the key is not found, then this function acts like apr_table_addn
|
||||
*/
|
||||
APR_DECLARE(void) apr_table_mergen(apr_table_t *t, const char *key,
|
||||
const char *val);
|
||||
|
||||
/**
|
||||
* Add data to a table, regardless of whether there is another element with the
|
||||
* same key.
|
||||
* @param t The table to add to
|
||||
* @param key The key to use
|
||||
* @param val The value to add.
|
||||
* @remark When adding data, this function makes a copy of both the key and the
|
||||
* value.
|
||||
*/
|
||||
APR_DECLARE(void) apr_table_add(apr_table_t *t, const char *key,
|
||||
const char *val);
|
||||
|
||||
/**
|
||||
* Add data to a table, regardless of whether there is another element with the
|
||||
* same key.
|
||||
* @param t The table to add to
|
||||
* @param key The key to use
|
||||
* @param val The value to add.
|
||||
* @remark When adding data, this function does not make a copy of the key or the
|
||||
* value, so care should be taken to ensure that the values will not
|
||||
* change after they have been added.
|
||||
*/
|
||||
APR_DECLARE(void) apr_table_addn(apr_table_t *t, const char *key,
|
||||
const char *val);
|
||||
|
||||
/**
|
||||
* Merge two tables into one new table.
|
||||
* @param p The pool to use for the new table
|
||||
* @param overlay The first table to put in the new table
|
||||
* @param base The table to add at the end of the new table
|
||||
* @return A new table containing all of the data from the two passed in
|
||||
*/
|
||||
APR_DECLARE(apr_table_t *) apr_table_overlay(apr_pool_t *p,
|
||||
const apr_table_t *overlay,
|
||||
const apr_table_t *base);
|
||||
|
||||
/**
|
||||
* Declaration prototype for the iterator callback function of apr_table_do()
|
||||
* and apr_table_vdo().
|
||||
* @param rec The data passed as the first argument to apr_table_[v]do()
|
||||
* @param key The key from this iteration of the table
|
||||
* @param value The value from this iteration of the table
|
||||
* @remark Iteration continues while this callback function returns non-zero.
|
||||
* To export the callback function for apr_table_[v]do() it must be declared
|
||||
* in the _NONSTD convention.
|
||||
*/
|
||||
typedef int (apr_table_do_callback_fn_t)(void *rec, const char *key,
|
||||
const char *value);
|
||||
|
||||
/**
|
||||
* Iterate over a table running the provided function once for every
|
||||
* element in the table. The varargs array must be a list of zero or
|
||||
* more (char *) keys followed by a NULL pointer. If zero keys are
|
||||
* given, the @param comp function will be invoked for every element
|
||||
* in the table. Otherwise, the function is invoked only for those
|
||||
* elements matching the keys specified.
|
||||
*
|
||||
* If an invocation of the @param comp function returns zero,
|
||||
* iteration will continue using the next specified key, if any.
|
||||
*
|
||||
* @param comp The function to run
|
||||
* @param rec The data to pass as the first argument to the function
|
||||
* @param t The table to iterate over
|
||||
* @param ... A varargs array of zero or more (char *) keys followed by NULL
|
||||
* @return FALSE if one of the comp() iterations returned zero; TRUE if all
|
||||
* iterations returned non-zero
|
||||
* @see apr_table_do_callback_fn_t
|
||||
*/
|
||||
APR_DECLARE_NONSTD(int) apr_table_do(apr_table_do_callback_fn_t *comp,
|
||||
void *rec, const apr_table_t *t, ...)
|
||||
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||
__attribute__((sentinel))
|
||||
#endif
|
||||
;
|
||||
|
||||
/**
|
||||
* Iterate over a table running the provided function once for every
|
||||
* element in the table. The @param vp varargs parameter must be a
|
||||
* list of zero or more (char *) keys followed by a NULL pointer. If
|
||||
* zero keys are given, the @param comp function will be invoked for
|
||||
* every element in the table. Otherwise, the function is invoked
|
||||
* only for those elements matching the keys specified.
|
||||
*
|
||||
* If an invocation of the @param comp function returns zero,
|
||||
* iteration will continue using the next specified key, if any.
|
||||
*
|
||||
* @param comp The function to run
|
||||
* @param rec The data to pass as the first argument to the function
|
||||
* @param t The table to iterate over
|
||||
* @param vp List of zero or more (char *) keys followed by NULL
|
||||
* @return FALSE if one of the comp() iterations returned zero; TRUE if all
|
||||
* iterations returned non-zero
|
||||
* @see apr_table_do_callback_fn_t
|
||||
*/
|
||||
APR_DECLARE(int) apr_table_vdo(apr_table_do_callback_fn_t *comp,
|
||||
void *rec, const apr_table_t *t, va_list vp);
|
||||
|
||||
/** flag for overlap to use apr_table_setn */
|
||||
#define APR_OVERLAP_TABLES_SET (0)
|
||||
/** flag for overlap to use apr_table_mergen */
|
||||
#define APR_OVERLAP_TABLES_MERGE (1)
|
||||
/**
|
||||
* For each element in table b, either use setn or mergen to add the data
|
||||
* to table a. Which method is used is determined by the flags passed in.
|
||||
* @param a The table to add the data to.
|
||||
* @param b The table to iterate over, adding its data to table a
|
||||
* @param flags How to add the table to table a. One of:
|
||||
* APR_OVERLAP_TABLES_SET Use apr_table_setn
|
||||
* APR_OVERLAP_TABLES_MERGE Use apr_table_mergen
|
||||
* @remark When merging duplicates, the two values are concatenated,
|
||||
* separated by the string ", ".
|
||||
* @remark This function is highly optimized, and uses less memory and CPU cycles
|
||||
* than a function that just loops through table b calling other functions.
|
||||
*/
|
||||
/**
|
||||
* Conceptually, apr_table_overlap does this:
|
||||
*
|
||||
* <pre>
|
||||
* apr_array_header_t *barr = apr_table_elts(b);
|
||||
* apr_table_entry_t *belt = (apr_table_entry_t *)barr->elts;
|
||||
* int i;
|
||||
*
|
||||
* for (i = 0; i < barr->nelts; ++i) {
|
||||
* if (flags & APR_OVERLAP_TABLES_MERGE) {
|
||||
* apr_table_mergen(a, belt[i].key, belt[i].val);
|
||||
* }
|
||||
* else {
|
||||
* apr_table_setn(a, belt[i].key, belt[i].val);
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* Except that it is more efficient (less space and cpu-time) especially
|
||||
* when b has many elements.
|
||||
*
|
||||
* Notice the assumptions on the keys and values in b -- they must be
|
||||
* in an ancestor of a's pool. In practice b and a are usually from
|
||||
* the same pool.
|
||||
*/
|
||||
|
||||
APR_DECLARE(void) apr_table_overlap(apr_table_t *a, const apr_table_t *b,
|
||||
unsigned flags);
|
||||
|
||||
/**
|
||||
* Eliminate redundant entries in a table by either overwriting
|
||||
* or merging duplicates.
|
||||
*
|
||||
* @param t Table.
|
||||
* @param flags APR_OVERLAP_TABLES_MERGE to merge, or
|
||||
* APR_OVERLAP_TABLES_SET to overwrite
|
||||
* @remark When merging duplicates, the two values are concatenated,
|
||||
* separated by the string ", ".
|
||||
*/
|
||||
APR_DECLARE(void) apr_table_compress(apr_table_t *t, unsigned flags);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_TABLES_H */
|
139
include/apr_thread_cond.h
Normal file
139
include/apr_thread_cond.h
Normal file
@ -0,0 +1,139 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_THREAD_COND_H
|
||||
#define APR_THREAD_COND_H
|
||||
|
||||
/**
|
||||
* @file apr_thread_cond.h
|
||||
* @brief APR Condition Variable Routines
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_time.h"
|
||||
#include "apr_thread_mutex.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#if APR_HAS_THREADS || defined(DOXYGEN)
|
||||
|
||||
/**
|
||||
* @defgroup apr_thread_cond Condition Variable Routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Opaque structure for thread condition variables */
|
||||
typedef struct apr_thread_cond_t apr_thread_cond_t;
|
||||
|
||||
/**
|
||||
* Note: destroying a condition variable (or likewise, destroying or
|
||||
* clearing the pool from which a condition variable was allocated) if
|
||||
* any threads are blocked waiting on it gives undefined results.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create and initialize a condition variable that can be used to signal
|
||||
* and schedule threads in a single process.
|
||||
* @param cond the memory address where the newly created condition variable
|
||||
* will be stored.
|
||||
* @param pool the pool from which to allocate the condition.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_cond_create(apr_thread_cond_t **cond,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Put the active calling thread to sleep until signaled to wake up. Each
|
||||
* condition variable must be associated with a mutex, and that mutex must
|
||||
* be locked before calling this function, or the behavior will be
|
||||
* undefined. As the calling thread is put to sleep, the given mutex
|
||||
* will be simultaneously released; and as this thread wakes up the lock
|
||||
* is again simultaneously acquired.
|
||||
* @param cond the condition variable on which to block.
|
||||
* @param mutex the mutex that must be locked upon entering this function,
|
||||
* is released while the thread is asleep, and is again acquired before
|
||||
* returning from this function.
|
||||
* @remark Spurious wakeups may occur. Before and after every call to wait on
|
||||
* a condition variable, the caller should test whether the condition is already
|
||||
* met.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_cond_wait(apr_thread_cond_t *cond,
|
||||
apr_thread_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Put the active calling thread to sleep until signaled to wake up or
|
||||
* the timeout is reached. Each condition variable must be associated
|
||||
* with a mutex, and that mutex must be locked before calling this
|
||||
* function, or the behavior will be undefined. As the calling thread
|
||||
* is put to sleep, the given mutex will be simultaneously released;
|
||||
* and as this thread wakes up the lock is again simultaneously acquired.
|
||||
* @param cond the condition variable on which to block.
|
||||
* @param mutex the mutex that must be locked upon entering this function,
|
||||
* is released while the thread is asleep, and is again acquired before
|
||||
* returning from this function.
|
||||
* @param timeout The amount of time in microseconds to wait. This is
|
||||
* a maximum, not a minimum. If the condition is signaled, we
|
||||
* will wake up before this time, otherwise the error APR_TIMEUP
|
||||
* is returned.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_cond_timedwait(apr_thread_cond_t *cond,
|
||||
apr_thread_mutex_t *mutex,
|
||||
apr_interval_time_t timeout);
|
||||
|
||||
/**
|
||||
* Signals a single thread, if one exists, that is blocking on the given
|
||||
* condition variable. That thread is then scheduled to wake up and acquire
|
||||
* the associated mutex. Although it is not required, if predictable scheduling
|
||||
* is desired, that mutex must be locked while calling this function.
|
||||
* @param cond the condition variable on which to produce the signal.
|
||||
* @remark If no threads are waiting on the condition variable, nothing happens.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_cond_signal(apr_thread_cond_t *cond);
|
||||
|
||||
/**
|
||||
* Signals all threads blocking on the given condition variable.
|
||||
* Each thread that was signaled is then scheduled to wake up and acquire
|
||||
* the associated mutex. This will happen in a serialized manner.
|
||||
* @param cond the condition variable on which to produce the broadcast.
|
||||
* @remark If no threads are waiting on the condition variable, nothing happens.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_cond_broadcast(apr_thread_cond_t *cond);
|
||||
|
||||
/**
|
||||
* Destroy the condition variable and free the associated memory.
|
||||
* @param cond the condition variable to destroy.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_cond_destroy(apr_thread_cond_t *cond);
|
||||
|
||||
/**
|
||||
* Get the pool used by this thread_cond.
|
||||
* @return apr_pool_t the pool
|
||||
*/
|
||||
APR_POOL_DECLARE_ACCESSOR(thread_cond);
|
||||
|
||||
#endif /* APR_HAS_THREADS */
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_THREAD_COND_H */
|
110
include/apr_thread_mutex.h
Normal file
110
include/apr_thread_mutex.h
Normal file
@ -0,0 +1,110 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_THREAD_MUTEX_H
|
||||
#define APR_THREAD_MUTEX_H
|
||||
|
||||
/**
|
||||
* @file apr_thread_mutex.h
|
||||
* @brief APR Thread Mutex Routines
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_errno.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#if APR_HAS_THREADS || defined(DOXYGEN)
|
||||
|
||||
/**
|
||||
* @defgroup apr_thread_mutex Thread Mutex Routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Opaque thread-local mutex structure */
|
||||
typedef struct apr_thread_mutex_t apr_thread_mutex_t;
|
||||
|
||||
#define APR_THREAD_MUTEX_DEFAULT 0x0 /**< platform-optimal lock behavior */
|
||||
#define APR_THREAD_MUTEX_NESTED 0x1 /**< enable nested (recursive) locks */
|
||||
#define APR_THREAD_MUTEX_UNNESTED 0x2 /**< disable nested locks */
|
||||
|
||||
/* Delayed the include to avoid a circular reference */
|
||||
#include "apr_pools.h"
|
||||
|
||||
/**
|
||||
* Create and initialize a mutex that can be used to synchronize threads.
|
||||
* @param mutex the memory address where the newly created mutex will be
|
||||
* stored.
|
||||
* @param flags Or'ed value of:
|
||||
* <PRE>
|
||||
* APR_THREAD_MUTEX_DEFAULT platform-optimal lock behavior.
|
||||
* APR_THREAD_MUTEX_NESTED enable nested (recursive) locks.
|
||||
* APR_THREAD_MUTEX_UNNESTED disable nested locks (non-recursive).
|
||||
* </PRE>
|
||||
* @param pool the pool from which to allocate the mutex.
|
||||
* @warning Be cautious in using APR_THREAD_MUTEX_DEFAULT. While this is the
|
||||
* most optimial mutex based on a given platform's performance charateristics,
|
||||
* it will behave as either a nested or an unnested lock.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_mutex_create(apr_thread_mutex_t **mutex,
|
||||
unsigned int flags,
|
||||
apr_pool_t *pool);
|
||||
/**
|
||||
* Acquire the lock for the given mutex. If the mutex is already locked,
|
||||
* the current thread will be put to sleep until the lock becomes available.
|
||||
* @param mutex the mutex on which to acquire the lock.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_mutex_lock(apr_thread_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Attempt to acquire the lock for the given mutex. If the mutex has already
|
||||
* been acquired, the call returns immediately with APR_EBUSY. Note: it
|
||||
* is important that the APR_STATUS_IS_EBUSY(s) macro be used to determine
|
||||
* if the return value was APR_EBUSY, for portability reasons.
|
||||
* @param mutex the mutex on which to attempt the lock acquiring.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_mutex_trylock(apr_thread_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Release the lock for the given mutex.
|
||||
* @param mutex the mutex from which to release the lock.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_mutex_unlock(apr_thread_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Destroy the mutex and free the memory associated with the lock.
|
||||
* @param mutex the mutex to destroy.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_mutex_destroy(apr_thread_mutex_t *mutex);
|
||||
|
||||
/**
|
||||
* Get the pool used by this thread_mutex.
|
||||
* @return apr_pool_t the pool
|
||||
*/
|
||||
APR_POOL_DECLARE_ACCESSOR(thread_mutex);
|
||||
|
||||
#endif /* APR_HAS_THREADS */
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_THREAD_MUTEX_H */
|
824
include/apr_thread_proc.h
Normal file
824
include/apr_thread_proc.h
Normal file
@ -0,0 +1,824 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_THREAD_PROC_H
|
||||
#define APR_THREAD_PROC_H
|
||||
|
||||
/**
|
||||
* @file apr_thread_proc.h
|
||||
* @brief APR Thread and Process Library
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_file_io.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
|
||||
#if APR_HAVE_STRUCT_RLIMIT
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_thread_proc Threads and Process Functions
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
APR_SHELLCMD, /**< use the shell to invoke the program */
|
||||
APR_PROGRAM, /**< invoke the program directly, no copied env */
|
||||
APR_PROGRAM_ENV, /**< invoke the program, replicating our environment */
|
||||
APR_PROGRAM_PATH, /**< find program on PATH, use our environment */
|
||||
APR_SHELLCMD_ENV /**< use the shell to invoke the program,
|
||||
* replicating our environment
|
||||
*/
|
||||
} apr_cmdtype_e;
|
||||
|
||||
typedef enum {
|
||||
APR_WAIT, /**< wait for the specified process to finish */
|
||||
APR_NOWAIT /**< do not wait -- just see if it has finished */
|
||||
} apr_wait_how_e;
|
||||
|
||||
/* I am specifically calling out the values so that the macros below make
|
||||
* more sense. Yes, I know I don't need to, but I am hoping this makes what
|
||||
* I am doing more clear. If you want to add more reasons to exit, continue
|
||||
* to use bitmasks.
|
||||
*/
|
||||
typedef enum {
|
||||
APR_PROC_EXIT = 1, /**< process exited normally */
|
||||
APR_PROC_SIGNAL = 2, /**< process exited due to a signal */
|
||||
APR_PROC_SIGNAL_CORE = 4 /**< process exited and dumped a core file */
|
||||
} apr_exit_why_e;
|
||||
|
||||
/** did we exit the process */
|
||||
#define APR_PROC_CHECK_EXIT(x) (x & APR_PROC_EXIT)
|
||||
/** did we get a signal */
|
||||
#define APR_PROC_CHECK_SIGNALED(x) (x & APR_PROC_SIGNAL)
|
||||
/** did we get core */
|
||||
#define APR_PROC_CHECK_CORE_DUMP(x) (x & APR_PROC_SIGNAL_CORE)
|
||||
|
||||
/** @see apr_procattr_io_set */
|
||||
#define APR_NO_PIPE 0
|
||||
/** @see apr_procattr_io_set and apr_file_pipe_create_ex */
|
||||
#define APR_FULL_BLOCK 1
|
||||
/** @see apr_procattr_io_set and apr_file_pipe_create_ex */
|
||||
#define APR_FULL_NONBLOCK 2
|
||||
/** @see apr_procattr_io_set */
|
||||
#define APR_PARENT_BLOCK 3
|
||||
/** @see apr_procattr_io_set */
|
||||
#define APR_CHILD_BLOCK 4
|
||||
/** @see apr_procattr_io_set */
|
||||
#define APR_NO_FILE 8
|
||||
|
||||
/** @see apr_file_pipe_create_ex */
|
||||
#define APR_READ_BLOCK 3
|
||||
/** @see apr_file_pipe_create_ex */
|
||||
#define APR_WRITE_BLOCK 4
|
||||
|
||||
/** @see apr_procattr_io_set
|
||||
* @note Win32 only effective with version 1.2.12, portably introduced in 1.3.0
|
||||
*/
|
||||
#define APR_NO_FILE 8
|
||||
|
||||
/** @see apr_procattr_limit_set */
|
||||
#define APR_LIMIT_CPU 0
|
||||
/** @see apr_procattr_limit_set */
|
||||
#define APR_LIMIT_MEM 1
|
||||
/** @see apr_procattr_limit_set */
|
||||
#define APR_LIMIT_NPROC 2
|
||||
/** @see apr_procattr_limit_set */
|
||||
#define APR_LIMIT_NOFILE 3
|
||||
|
||||
/**
|
||||
* @defgroup APR_OC Other Child Flags
|
||||
* @{
|
||||
*/
|
||||
#define APR_OC_REASON_DEATH 0 /**< child has died, caller must call
|
||||
* unregister still */
|
||||
#define APR_OC_REASON_UNWRITABLE 1 /**< write_fd is unwritable */
|
||||
#define APR_OC_REASON_RESTART 2 /**< a restart is occuring, perform
|
||||
* any necessary cleanup (including
|
||||
* sending a special signal to child)
|
||||
*/
|
||||
#define APR_OC_REASON_UNREGISTER 3 /**< unregister has been called, do
|
||||
* whatever is necessary (including
|
||||
* kill the child) */
|
||||
#define APR_OC_REASON_LOST 4 /**< somehow the child exited without
|
||||
* us knowing ... buggy os? */
|
||||
#define APR_OC_REASON_RUNNING 5 /**< a health check is occuring,
|
||||
* for most maintainence functions
|
||||
* this is a no-op.
|
||||
*/
|
||||
/** @} */
|
||||
|
||||
/** The APR process type */
|
||||
typedef struct apr_proc_t {
|
||||
/** The process ID */
|
||||
pid_t pid;
|
||||
/** Parent's side of pipe to child's stdin */
|
||||
apr_file_t *in;
|
||||
/** Parent's side of pipe to child's stdout */
|
||||
apr_file_t *out;
|
||||
/** Parent's side of pipe to child's stdouterr */
|
||||
apr_file_t *err;
|
||||
#if APR_HAS_PROC_INVOKED || defined(DOXYGEN)
|
||||
/** Diagnositics/debugging string of the command invoked for
|
||||
* this process [only present if APR_HAS_PROC_INVOKED is true]
|
||||
* @remark Only enabled on Win32 by default.
|
||||
* @bug This should either always or never be present in release
|
||||
* builds - since it breaks binary compatibility. We may enable
|
||||
* it always in APR 1.0 yet leave it undefined in most cases.
|
||||
*/
|
||||
char *invoked;
|
||||
#endif
|
||||
#if defined(WIN32) || defined(DOXYGEN)
|
||||
/** (Win32 only) Creator's handle granting access to the process
|
||||
* @remark This handle is closed and reset to NULL in every case
|
||||
* corresponding to a waitpid() on Unix which returns the exit status.
|
||||
* Therefore Win32 correspond's to Unix's zombie reaping characteristics
|
||||
* and avoids potential handle leaks.
|
||||
*/
|
||||
HANDLE hproc;
|
||||
#endif
|
||||
} apr_proc_t;
|
||||
|
||||
/**
|
||||
* The prototype for APR child errfn functions. (See the description
|
||||
* of apr_procattr_child_errfn_set() for more information.)
|
||||
* It is passed the following parameters:
|
||||
* @param pool Pool associated with the apr_proc_t. If your child
|
||||
* error function needs user data, associate it with this
|
||||
* pool.
|
||||
* @param err APR error code describing the error
|
||||
* @param description Text description of type of processing which failed
|
||||
*/
|
||||
typedef void (apr_child_errfn_t)(apr_pool_t *proc, apr_status_t err,
|
||||
const char *description);
|
||||
|
||||
/** Opaque Thread structure. */
|
||||
typedef struct apr_thread_t apr_thread_t;
|
||||
|
||||
/** Opaque Thread attributes structure. */
|
||||
typedef struct apr_threadattr_t apr_threadattr_t;
|
||||
|
||||
/** Opaque Process attributes structure. */
|
||||
typedef struct apr_procattr_t apr_procattr_t;
|
||||
|
||||
/** Opaque control variable for one-time atomic variables. */
|
||||
typedef struct apr_thread_once_t apr_thread_once_t;
|
||||
|
||||
/** Opaque thread private address space. */
|
||||
typedef struct apr_threadkey_t apr_threadkey_t;
|
||||
|
||||
/** Opaque record of child process. */
|
||||
typedef struct apr_other_child_rec_t apr_other_child_rec_t;
|
||||
|
||||
/**
|
||||
* The prototype for any APR thread worker functions.
|
||||
*/
|
||||
typedef void *(APR_THREAD_FUNC *apr_thread_start_t)(apr_thread_t*, void*);
|
||||
|
||||
typedef enum {
|
||||
APR_KILL_NEVER, /**< process is never sent any signals */
|
||||
APR_KILL_ALWAYS, /**< process is sent SIGKILL on apr_pool_t cleanup */
|
||||
APR_KILL_AFTER_TIMEOUT, /**< SIGTERM, wait 3 seconds, SIGKILL */
|
||||
APR_JUST_WAIT, /**< wait forever for the process to complete */
|
||||
APR_KILL_ONLY_ONCE /**< send SIGTERM and then wait */
|
||||
} apr_kill_conditions_e;
|
||||
|
||||
/* Thread Function definitions */
|
||||
|
||||
#if APR_HAS_THREADS
|
||||
|
||||
/**
|
||||
* Create and initialize a new threadattr variable
|
||||
* @param new_attr The newly created threadattr.
|
||||
* @param cont The pool to use
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new_attr,
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* Set if newly created threads should be created in detached state.
|
||||
* @param attr The threadattr to affect
|
||||
* @param on Non-zero if detached threads should be created.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr,
|
||||
apr_int32_t on);
|
||||
|
||||
/**
|
||||
* Get the detach state for this threadattr.
|
||||
* @param attr The threadattr to reference
|
||||
* @return APR_DETACH if threads are to be detached, or APR_NOTDETACH
|
||||
* if threads are to be joinable.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_threadattr_detach_get(apr_threadattr_t *attr);
|
||||
|
||||
/**
|
||||
* Set the stack size of newly created threads.
|
||||
* @param attr The threadattr to affect
|
||||
* @param stacksize The stack size in bytes
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t *attr,
|
||||
apr_size_t stacksize);
|
||||
|
||||
/**
|
||||
* Set the stack guard area size of newly created threads.
|
||||
* @param attr The threadattr to affect
|
||||
* @param guardsize The stack guard area size in bytes
|
||||
* @note Thread library implementations commonly use a "guard area"
|
||||
* after each thread's stack which is not readable or writable such that
|
||||
* stack overflows cause a segfault; this consumes e.g. 4K of memory
|
||||
* and increases memory management overhead. Setting the guard area
|
||||
* size to zero hence trades off reliable behaviour on stack overflow
|
||||
* for performance. */
|
||||
APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
|
||||
apr_size_t guardsize);
|
||||
|
||||
/**
|
||||
* Create a new thread of execution
|
||||
* @param new_thread The newly created thread handle.
|
||||
* @param attr The threadattr to use to determine how to create the thread
|
||||
* @param func The function to start the new thread in
|
||||
* @param data Any data to be passed to the starting function
|
||||
* @param cont The pool to use
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new_thread,
|
||||
apr_threadattr_t *attr,
|
||||
apr_thread_start_t func,
|
||||
void *data, apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* stop the current thread
|
||||
* @param thd The thread to stop
|
||||
* @param retval The return value to pass back to any thread that cares
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd,
|
||||
apr_status_t retval);
|
||||
|
||||
/**
|
||||
* block until the desired thread stops executing.
|
||||
* @param retval The return value from the dead thread.
|
||||
* @param thd The thread to join
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval,
|
||||
apr_thread_t *thd);
|
||||
|
||||
/**
|
||||
* force the current thread to yield the processor
|
||||
*/
|
||||
APR_DECLARE(void) apr_thread_yield(void);
|
||||
|
||||
/**
|
||||
* Initialize the control variable for apr_thread_once. If this isn't
|
||||
* called, apr_initialize won't work.
|
||||
* @param control The control variable to initialize
|
||||
* @param p The pool to allocate data from.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_once_init(apr_thread_once_t **control,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Run the specified function one time, regardless of how many threads
|
||||
* call it.
|
||||
* @param control The control variable. The same variable should
|
||||
* be passed in each time the function is tried to be
|
||||
* called. This is how the underlying functions determine
|
||||
* if the function has ever been called before.
|
||||
* @param func The function to call.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_once(apr_thread_once_t *control,
|
||||
void (*func)(void));
|
||||
|
||||
/**
|
||||
* detach a thread
|
||||
* @param thd The thread to detach
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd);
|
||||
|
||||
/**
|
||||
* Return the pool associated with the current thread.
|
||||
* @param data The user data associated with the thread.
|
||||
* @param key The key to associate with the data
|
||||
* @param thread The currently open thread.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_data_get(void **data, const char *key,
|
||||
apr_thread_t *thread);
|
||||
|
||||
/**
|
||||
* Return the pool associated with the current thread.
|
||||
* @param data The user data to associate with the thread.
|
||||
* @param key The key to use for associating the data with the thread
|
||||
* @param cleanup The cleanup routine to use when the thread is destroyed.
|
||||
* @param thread The currently open thread.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_data_set(void *data, const char *key,
|
||||
apr_status_t (*cleanup) (void *),
|
||||
apr_thread_t *thread);
|
||||
|
||||
/**
|
||||
* Create and initialize a new thread private address space
|
||||
* @param key The thread private handle.
|
||||
* @param dest The destructor to use when freeing the private memory.
|
||||
* @param cont The pool to use
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_threadkey_private_create(apr_threadkey_t **key,
|
||||
void (*dest)(void *),
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* Get a pointer to the thread private memory
|
||||
* @param new_mem The data stored in private memory
|
||||
* @param key The handle for the desired thread private memory
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_threadkey_private_get(void **new_mem,
|
||||
apr_threadkey_t *key);
|
||||
|
||||
/**
|
||||
* Set the data to be stored in thread private memory
|
||||
* @param priv The data to be stored in private memory
|
||||
* @param key The handle for the desired thread private memory
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_threadkey_private_set(void *priv,
|
||||
apr_threadkey_t *key);
|
||||
|
||||
/**
|
||||
* Free the thread private memory
|
||||
* @param key The handle for the desired thread private memory
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_threadkey_private_delete(apr_threadkey_t *key);
|
||||
|
||||
/**
|
||||
* Return the pool associated with the current threadkey.
|
||||
* @param data The user data associated with the threadkey.
|
||||
* @param key The key associated with the data
|
||||
* @param threadkey The currently open threadkey.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_threadkey_data_get(void **data, const char *key,
|
||||
apr_threadkey_t *threadkey);
|
||||
|
||||
/**
|
||||
* Return the pool associated with the current threadkey.
|
||||
* @param data The data to set.
|
||||
* @param key The key to associate with the data.
|
||||
* @param cleanup The cleanup routine to use when the file is destroyed.
|
||||
* @param threadkey The currently open threadkey.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_threadkey_data_set(void *data, const char *key,
|
||||
apr_status_t (*cleanup) (void *),
|
||||
apr_threadkey_t *threadkey);
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Create and initialize a new procattr variable
|
||||
* @param new_attr The newly created procattr.
|
||||
* @param cont The pool to use
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new_attr,
|
||||
apr_pool_t *cont);
|
||||
|
||||
/**
|
||||
* Determine if any of stdin, stdout, or stderr should be linked to pipes
|
||||
* when starting a child process.
|
||||
* @param attr The procattr we care about.
|
||||
* @param in Should stdin be a pipe back to the parent?
|
||||
* @param out Should stdout be a pipe back to the parent?
|
||||
* @param err Should stderr be a pipe back to the parent?
|
||||
* @note If APR_NO_PIPE, there will be no special channel, the child
|
||||
* inherits the parent's corresponding stdio stream. If APR_NO_FILE is
|
||||
* specified, that corresponding stream is closed in the child (and will
|
||||
* be INVALID_HANDLE_VALUE when inspected on Win32). This can have ugly
|
||||
* side effects, as the next file opened in the child on Unix will fall
|
||||
* into the stdio stream fd slot!
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr,
|
||||
apr_int32_t in, apr_int32_t out,
|
||||
apr_int32_t err);
|
||||
|
||||
/**
|
||||
* Set the child_in and/or parent_in values to existing apr_file_t values.
|
||||
* @param attr The procattr we care about.
|
||||
* @param child_in apr_file_t value to use as child_in. Must be a valid file.
|
||||
* @param parent_in apr_file_t value to use as parent_in. Must be a valid file.
|
||||
* @remark This is NOT a required initializer function. This is
|
||||
* useful if you have already opened a pipe (or multiple files)
|
||||
* that you wish to use, perhaps persistently across multiple
|
||||
* process invocations - such as a log file. You can save some
|
||||
* extra function calls by not creating your own pipe since this
|
||||
* creates one in the process space for you.
|
||||
* @bug Note that calling this function with two NULL files on some platforms
|
||||
* creates an APR_FULL_BLOCK pipe, but this behavior is neither portable nor
|
||||
* is it supported. @see apr_procattr_io_set instead for simple pipes.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_child_in_set(struct apr_procattr_t *attr,
|
||||
apr_file_t *child_in,
|
||||
apr_file_t *parent_in);
|
||||
|
||||
/**
|
||||
* Set the child_out and parent_out values to existing apr_file_t values.
|
||||
* @param attr The procattr we care about.
|
||||
* @param child_out apr_file_t value to use as child_out. Must be a valid file.
|
||||
* @param parent_out apr_file_t value to use as parent_out. Must be a valid file.
|
||||
* @remark This is NOT a required initializer function. This is
|
||||
* useful if you have already opened a pipe (or multiple files)
|
||||
* that you wish to use, perhaps persistently across multiple
|
||||
* process invocations - such as a log file.
|
||||
* @bug Note that calling this function with two NULL files on some platforms
|
||||
* creates an APR_FULL_BLOCK pipe, but this behavior is neither portable nor
|
||||
* is it supported. @see apr_procattr_io_set instead for simple pipes.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_child_out_set(struct apr_procattr_t *attr,
|
||||
apr_file_t *child_out,
|
||||
apr_file_t *parent_out);
|
||||
|
||||
/**
|
||||
* Set the child_err and parent_err values to existing apr_file_t values.
|
||||
* @param attr The procattr we care about.
|
||||
* @param child_err apr_file_t value to use as child_err. Must be a valid file.
|
||||
* @param parent_err apr_file_t value to use as parent_err. Must be a valid file.
|
||||
* @remark This is NOT a required initializer function. This is
|
||||
* useful if you have already opened a pipe (or multiple files)
|
||||
* that you wish to use, perhaps persistently across multiple
|
||||
* process invocations - such as a log file.
|
||||
* @bug Note that calling this function with two NULL files on some platforms
|
||||
* creates an APR_FULL_BLOCK pipe, but this behavior is neither portable nor
|
||||
* is it supported. @see apr_procattr_io_set instead for simple pipes.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_child_err_set(struct apr_procattr_t *attr,
|
||||
apr_file_t *child_err,
|
||||
apr_file_t *parent_err);
|
||||
|
||||
/**
|
||||
* Set which directory the child process should start executing in.
|
||||
* @param attr The procattr we care about.
|
||||
* @param dir Which dir to start in. By default, this is the same dir as
|
||||
* the parent currently resides in, when the createprocess call
|
||||
* is made.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_dir_set(apr_procattr_t *attr,
|
||||
const char *dir);
|
||||
|
||||
/**
|
||||
* Set what type of command the child process will call.
|
||||
* @param attr The procattr we care about.
|
||||
* @param cmd The type of command. One of:
|
||||
* <PRE>
|
||||
* APR_SHELLCMD -- Anything that the shell can handle
|
||||
* APR_PROGRAM -- Executable program (default)
|
||||
* APR_PROGRAM_ENV -- Executable program, copy environment
|
||||
* APR_PROGRAM_PATH -- Executable program on PATH, copy env
|
||||
* </PRE>
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_cmdtype_set(apr_procattr_t *attr,
|
||||
apr_cmdtype_e cmd);
|
||||
|
||||
/**
|
||||
* Determine if the child should start in detached state.
|
||||
* @param attr The procattr we care about.
|
||||
* @param detach Should the child start in detached state? Default is no.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr,
|
||||
apr_int32_t detach);
|
||||
|
||||
#if APR_HAVE_STRUCT_RLIMIT
|
||||
/**
|
||||
* Set the Resource Utilization limits when starting a new process.
|
||||
* @param attr The procattr we care about.
|
||||
* @param what Which limit to set, one of:
|
||||
* <PRE>
|
||||
* APR_LIMIT_CPU
|
||||
* APR_LIMIT_MEM
|
||||
* APR_LIMIT_NPROC
|
||||
* APR_LIMIT_NOFILE
|
||||
* </PRE>
|
||||
* @param limit Value to set the limit to.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_limit_set(apr_procattr_t *attr,
|
||||
apr_int32_t what,
|
||||
struct rlimit *limit);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Specify an error function to be called in the child process if APR
|
||||
* encounters an error in the child prior to running the specified program.
|
||||
* @param attr The procattr describing the child process to be created.
|
||||
* @param errfn The function to call in the child process.
|
||||
* @remark At the present time, it will only be called from apr_proc_create()
|
||||
* on platforms where fork() is used. It will never be called on other
|
||||
* platforms, on those platforms apr_proc_create() will return the error
|
||||
* in the parent process rather than invoke the callback in the now-forked
|
||||
* child process.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_child_errfn_set(apr_procattr_t *attr,
|
||||
apr_child_errfn_t *errfn);
|
||||
|
||||
/**
|
||||
* Specify that apr_proc_create() should do whatever it can to report
|
||||
* failures to the caller of apr_proc_create(), rather than find out in
|
||||
* the child.
|
||||
* @param attr The procattr describing the child process to be created.
|
||||
* @param chk Flag to indicate whether or not extra work should be done
|
||||
* to try to report failures to the caller.
|
||||
* @remark This flag only affects apr_proc_create() on platforms where
|
||||
* fork() is used. This leads to extra overhead in the calling
|
||||
* process, but that may help the application handle such
|
||||
* errors more gracefully.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_error_check_set(apr_procattr_t *attr,
|
||||
apr_int32_t chk);
|
||||
|
||||
/**
|
||||
* Determine if the child should start in its own address space or using the
|
||||
* current one from its parent
|
||||
* @param attr The procattr we care about.
|
||||
* @param addrspace Should the child start in its own address space? Default
|
||||
* is no on NetWare and yes on other platforms.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_addrspace_set(apr_procattr_t *attr,
|
||||
apr_int32_t addrspace);
|
||||
|
||||
/**
|
||||
* Set the username used for running process
|
||||
* @param attr The procattr we care about.
|
||||
* @param username The username used
|
||||
* @param password User password if needed. Password is needed on WIN32
|
||||
* or any other platform having
|
||||
* APR_PROCATTR_USER_SET_REQUIRES_PASSWORD set.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr,
|
||||
const char *username,
|
||||
const char *password);
|
||||
|
||||
/**
|
||||
* Set the group used for running process
|
||||
* @param attr The procattr we care about.
|
||||
* @param groupname The group name used
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_procattr_group_set(apr_procattr_t *attr,
|
||||
const char *groupname);
|
||||
|
||||
|
||||
#if APR_HAS_FORK
|
||||
/**
|
||||
* This is currently the only non-portable call in APR. This executes
|
||||
* a standard unix fork.
|
||||
* @param proc The resulting process handle.
|
||||
* @param cont The pool to use.
|
||||
* @remark returns APR_INCHILD for the child, and APR_INPARENT for the parent
|
||||
* or an error.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *cont);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Create a new process and execute a new program within that process.
|
||||
* @param new_proc The resulting process handle.
|
||||
* @param progname The program to run
|
||||
* @param args the arguments to pass to the new program. The first
|
||||
* one should be the program name.
|
||||
* @param env The new environment table for the new process. This
|
||||
* should be a list of NULL-terminated strings. This argument
|
||||
* is ignored for APR_PROGRAM_ENV, APR_PROGRAM_PATH, and
|
||||
* APR_SHELLCMD_ENV types of commands.
|
||||
* @param attr the procattr we should use to determine how to create the new
|
||||
* process
|
||||
* @param pool The pool to use.
|
||||
* @note This function returns without waiting for the new process to terminate;
|
||||
* use apr_proc_wait for that.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new_proc,
|
||||
const char *progname,
|
||||
const char * const *args,
|
||||
const char * const *env,
|
||||
apr_procattr_t *attr,
|
||||
apr_pool_t *pool);
|
||||
|
||||
/**
|
||||
* Wait for a child process to die
|
||||
* @param proc The process handle that corresponds to the desired child process
|
||||
* @param exitcode The returned exit status of the child, if a child process
|
||||
* dies, or the signal that caused the child to die.
|
||||
* On platforms that don't support obtaining this information,
|
||||
* the status parameter will be returned as APR_ENOTIMPL.
|
||||
* @param exitwhy Why the child died, the bitwise or of:
|
||||
* <PRE>
|
||||
* APR_PROC_EXIT -- process terminated normally
|
||||
* APR_PROC_SIGNAL -- process was killed by a signal
|
||||
* APR_PROC_SIGNAL_CORE -- process was killed by a signal, and
|
||||
* generated a core dump.
|
||||
* </PRE>
|
||||
* @param waithow How should we wait. One of:
|
||||
* <PRE>
|
||||
* APR_WAIT -- block until the child process dies.
|
||||
* APR_NOWAIT -- return immediately regardless of if the
|
||||
* child is dead or not.
|
||||
* </PRE>
|
||||
* @remark The childs status is in the return code to this process. It is one of:
|
||||
* <PRE>
|
||||
* APR_CHILD_DONE -- child is no longer running.
|
||||
* APR_CHILD_NOTDONE -- child is still running.
|
||||
* </PRE>
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc,
|
||||
int *exitcode, apr_exit_why_e *exitwhy,
|
||||
apr_wait_how_e waithow);
|
||||
|
||||
/**
|
||||
* Wait for any current child process to die and return information
|
||||
* about that child.
|
||||
* @param proc Pointer to NULL on entry, will be filled out with child's
|
||||
* information
|
||||
* @param exitcode The returned exit status of the child, if a child process
|
||||
* dies, or the signal that caused the child to die.
|
||||
* On platforms that don't support obtaining this information,
|
||||
* the status parameter will be returned as APR_ENOTIMPL.
|
||||
* @param exitwhy Why the child died, the bitwise or of:
|
||||
* <PRE>
|
||||
* APR_PROC_EXIT -- process terminated normally
|
||||
* APR_PROC_SIGNAL -- process was killed by a signal
|
||||
* APR_PROC_SIGNAL_CORE -- process was killed by a signal, and
|
||||
* generated a core dump.
|
||||
* </PRE>
|
||||
* @param waithow How should we wait. One of:
|
||||
* <PRE>
|
||||
* APR_WAIT -- block until the child process dies.
|
||||
* APR_NOWAIT -- return immediately regardless of if the
|
||||
* child is dead or not.
|
||||
* </PRE>
|
||||
* @param p Pool to allocate child information out of.
|
||||
* @bug Passing proc as a *proc rather than **proc was an odd choice
|
||||
* for some platforms... this should be revisited in 1.0
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc,
|
||||
int *exitcode,
|
||||
apr_exit_why_e *exitwhy,
|
||||
apr_wait_how_e waithow,
|
||||
apr_pool_t *p);
|
||||
|
||||
#define APR_PROC_DETACH_FOREGROUND 0 /**< Do not detach */
|
||||
#define APR_PROC_DETACH_DAEMONIZE 1 /**< Detach */
|
||||
|
||||
/**
|
||||
* Detach the process from the controlling terminal.
|
||||
* @param daemonize set to non-zero if the process should daemonize
|
||||
* and become a background process, else it will
|
||||
* stay in the foreground.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_detach(int daemonize);
|
||||
|
||||
/**
|
||||
* Register an other_child -- a child associated to its registered
|
||||
* maintence callback. This callback is invoked when the process
|
||||
* dies, is disconnected or disappears.
|
||||
* @param proc The child process to register.
|
||||
* @param maintenance maintenance is a function that is invoked with a
|
||||
* reason and the data pointer passed here.
|
||||
* @param data Opaque context data passed to the maintenance function.
|
||||
* @param write_fd An fd that is probed for writing. If it is ever unwritable
|
||||
* then the maintenance is invoked with reason
|
||||
* OC_REASON_UNWRITABLE.
|
||||
* @param p The pool to use for allocating memory.
|
||||
* @bug write_fd duplicates the proc->out stream, it's really redundant
|
||||
* and should be replaced in the APR 1.0 API with a bitflag of which
|
||||
* proc->in/out/err handles should be health checked.
|
||||
* @bug no platform currently tests the pipes health.
|
||||
*/
|
||||
APR_DECLARE(void) apr_proc_other_child_register(apr_proc_t *proc,
|
||||
void (*maintenance) (int reason,
|
||||
void *,
|
||||
int status),
|
||||
void *data, apr_file_t *write_fd,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Stop watching the specified other child.
|
||||
* @param data The data to pass to the maintenance function. This is
|
||||
* used to find the process to unregister.
|
||||
* @warning Since this can be called by a maintenance function while we're
|
||||
* scanning the other_children list, all scanners should protect
|
||||
* themself by loading ocr->next before calling any maintenance
|
||||
* function.
|
||||
*/
|
||||
APR_DECLARE(void) apr_proc_other_child_unregister(void *data);
|
||||
|
||||
/**
|
||||
* Notify the maintenance callback of a registered other child process
|
||||
* that application has detected an event, such as death.
|
||||
* @param proc The process to check
|
||||
* @param reason The reason code to pass to the maintenance function
|
||||
* @param status The status to pass to the maintenance function
|
||||
* @remark An example of code using this behavior;
|
||||
* <pre>
|
||||
* rv = apr_proc_wait_all_procs(&proc, &exitcode, &status, APR_WAIT, p);
|
||||
* if (APR_STATUS_IS_CHILD_DONE(rv)) {
|
||||
* \#if APR_HAS_OTHER_CHILD
|
||||
* if (apr_proc_other_child_alert(&proc, APR_OC_REASON_DEATH, status)
|
||||
* == APR_SUCCESS) {
|
||||
* ; (already handled)
|
||||
* }
|
||||
* else
|
||||
* \#endif
|
||||
* [... handling non-otherchild processes death ...]
|
||||
* </pre>
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_other_child_alert(apr_proc_t *proc,
|
||||
int reason,
|
||||
int status);
|
||||
|
||||
/**
|
||||
* Test one specific other child processes and invoke the maintenance callback
|
||||
* with the appropriate reason code, if still running, or the appropriate reason
|
||||
* code if the process is no longer healthy.
|
||||
* @param ocr The registered other child
|
||||
* @param reason The reason code (e.g. APR_OC_REASON_RESTART) if still running
|
||||
*/
|
||||
APR_DECLARE(void) apr_proc_other_child_refresh(apr_other_child_rec_t *ocr,
|
||||
int reason);
|
||||
|
||||
/**
|
||||
* Test all registered other child processes and invoke the maintenance callback
|
||||
* with the appropriate reason code, if still running, or the appropriate reason
|
||||
* code if the process is no longer healthy.
|
||||
* @param reason The reason code (e.g. APR_OC_REASON_RESTART) to running processes
|
||||
*/
|
||||
APR_DECLARE(void) apr_proc_other_child_refresh_all(int reason);
|
||||
|
||||
/**
|
||||
* Terminate a process.
|
||||
* @param proc The process to terminate.
|
||||
* @param sig How to kill the process.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_proc_kill(apr_proc_t *proc, int sig);
|
||||
|
||||
/**
|
||||
* Register a process to be killed when a pool dies.
|
||||
* @param a The pool to use to define the processes lifetime
|
||||
* @param proc The process to register
|
||||
* @param how How to kill the process, one of:
|
||||
* <PRE>
|
||||
* APR_KILL_NEVER -- process is never sent any signals
|
||||
* APR_KILL_ALWAYS -- process is sent SIGKILL on apr_pool_t cleanup
|
||||
* APR_KILL_AFTER_TIMEOUT -- SIGTERM, wait 3 seconds, SIGKILL
|
||||
* APR_JUST_WAIT -- wait forever for the process to complete
|
||||
* APR_KILL_ONLY_ONCE -- send SIGTERM and then wait
|
||||
* </PRE>
|
||||
*/
|
||||
APR_DECLARE(void) apr_pool_note_subprocess(apr_pool_t *a, apr_proc_t *proc,
|
||||
apr_kill_conditions_e how);
|
||||
|
||||
#if APR_HAS_THREADS
|
||||
|
||||
#if (APR_HAVE_SIGWAIT || APR_HAVE_SIGSUSPEND) && !defined(OS2)
|
||||
|
||||
/**
|
||||
* Setup the process for a single thread to be used for all signal handling.
|
||||
* @warning This must be called before any threads are created
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_setup_signal_thread(void);
|
||||
|
||||
/**
|
||||
* Make the current thread listen for signals. This thread will loop
|
||||
* forever, calling a provided function whenever it receives a signal. That
|
||||
* functions should return 1 if the signal has been handled, 0 otherwise.
|
||||
* @param signal_handler The function to call when a signal is received
|
||||
* apr_status_t apr_signal_thread((int)(*signal_handler)(int signum))
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_signal_thread(int(*signal_handler)(int signum));
|
||||
|
||||
#endif /* (APR_HAVE_SIGWAIT || APR_HAVE_SIGSUSPEND) && !defined(OS2) */
|
||||
|
||||
/**
|
||||
* Get the child-pool used by the thread from the thread info.
|
||||
* @return apr_pool_t the pool
|
||||
*/
|
||||
APR_POOL_DECLARE_ACCESSOR(thread);
|
||||
|
||||
#endif /* APR_HAS_THREADS */
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_THREAD_PROC_H */
|
||||
|
129
include/apr_thread_rwlock.h
Normal file
129
include/apr_thread_rwlock.h
Normal file
@ -0,0 +1,129 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_THREAD_RWLOCK_H
|
||||
#define APR_THREAD_RWLOCK_H
|
||||
|
||||
/**
|
||||
* @file apr_thread_rwlock.h
|
||||
* @brief APR Reader/Writer Lock Routines
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#if APR_HAS_THREADS
|
||||
|
||||
/**
|
||||
* @defgroup apr_thread_rwlock Reader/Writer Lock Routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Opaque read-write thread-safe lock. */
|
||||
typedef struct apr_thread_rwlock_t apr_thread_rwlock_t;
|
||||
|
||||
/**
|
||||
* Note: The following operations have undefined results: unlocking a
|
||||
* read-write lock which is not locked in the calling thread; write
|
||||
* locking a read-write lock which is already locked by the calling
|
||||
* thread; destroying a read-write lock more than once; clearing or
|
||||
* destroying the pool from which a <b>locked</b> read-write lock is
|
||||
* allocated.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create and initialize a read-write lock that can be used to synchronize
|
||||
* threads.
|
||||
* @param rwlock the memory address where the newly created readwrite lock
|
||||
* will be stored.
|
||||
* @param pool the pool from which to allocate the mutex.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_rwlock_create(apr_thread_rwlock_t **rwlock,
|
||||
apr_pool_t *pool);
|
||||
/**
|
||||
* Acquire a shared-read lock on the given read-write lock. This will allow
|
||||
* multiple threads to enter the same critical section while they have acquired
|
||||
* the read lock.
|
||||
* @param rwlock the read-write lock on which to acquire the shared read.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_rwlock_rdlock(apr_thread_rwlock_t *rwlock);
|
||||
|
||||
/**
|
||||
* Attempt to acquire the shared-read lock on the given read-write lock. This
|
||||
* is the same as apr_thread_rwlock_rdlock(), only that the function fails
|
||||
* if there is another thread holding the write lock, or if there are any
|
||||
* write threads blocking on the lock. If the function fails for this case,
|
||||
* APR_EBUSY will be returned. Note: it is important that the
|
||||
* APR_STATUS_IS_EBUSY(s) macro be used to determine if the return value was
|
||||
* APR_EBUSY, for portability reasons.
|
||||
* @param rwlock the rwlock on which to attempt the shared read.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_rwlock_tryrdlock(apr_thread_rwlock_t *rwlock);
|
||||
|
||||
/**
|
||||
* Acquire an exclusive-write lock on the given read-write lock. This will
|
||||
* allow only one single thread to enter the critical sections. If there
|
||||
* are any threads currently holding the read-lock, this thread is put to
|
||||
* sleep until it can have exclusive access to the lock.
|
||||
* @param rwlock the read-write lock on which to acquire the exclusive write.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_rwlock_wrlock(apr_thread_rwlock_t *rwlock);
|
||||
|
||||
/**
|
||||
* Attempt to acquire the exclusive-write lock on the given read-write lock.
|
||||
* This is the same as apr_thread_rwlock_wrlock(), only that the function fails
|
||||
* if there is any other thread holding the lock (for reading or writing),
|
||||
* in which case the function will return APR_EBUSY. Note: it is important
|
||||
* that the APR_STATUS_IS_EBUSY(s) macro be used to determine if the return
|
||||
* value was APR_EBUSY, for portability reasons.
|
||||
* @param rwlock the rwlock on which to attempt the exclusive write.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_rwlock_trywrlock(apr_thread_rwlock_t *rwlock);
|
||||
|
||||
/**
|
||||
* Release either the read or write lock currently held by the calling thread
|
||||
* associated with the given read-write lock.
|
||||
* @param rwlock the read-write lock to be released (unlocked).
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_rwlock_unlock(apr_thread_rwlock_t *rwlock);
|
||||
|
||||
/**
|
||||
* Destroy the read-write lock and free the associated memory.
|
||||
* @param rwlock the rwlock to destroy.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_thread_rwlock_destroy(apr_thread_rwlock_t *rwlock);
|
||||
|
||||
/**
|
||||
* Get the pool used by this thread_rwlock.
|
||||
* @return apr_pool_t the pool
|
||||
*/
|
||||
APR_POOL_DECLARE_ACCESSOR(thread_rwlock);
|
||||
|
||||
#endif /* APR_HAS_THREADS */
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_THREAD_RWLOCK_H */
|
235
include/apr_time.h
Normal file
235
include/apr_time.h
Normal file
@ -0,0 +1,235 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_TIME_H
|
||||
#define APR_TIME_H
|
||||
|
||||
/**
|
||||
* @file apr_time.h
|
||||
* @brief APR Time Library
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_errno.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_time Time Routines
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** month names */
|
||||
APR_DECLARE_DATA extern const char apr_month_snames[12][4];
|
||||
/** day names */
|
||||
APR_DECLARE_DATA extern const char apr_day_snames[7][4];
|
||||
|
||||
|
||||
/** number of microseconds since 00:00:00 january 1, 1970 UTC */
|
||||
typedef apr_int64_t apr_time_t;
|
||||
|
||||
|
||||
/** mechanism to properly type apr_time_t literals */
|
||||
#define APR_TIME_C(val) APR_INT64_C(val)
|
||||
|
||||
/** mechanism to properly print apr_time_t values */
|
||||
#define APR_TIME_T_FMT APR_INT64_T_FMT
|
||||
|
||||
/** intervals for I/O timeouts, in microseconds */
|
||||
typedef apr_int64_t apr_interval_time_t;
|
||||
/** short interval for I/O timeouts, in microseconds */
|
||||
typedef apr_int32_t apr_short_interval_time_t;
|
||||
|
||||
/** number of microseconds per second */
|
||||
#define APR_USEC_PER_SEC APR_TIME_C(1000000)
|
||||
|
||||
/** @return apr_time_t as a second */
|
||||
#define apr_time_sec(time) ((time) / APR_USEC_PER_SEC)
|
||||
|
||||
/** @return apr_time_t as a usec */
|
||||
#define apr_time_usec(time) ((time) % APR_USEC_PER_SEC)
|
||||
|
||||
/** @return apr_time_t as a msec */
|
||||
#define apr_time_msec(time) (((time) / 1000) % 1000)
|
||||
|
||||
/** @return apr_time_t as a msec */
|
||||
#define apr_time_as_msec(time) ((time) / 1000)
|
||||
|
||||
/** @return milliseconds as an apr_time_t */
|
||||
#define apr_time_from_msec(msec) ((apr_time_t)(msec) * 1000)
|
||||
|
||||
/** @return seconds as an apr_time_t */
|
||||
#define apr_time_from_sec(sec) ((apr_time_t)(sec) * APR_USEC_PER_SEC)
|
||||
|
||||
/** @return a second and usec combination as an apr_time_t */
|
||||
#define apr_time_make(sec, usec) ((apr_time_t)(sec) * APR_USEC_PER_SEC \
|
||||
+ (apr_time_t)(usec))
|
||||
|
||||
/**
|
||||
* @return the current time
|
||||
*/
|
||||
APR_DECLARE(apr_time_t) apr_time_now(void);
|
||||
|
||||
/** @see apr_time_exp_t */
|
||||
typedef struct apr_time_exp_t apr_time_exp_t;
|
||||
|
||||
/**
|
||||
* a structure similar to ANSI struct tm with the following differences:
|
||||
* - tm_usec isn't an ANSI field
|
||||
* - tm_gmtoff isn't an ANSI field (it's a bsdism)
|
||||
*/
|
||||
struct apr_time_exp_t {
|
||||
/** microseconds past tm_sec */
|
||||
apr_int32_t tm_usec;
|
||||
/** (0-61) seconds past tm_min */
|
||||
apr_int32_t tm_sec;
|
||||
/** (0-59) minutes past tm_hour */
|
||||
apr_int32_t tm_min;
|
||||
/** (0-23) hours past midnight */
|
||||
apr_int32_t tm_hour;
|
||||
/** (1-31) day of the month */
|
||||
apr_int32_t tm_mday;
|
||||
/** (0-11) month of the year */
|
||||
apr_int32_t tm_mon;
|
||||
/** year since 1900 */
|
||||
apr_int32_t tm_year;
|
||||
/** (0-6) days since sunday */
|
||||
apr_int32_t tm_wday;
|
||||
/** (0-365) days since jan 1 */
|
||||
apr_int32_t tm_yday;
|
||||
/** daylight saving time */
|
||||
apr_int32_t tm_isdst;
|
||||
/** seconds east of UTC */
|
||||
apr_int32_t tm_gmtoff;
|
||||
};
|
||||
|
||||
/**
|
||||
* convert an ansi time_t to an apr_time_t
|
||||
* @param result the resulting apr_time_t
|
||||
* @param input the time_t to convert
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_time_ansi_put(apr_time_t *result,
|
||||
time_t input);
|
||||
|
||||
/**
|
||||
* convert a time to its human readable components using an offset
|
||||
* from GMT
|
||||
* @param result the exploded time
|
||||
* @param input the time to explode
|
||||
* @param offs the number of seconds offset to apply
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_time_exp_tz(apr_time_exp_t *result,
|
||||
apr_time_t input,
|
||||
apr_int32_t offs);
|
||||
|
||||
/**
|
||||
* convert a time to its human readable components in GMT timezone
|
||||
* @param result the exploded time
|
||||
* @param input the time to explode
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_time_exp_gmt(apr_time_exp_t *result,
|
||||
apr_time_t input);
|
||||
|
||||
/**
|
||||
* convert a time to its human readable components in local timezone
|
||||
* @param result the exploded time
|
||||
* @param input the time to explode
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_time_exp_lt(apr_time_exp_t *result,
|
||||
apr_time_t input);
|
||||
|
||||
/**
|
||||
* Convert time value from human readable format to a numeric apr_time_t
|
||||
* e.g. elapsed usec since epoch
|
||||
* @param result the resulting imploded time
|
||||
* @param input the input exploded time
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_time_exp_get(apr_time_t *result,
|
||||
apr_time_exp_t *input);
|
||||
|
||||
/**
|
||||
* Convert time value from human readable format to a numeric apr_time_t that
|
||||
* always represents GMT
|
||||
* @param result the resulting imploded time
|
||||
* @param input the input exploded time
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_time_exp_gmt_get(apr_time_t *result,
|
||||
apr_time_exp_t *input);
|
||||
|
||||
/**
|
||||
* Sleep for the specified number of micro-seconds.
|
||||
* @param t desired amount of time to sleep.
|
||||
* @warning May sleep for longer than the specified time.
|
||||
*/
|
||||
APR_DECLARE(void) apr_sleep(apr_interval_time_t t);
|
||||
|
||||
/** length of a RFC822 Date */
|
||||
#define APR_RFC822_DATE_LEN (30)
|
||||
/**
|
||||
* apr_rfc822_date formats dates in the RFC822
|
||||
* format in an efficient manner. It is a fixed length
|
||||
* format which requires the indicated amount of storage,
|
||||
* including the trailing NUL terminator.
|
||||
* @param date_str String to write to.
|
||||
* @param t the time to convert
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_rfc822_date(char *date_str, apr_time_t t);
|
||||
|
||||
/** length of a CTIME date */
|
||||
#define APR_CTIME_LEN (25)
|
||||
/**
|
||||
* apr_ctime formats dates in the ctime() format
|
||||
* in an efficient manner. it is a fixed length format
|
||||
* and requires the indicated amount of storage including
|
||||
* the trailing NUL terminator.
|
||||
* Unlike ANSI/ISO C ctime(), apr_ctime() does not include
|
||||
* a \n at the end of the string.
|
||||
* @param date_str String to write to.
|
||||
* @param t the time to convert
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_ctime(char *date_str, apr_time_t t);
|
||||
|
||||
/**
|
||||
* formats the exploded time according to the format specified
|
||||
* @param s string to write to
|
||||
* @param retsize The length of the returned string
|
||||
* @param max The maximum length of the string
|
||||
* @param format The format for the time string
|
||||
* @param tm The time to convert
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_strftime(char *s, apr_size_t *retsize,
|
||||
apr_size_t max, const char *format,
|
||||
apr_time_exp_t *tm);
|
||||
|
||||
/**
|
||||
* Improve the clock resolution for the lifetime of the given pool.
|
||||
* Generally this is only desireable on benchmarking and other very
|
||||
* time-sensitive applications, and has no impact on most platforms.
|
||||
* @param p The pool to associate the finer clock resolution
|
||||
*/
|
||||
APR_DECLARE(void) apr_time_clock_hires(apr_pool_t *p);
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_TIME_H */
|
158
include/apr_user.h
Normal file
158
include/apr_user.h
Normal file
@ -0,0 +1,158 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_USER_H
|
||||
#define APR_USER_H
|
||||
|
||||
/**
|
||||
* @file apr_user.h
|
||||
* @brief APR User ID Services
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_pools.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/**
|
||||
* @defgroup apr_user User and Group ID Services
|
||||
* @ingroup APR
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Structure for determining user ownership.
|
||||
*/
|
||||
#ifdef WIN32
|
||||
typedef PSID apr_uid_t;
|
||||
#else
|
||||
typedef uid_t apr_uid_t;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Structure for determining group ownership.
|
||||
*/
|
||||
#ifdef WIN32
|
||||
typedef PSID apr_gid_t;
|
||||
#else
|
||||
typedef gid_t apr_gid_t;
|
||||
#endif
|
||||
|
||||
#if APR_HAS_USER
|
||||
|
||||
/**
|
||||
* Get the userid (and groupid) of the calling process
|
||||
* @param userid Returns the user id
|
||||
* @param groupid Returns the user's group id
|
||||
* @param p The pool from which to allocate working space
|
||||
* @remark This function is available only if APR_HAS_USER is defined.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_uid_current(apr_uid_t *userid,
|
||||
apr_gid_t *groupid,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Get the user name for a specified userid
|
||||
* @param username Pointer to new string containing user name (on output)
|
||||
* @param userid The userid
|
||||
* @param p The pool from which to allocate the string
|
||||
* @remark This function is available only if APR_HAS_USER is defined.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_uid_name_get(char **username, apr_uid_t userid,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Get the userid (and groupid) for the specified username
|
||||
* @param userid Returns the user id
|
||||
* @param groupid Returns the user's group id
|
||||
* @param username The username to lookup
|
||||
* @param p The pool from which to allocate working space
|
||||
* @remark This function is available only if APR_HAS_USER is defined.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_uid_get(apr_uid_t *userid, apr_gid_t *groupid,
|
||||
const char *username, apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Get the home directory for the named user
|
||||
* @param dirname Pointer to new string containing directory name (on output)
|
||||
* @param username The named user
|
||||
* @param p The pool from which to allocate the string
|
||||
* @remark This function is available only if APR_HAS_USER is defined.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_uid_homepath_get(char **dirname,
|
||||
const char *username,
|
||||
apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Compare two user identifiers for equality.
|
||||
* @param left One uid to test
|
||||
* @param right Another uid to test
|
||||
* @return APR_SUCCESS if the apr_uid_t strutures identify the same user,
|
||||
* APR_EMISMATCH if not, APR_BADARG if an apr_uid_t is invalid.
|
||||
* @remark This function is available only if APR_HAS_USER is defined.
|
||||
*/
|
||||
#if defined(WIN32)
|
||||
APR_DECLARE(apr_status_t) apr_uid_compare(apr_uid_t left, apr_uid_t right);
|
||||
#else
|
||||
#define apr_uid_compare(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Get the group name for a specified groupid
|
||||
* @param groupname Pointer to new string containing group name (on output)
|
||||
* @param groupid The groupid
|
||||
* @param p The pool from which to allocate the string
|
||||
* @remark This function is available only if APR_HAS_USER is defined.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_gid_name_get(char **groupname,
|
||||
apr_gid_t groupid, apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Get the groupid for a specified group name
|
||||
* @param groupid Pointer to the group id (on output)
|
||||
* @param groupname The group name to look up
|
||||
* @param p The pool from which to allocate the string
|
||||
* @remark This function is available only if APR_HAS_USER is defined.
|
||||
*/
|
||||
APR_DECLARE(apr_status_t) apr_gid_get(apr_gid_t *groupid,
|
||||
const char *groupname, apr_pool_t *p);
|
||||
|
||||
/**
|
||||
* Compare two group identifiers for equality.
|
||||
* @param left One gid to test
|
||||
* @param right Another gid to test
|
||||
* @return APR_SUCCESS if the apr_gid_t strutures identify the same group,
|
||||
* APR_EMISMATCH if not, APR_BADARG if an apr_gid_t is invalid.
|
||||
* @remark This function is available only if APR_HAS_USER is defined.
|
||||
*/
|
||||
#if defined(WIN32)
|
||||
APR_DECLARE(apr_status_t) apr_gid_compare(apr_gid_t left, apr_gid_t right);
|
||||
#else
|
||||
#define apr_gid_compare(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH)
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_HAS_USER */
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! APR_USER_H */
|
159
include/apr_version.h
Normal file
159
include/apr_version.h
Normal file
@ -0,0 +1,159 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_VERSION_H
|
||||
#define APR_VERSION_H
|
||||
|
||||
/**
|
||||
* @file apr_version.h
|
||||
* @brief APR Versioning Interface
|
||||
*
|
||||
* APR's Version
|
||||
*
|
||||
* There are several different mechanisms for accessing the version. There
|
||||
* is a string form, and a set of numbers; in addition, there are constants
|
||||
* which can be compiled into your application, and you can query the library
|
||||
* being used for its actual version.
|
||||
*
|
||||
* Note that it is possible for an application to detect that it has been
|
||||
* compiled against a different version of APR by use of the compile-time
|
||||
* constants and the use of the run-time query function.
|
||||
*
|
||||
* APR version numbering follows the guidelines specified in:
|
||||
*
|
||||
* http://apr.apache.org/versioning.html
|
||||
*/
|
||||
|
||||
|
||||
/* The numeric compile-time version constants. These constants are the
|
||||
* authoritative version numbers for APR.
|
||||
*/
|
||||
|
||||
/** major version
|
||||
* Major API changes that could cause compatibility problems for older
|
||||
* programs such as structure size changes. No binary compatibility is
|
||||
* possible across a change in the major version.
|
||||
*/
|
||||
#define APR_MAJOR_VERSION 1
|
||||
|
||||
/** minor version
|
||||
* Minor API changes that do not cause binary compatibility problems.
|
||||
* Reset to 0 when upgrading APR_MAJOR_VERSION
|
||||
*/
|
||||
#define APR_MINOR_VERSION 4
|
||||
|
||||
/** patch level
|
||||
* The Patch Level never includes API changes, simply bug fixes.
|
||||
* Reset to 0 when upgrading APR_MINOR_VERSION
|
||||
*/
|
||||
#define APR_PATCH_VERSION 6
|
||||
|
||||
/**
|
||||
* The symbol APR_IS_DEV_VERSION is only defined for internal,
|
||||
* "development" copies of APR. It is undefined for released versions
|
||||
* of APR.
|
||||
*/
|
||||
/* #define APR_IS_DEV_VERSION */
|
||||
|
||||
/**
|
||||
* Check at compile time if the APR version is at least a certain
|
||||
* level.
|
||||
* @param major The major version component of the version checked
|
||||
* for (e.g., the "1" of "1.3.0").
|
||||
* @param minor The minor version component of the version checked
|
||||
* for (e.g., the "3" of "1.3.0").
|
||||
* @param patch The patch level component of the version checked
|
||||
* for (e.g., the "0" of "1.3.0").
|
||||
* @remark This macro is available with APR versions starting with
|
||||
* 1.3.0.
|
||||
*/
|
||||
#define APR_VERSION_AT_LEAST(major,minor,patch) \
|
||||
(((major) < APR_MAJOR_VERSION) \
|
||||
|| ((major) == APR_MAJOR_VERSION && (minor) < APR_MINOR_VERSION) \
|
||||
|| ((major) == APR_MAJOR_VERSION && (minor) == APR_MINOR_VERSION && (patch) <= APR_PATCH_VERSION))
|
||||
|
||||
#if defined(APR_IS_DEV_VERSION) || defined(DOXYGEN)
|
||||
/** Internal: string form of the "is dev" flag */
|
||||
#define APR_IS_DEV_STRING "-dev"
|
||||
#else
|
||||
#define APR_IS_DEV_STRING ""
|
||||
#endif
|
||||
|
||||
/* APR_STRINGIFY is defined here, and also in apr_general.h, so wrap it */
|
||||
#ifndef APR_STRINGIFY
|
||||
/** Properly quote a value as a string in the C preprocessor */
|
||||
#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
|
||||
/** Helper macro for APR_STRINGIFY */
|
||||
#define APR_STRINGIFY_HELPER(n) #n
|
||||
#endif
|
||||
|
||||
/** The formatted string of APR's version */
|
||||
#define APR_VERSION_STRING \
|
||||
APR_STRINGIFY(APR_MAJOR_VERSION) "." \
|
||||
APR_STRINGIFY(APR_MINOR_VERSION) "." \
|
||||
APR_STRINGIFY(APR_PATCH_VERSION) \
|
||||
APR_IS_DEV_STRING
|
||||
|
||||
/** An alternative formatted string of APR's version */
|
||||
/* macro for Win32 .rc files using numeric csv representation */
|
||||
#define APR_VERSION_STRING_CSV APR_MAJOR_VERSION ##, \
|
||||
##APR_MINOR_VERSION ##, \
|
||||
##APR_PATCH_VERSION
|
||||
|
||||
|
||||
#ifndef APR_VERSION_ONLY
|
||||
|
||||
/* The C language API to access the version at run time,
|
||||
* as opposed to compile time. APR_VERSION_ONLY may be defined
|
||||
* externally when preprocessing apr_version.h to obtain strictly
|
||||
* the C Preprocessor macro declarations.
|
||||
*/
|
||||
|
||||
#include "apr.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The numeric version information is broken out into fields within this
|
||||
* structure.
|
||||
*/
|
||||
typedef struct {
|
||||
int major; /**< major number */
|
||||
int minor; /**< minor number */
|
||||
int patch; /**< patch number */
|
||||
int is_dev; /**< is development (1 or 0) */
|
||||
} apr_version_t;
|
||||
|
||||
/**
|
||||
* Return APR's version information information in a numeric form.
|
||||
*
|
||||
* @param pvsn Pointer to a version structure for returning the version
|
||||
* information.
|
||||
*/
|
||||
APR_DECLARE(void) apr_version(apr_version_t *pvsn);
|
||||
|
||||
/** Return APR's version information as a string. */
|
||||
APR_DECLARE(const char *) apr_version_string(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ndef APR_VERSION_ONLY */
|
||||
|
||||
#endif /* ndef APR_VERSION_H */
|
124
include/apr_want.h
Normal file
124
include/apr_want.h
Normal file
@ -0,0 +1,124 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "apr.h" /* configuration data */
|
||||
/**
|
||||
* @file apr_want.h
|
||||
* @brief APR Standard Headers Support
|
||||
*
|
||||
* <PRE>
|
||||
* Features:
|
||||
*
|
||||
* APR_WANT_STRFUNC: strcmp, strcat, strcpy, etc
|
||||
* APR_WANT_MEMFUNC: memcmp, memcpy, etc
|
||||
* APR_WANT_STDIO: <stdio.h> and related bits
|
||||
* APR_WANT_IOVEC: struct iovec
|
||||
* APR_WANT_BYTEFUNC: htons, htonl, ntohl, ntohs
|
||||
*
|
||||
* Typical usage:
|
||||
*
|
||||
* \#define APR_WANT_STRFUNC
|
||||
* \#define APR_WANT_MEMFUNC
|
||||
* \#include "apr_want.h"
|
||||
*
|
||||
* The appropriate headers will be included.
|
||||
*
|
||||
* Note: it is safe to use this in a header (it won't interfere with other
|
||||
* headers' or source files' use of apr_want.h)
|
||||
* </PRE>
|
||||
*/
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
#ifdef APR_WANT_STRFUNC
|
||||
|
||||
#if APR_HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#if APR_HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#undef APR_WANT_STRFUNC
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
#ifdef APR_WANT_MEMFUNC
|
||||
|
||||
#if APR_HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#undef APR_WANT_MEMFUNC
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
#ifdef APR_WANT_STDIO
|
||||
|
||||
#if APR_HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#undef APR_WANT_STDIO
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
#ifdef APR_WANT_IOVEC
|
||||
|
||||
#if APR_HAVE_IOVEC
|
||||
|
||||
#if APR_HAVE_SYS_UIO_H
|
||||
#include <sys/uio.h>
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
#ifndef APR_IOVEC_DEFINED
|
||||
#define APR_IOVEC_DEFINED
|
||||
struct iovec
|
||||
{
|
||||
void *iov_base;
|
||||
size_t iov_len;
|
||||
};
|
||||
#endif /* !APR_IOVEC_DEFINED */
|
||||
|
||||
#endif /* APR_HAVE_IOVEC */
|
||||
|
||||
#undef APR_WANT_IOVEC
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
#ifdef APR_WANT_BYTEFUNC
|
||||
|
||||
/* Single Unix says they are in arpa/inet.h. Linux has them in
|
||||
* netinet/in.h. FreeBSD has them in arpa/inet.h but requires that
|
||||
* netinet/in.h be included first.
|
||||
*/
|
||||
#if APR_HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#if APR_HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#undef APR_WANT_BYTEFUNC
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
41
include/arch/apr_private_common.h
Normal file
41
include/arch/apr_private_common.h
Normal file
@ -0,0 +1,41 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file contains private declarations common to all architectures.
|
||||
*/
|
||||
|
||||
#ifndef APR_PRIVATE_COMMON_H
|
||||
#define APR_PRIVATE_COMMON_H
|
||||
|
||||
#include "apr_pools.h"
|
||||
#include "apr_tables.h"
|
||||
|
||||
apr_status_t apr_filepath_list_split_impl(apr_array_header_t **pathelts,
|
||||
const char *liststr,
|
||||
char separator,
|
||||
apr_pool_t *p);
|
||||
|
||||
apr_status_t apr_filepath_list_merge_impl(char **liststr,
|
||||
apr_array_header_t *pathelts,
|
||||
char separator,
|
||||
apr_pool_t *p);
|
||||
|
||||
/* temporary defines to handle 64bit compile mismatches */
|
||||
#define APR_INT_TRUNC_CAST int
|
||||
#define APR_UINT32_TRUNC_CAST apr_uint32_t
|
||||
|
||||
#endif /*APR_PRIVATE_COMMON_H*/
|
45
include/arch/unix/apr_arch_atomic.h
Normal file
45
include/arch/unix/apr_arch_atomic.h
Normal file
@ -0,0 +1,45 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ATOMIC_H
|
||||
#define ATOMIC_H
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_private.h"
|
||||
#include "apr_atomic.h"
|
||||
#include "apr_thread_mutex.h"
|
||||
|
||||
#if defined(USE_ATOMICS_GENERIC)
|
||||
/* noop */
|
||||
#elif defined(__GNUC__) && defined(__STRICT_ANSI__)
|
||||
/* force use of generic atomics if building e.g. with -std=c89, which
|
||||
* doesn't allow inline asm */
|
||||
# define USE_ATOMICS_GENERIC
|
||||
#elif HAVE_ATOMIC_BUILTINS
|
||||
# define USE_ATOMICS_BUILTINS
|
||||
#elif defined(SOLARIS2) && SOLARIS2 >= 10
|
||||
# define USE_ATOMICS_SOLARIS
|
||||
#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
|
||||
# define USE_ATOMICS_IA32
|
||||
#elif defined(__GNUC__) && (defined(__PPC__) || defined(__ppc__))
|
||||
# define USE_ATOMICS_PPC
|
||||
#elif defined(__GNUC__) && (defined(__s390__) || defined(__s390x__))
|
||||
# define USE_ATOMICS_S390
|
||||
#else
|
||||
# define USE_ATOMICS_GENERIC
|
||||
#endif
|
||||
|
||||
#endif /* ATOMIC_H */
|
63
include/arch/unix/apr_arch_dso.h
Normal file
63
include/arch/unix/apr_arch_dso.h
Normal file
@ -0,0 +1,63 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef DSO_H
|
||||
#define DSO_H
|
||||
|
||||
#include "apr_private.h"
|
||||
#include "apr_general.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_dso.h"
|
||||
#include "apr.h"
|
||||
|
||||
#if APR_HAS_DSO
|
||||
|
||||
#ifdef HAVE_MACH_O_DYLD_H
|
||||
#include <mach-o/dyld.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DLFCN_H
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DL_H
|
||||
#include <dl.h>
|
||||
#endif
|
||||
|
||||
#ifndef RTLD_NOW
|
||||
#define RTLD_NOW 1
|
||||
#endif
|
||||
|
||||
#ifndef RTLD_GLOBAL
|
||||
#define RTLD_GLOBAL 0
|
||||
#endif
|
||||
|
||||
#if (defined(__DragonFly__) ||\
|
||||
defined(__FreeBSD__) ||\
|
||||
defined(__OpenBSD__) ||\
|
||||
defined(__NetBSD__) ) && !defined(__ELF__)
|
||||
#define DLSYM_NEEDS_UNDERSCORE
|
||||
#endif
|
||||
|
||||
struct apr_dso_handle_t {
|
||||
apr_pool_t *pool;
|
||||
void *handle;
|
||||
const char *errormsg;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
174
include/arch/unix/apr_arch_file_io.h
Normal file
174
include/arch/unix/apr_arch_file_io.h
Normal file
@ -0,0 +1,174 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FILE_IO_H
|
||||
#define FILE_IO_H
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_private.h"
|
||||
#include "apr_general.h"
|
||||
#include "apr_tables.h"
|
||||
#include "apr_file_io.h"
|
||||
#include "apr_file_info.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_lib.h"
|
||||
#include "apr_thread_mutex.h"
|
||||
#ifndef WAITIO_USES_POLL
|
||||
#include "apr_poll.h"
|
||||
#endif
|
||||
|
||||
/* System headers the file I/O library needs */
|
||||
#if APR_HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#if APR_HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#if APR_HAVE_ERRNO_H
|
||||
#include <errno.h>
|
||||
#endif
|
||||
#if APR_HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#if APR_HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#if APR_HAVE_DIRENT_H
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
#if APR_HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#if APR_HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#if APR_HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#if APR_HAVE_SYS_UIO_H
|
||||
#include <sys/uio.h>
|
||||
#endif
|
||||
#if APR_HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#ifdef BEOS
|
||||
#include <kernel/OS.h>
|
||||
#endif
|
||||
/* Hunting down DEV_BSIZE if not from dirent.h, sys/stat.h etc */
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#if BEOS_BONE
|
||||
# ifndef BONE7
|
||||
/* prior to BONE/7 fd_set & select were defined in sys/socket.h */
|
||||
# include <sys/socket.h>
|
||||
# else
|
||||
/* Be moved the fd_set stuff and also the FIONBIO definition... */
|
||||
# include <sys/ioctl.h>
|
||||
# endif
|
||||
#endif
|
||||
/* End System headers */
|
||||
|
||||
#define APR_FILE_DEFAULT_BUFSIZE 4096
|
||||
/* For backwards-compat */
|
||||
#define APR_FILE_BUFSIZE APR_FILE_DEFAULT_BUFSIZE
|
||||
|
||||
struct apr_file_t {
|
||||
apr_pool_t *pool;
|
||||
int filedes;
|
||||
char *fname;
|
||||
apr_int32_t flags;
|
||||
int eof_hit;
|
||||
int is_pipe;
|
||||
apr_interval_time_t timeout;
|
||||
int buffered;
|
||||
enum {BLK_UNKNOWN, BLK_OFF, BLK_ON } blocking;
|
||||
int ungetchar; /* Last char provided by an unget op. (-1 = no char)*/
|
||||
#ifndef WAITIO_USES_POLL
|
||||
/* if there is a timeout set, then this pollset is used */
|
||||
apr_pollset_t *pollset;
|
||||
#endif
|
||||
/* Stuff for buffered mode */
|
||||
char *buffer;
|
||||
apr_size_t bufpos; /* Read/Write position in buffer */
|
||||
apr_size_t bufsize; /* The size of the buffer */
|
||||
unsigned long dataRead; /* amount of valid data read into buffer */
|
||||
int direction; /* buffer being used for 0 = read, 1 = write */
|
||||
apr_off_t filePtr; /* position in file of handle */
|
||||
#if APR_HAS_THREADS
|
||||
struct apr_thread_mutex_t *thlock;
|
||||
#endif
|
||||
};
|
||||
|
||||
#if APR_HAS_THREADS
|
||||
#define file_lock(f) do { \
|
||||
if ((f)->thlock) \
|
||||
apr_thread_mutex_lock((f)->thlock); \
|
||||
} while (0)
|
||||
#define file_unlock(f) do { \
|
||||
if ((f)->thlock) \
|
||||
apr_thread_mutex_unlock((f)->thlock); \
|
||||
} while (0)
|
||||
#else
|
||||
#define file_lock(f) do {} while (0)
|
||||
#define file_unlock(f) do {} while (0)
|
||||
#endif
|
||||
|
||||
#if APR_HAS_LARGE_FILES && defined(_LARGEFILE64_SOURCE)
|
||||
#define stat(f,b) stat64(f,b)
|
||||
#define lstat(f,b) lstat64(f,b)
|
||||
#define fstat(f,b) fstat64(f,b)
|
||||
#define lseek(f,o,w) lseek64(f,o,w)
|
||||
#define ftruncate(f,l) ftruncate64(f,l)
|
||||
typedef struct stat64 struct_stat;
|
||||
#else
|
||||
typedef struct stat struct_stat;
|
||||
#endif
|
||||
|
||||
/* readdir64_r is only used in specific cases: */
|
||||
#if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS) \
|
||||
&& !defined(READDIR_IS_THREAD_SAFE) && defined(HAVE_READDIR64_R)
|
||||
#define APR_USE_READDIR64_R
|
||||
#endif
|
||||
|
||||
struct apr_dir_t {
|
||||
apr_pool_t *pool;
|
||||
char *dirname;
|
||||
DIR *dirstruct;
|
||||
#ifdef APR_USE_READDIR64_R
|
||||
struct dirent64 *entry;
|
||||
#else
|
||||
struct dirent *entry;
|
||||
#endif
|
||||
};
|
||||
|
||||
apr_status_t apr_unix_file_cleanup(void *);
|
||||
apr_status_t apr_unix_child_file_cleanup(void *);
|
||||
|
||||
mode_t apr_unix_perms2mode(apr_fileperms_t perms);
|
||||
apr_fileperms_t apr_unix_mode2perms(mode_t mode);
|
||||
|
||||
apr_status_t apr_file_flush_locked(apr_file_t *thefile);
|
||||
apr_status_t apr_file_info_get_locked(apr_finfo_t *finfo, apr_int32_t wanted,
|
||||
apr_file_t *thefile);
|
||||
|
||||
|
||||
#endif /* ! FILE_IO_H */
|
||||
|
37
include/arch/unix/apr_arch_global_mutex.h
Normal file
37
include/arch/unix/apr_arch_global_mutex.h
Normal file
@ -0,0 +1,37 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef GLOBAL_MUTEX_H
|
||||
#define GLOBAL_MUTEX_H
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_private.h"
|
||||
#include "apr_general.h"
|
||||
#include "apr_lib.h"
|
||||
#include "apr_global_mutex.h"
|
||||
#include "apr_arch_proc_mutex.h"
|
||||
#include "apr_arch_thread_mutex.h"
|
||||
|
||||
struct apr_global_mutex_t {
|
||||
apr_pool_t *pool;
|
||||
apr_proc_mutex_t *proc_mutex;
|
||||
#if APR_HAS_THREADS
|
||||
apr_thread_mutex_t *thread_mutex;
|
||||
#endif /* APR_HAS_THREADS */
|
||||
};
|
||||
|
||||
#endif /* GLOBAL_MUTEX_H */
|
||||
|
64
include/arch/unix/apr_arch_inherit.h
Normal file
64
include/arch/unix/apr_arch_inherit.h
Normal file
@ -0,0 +1,64 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef INHERIT_H
|
||||
#define INHERIT_H
|
||||
|
||||
#include "apr_inherit.h"
|
||||
|
||||
#define APR_INHERIT (1 << 24) /* Must not conflict with other bits */
|
||||
|
||||
#define APR_IMPLEMENT_INHERIT_SET(name, flag, pool, cleanup) \
|
||||
apr_status_t apr_##name##_inherit_set(apr_##name##_t *the##name) \
|
||||
{ \
|
||||
if (the##name->flag & APR_FOPEN_NOCLEANUP) \
|
||||
return APR_EINVAL; \
|
||||
if (!(the##name->flag & APR_INHERIT)) { \
|
||||
int flags = fcntl(the##name->name##des, F_GETFD); \
|
||||
if (flags == -1) \
|
||||
return errno; \
|
||||
flags &= ~(FD_CLOEXEC); \
|
||||
if (fcntl(the##name->name##des, F_SETFD, flags) == -1) \
|
||||
return errno; \
|
||||
the##name->flag |= APR_INHERIT; \
|
||||
apr_pool_child_cleanup_set(the##name->pool, \
|
||||
(void *)the##name, \
|
||||
cleanup, apr_pool_cleanup_null); \
|
||||
} \
|
||||
return APR_SUCCESS; \
|
||||
}
|
||||
|
||||
#define APR_IMPLEMENT_INHERIT_UNSET(name, flag, pool, cleanup) \
|
||||
apr_status_t apr_##name##_inherit_unset(apr_##name##_t *the##name) \
|
||||
{ \
|
||||
if (the##name->flag & APR_FOPEN_NOCLEANUP) \
|
||||
return APR_EINVAL; \
|
||||
if (the##name->flag & APR_INHERIT) { \
|
||||
int flags; \
|
||||
if ((flags = fcntl(the##name->name##des, F_GETFD)) == -1) \
|
||||
return errno; \
|
||||
flags |= FD_CLOEXEC; \
|
||||
if (fcntl(the##name->name##des, F_SETFD, flags) == -1) \
|
||||
return errno; \
|
||||
the##name->flag &= ~APR_INHERIT; \
|
||||
apr_pool_child_cleanup_set(the##name->pool, \
|
||||
(void *)the##name, \
|
||||
cleanup, cleanup); \
|
||||
} \
|
||||
return APR_SUCCESS; \
|
||||
}
|
||||
|
||||
#endif /* ! INHERIT_H */
|
24
include/arch/unix/apr_arch_internal_time.h
Normal file
24
include/arch/unix/apr_arch_internal_time.h
Normal file
@ -0,0 +1,24 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef TIME_INTERNAL_H
|
||||
#define TIME_INTERNAL_H
|
||||
|
||||
#include "apr.h"
|
||||
|
||||
void apr_unix_setup_time(void);
|
||||
|
||||
#endif /* TIME_INTERNAL_H */
|
67
include/arch/unix/apr_arch_misc.h
Normal file
67
include/arch/unix/apr_arch_misc.h
Normal file
@ -0,0 +1,67 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef MISC_H
|
||||
#define MISC_H
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_portable.h"
|
||||
#include "apr_private.h"
|
||||
#include "apr_general.h"
|
||||
#include "apr_pools.h"
|
||||
#include "apr_getopt.h"
|
||||
#include "apr_thread_proc.h"
|
||||
#include "apr_file_io.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_getopt.h"
|
||||
|
||||
#if APR_HAVE_STDIO_H
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#if APR_HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
#if APR_HAVE_PTHREAD_H
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#if APR_HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#if APR_HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#ifdef BEOS
|
||||
#include <kernel/OS.h>
|
||||
#endif
|
||||
|
||||
struct apr_other_child_rec_t {
|
||||
apr_pool_t *p;
|
||||
struct apr_other_child_rec_t *next;
|
||||
apr_proc_t *proc;
|
||||
void (*maintenance) (int, void *, int);
|
||||
void *data;
|
||||
apr_os_file_t write_fd;
|
||||
};
|
||||
|
||||
#if defined(WIN32) || defined(NETWARE)
|
||||
#define WSAHighByte 2
|
||||
#define WSALowByte 0
|
||||
#endif
|
||||
|
||||
#endif /* ! MISC_H */
|
||||
|
142
include/arch/unix/apr_arch_networkio.h
Normal file
142
include/arch/unix/apr_arch_networkio.h
Normal file
@ -0,0 +1,142 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef NETWORK_IO_H
|
||||
#define NETWORK_IO_H
|
||||
|
||||
#include "apr.h"
|
||||
#include "apr_private.h"
|
||||
#include "apr_network_io.h"
|
||||
#include "apr_errno.h"
|
||||
#include "apr_general.h"
|
||||
#include "apr_lib.h"
|
||||
#ifndef WAITIO_USES_POLL
|
||||
#include "apr_poll.h"
|
||||
#endif
|
||||
|
||||
/* System headers the network I/O library needs */
|
||||
#if APR_HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#if APR_HAVE_SYS_UIO_H
|
||||
#include <sys/uio.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#if APR_HAVE_ERRNO_H
|
||||
#include <errno.h>
|
||||
#endif
|
||||
#if APR_HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#if APR_HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#if APR_HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#if APR_HAVE_NETINET_TCP_H
|
||||
#include <netinet/tcp.h>
|
||||
#endif
|
||||
#if APR_HAVE_NETINET_SCTP_UIO_H
|
||||
#include <netinet/sctp_uio.h>
|
||||
#endif
|
||||
#if APR_HAVE_NETINET_SCTP_H
|
||||
#include <netinet/sctp.h>
|
||||
#endif
|
||||
#if APR_HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#if APR_HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#if APR_HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#if APR_HAVE_SYS_SOCKIO_H
|
||||
#include <sys/sockio.h>
|
||||
#endif
|
||||
#if APR_HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
#if APR_HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#if APR_HAVE_SYS_SENDFILE_H
|
||||
#include <sys/sendfile.h>
|
||||
#endif
|
||||
#if APR_HAVE_SYS_IOCTL_H
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
/* End System Headers */
|
||||
|
||||
#ifndef HAVE_POLLIN
|
||||
#define POLLIN 1
|
||||
#define POLLPRI 2
|
||||
#define POLLOUT 4
|
||||
#define POLLERR 8
|
||||
#define POLLHUP 16
|
||||
#define POLLNVAL 32
|
||||
#endif
|
||||
|
||||
typedef struct sock_userdata_t sock_userdata_t;
|
||||
struct sock_userdata_t {
|
||||
sock_userdata_t *next;
|
||||
const char *key;
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct apr_socket_t {
|
||||
apr_pool_t *pool;
|
||||
int socketdes;
|
||||
int type;
|
||||
int protocol;
|
||||
apr_sockaddr_t *local_addr;
|
||||
apr_sockaddr_t *remote_addr;
|
||||
apr_interval_time_t timeout;
|
||||
#ifndef HAVE_POLL
|
||||
int connected;
|
||||
#endif
|
||||
int local_port_unknown;
|
||||
int local_interface_unknown;
|
||||
int remote_addr_unknown;
|
||||
apr_int32_t options;
|
||||
apr_int32_t inherit;
|
||||
sock_userdata_t *userdata;
|
||||
#ifndef WAITIO_USES_POLL
|
||||
/* if there is a timeout set, then this pollset is used */
|
||||
apr_pollset_t *pollset;
|
||||
#endif
|
||||
};
|
||||
|
||||
const char *apr_inet_ntop(int af, const void *src, char *dst, apr_size_t size);
|
||||
int apr_inet_pton(int af, const char *src, void *dst);
|
||||
void apr_sockaddr_vars_set(apr_sockaddr_t *, int, apr_port_t);
|
||||
|
||||
#define apr_is_option_set(skt, option) \
|
||||
(((skt)->options & (option)) == (option))
|
||||
|
||||
#define apr_set_option(skt, option, on) \
|
||||
do { \
|
||||
if (on) \
|
||||
(skt)->options |= (option); \
|
||||
else \
|
||||
(skt)->options &= ~(option); \
|
||||
} while (0)
|
||||
|
||||
#endif /* ! NETWORK_IO_H */
|
||||
|
169
include/arch/unix/apr_arch_poll_private.h
Normal file
169
include/arch/unix/apr_arch_poll_private.h
Normal file
@ -0,0 +1,169 @@
|
||||
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef APR_ARCH_POLL_PRIVATE_H
|
||||
#define APR_ARCH_POLL_PRIVATE_H
|
||||
|
||||
#if HAVE_POLL_H
|
||||
#include <poll.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_SYS_POLL_H
|
||||
#include <sys/poll.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PORT_CREATE
|
||||
#include <port.h>
|
||||
#include <sys/port_impl.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_KQUEUE
|
||||
#include <sys/types.h>
|
||||
#include <sys/event.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_EPOLL
|
||||
#include <sys/epoll.h>
|
||||
#endif
|
||||
|
||||
#ifdef NETWARE
|
||||
#define HAS_SOCKETS(dt) (dt == APR_POLL_SOCKET) ? 1 : 0
|
||||
#define HAS_PIPES(dt) (dt == APR_POLL_FILE) ? 1 : 0
|
||||
#endif
|
||||
|
||||
/* Choose the best method platform specific to use in apr_pollset */
|
||||
#ifdef HAVE_KQUEUE
|
||||
#define POLLSET_USES_KQUEUE
|
||||
#define POLLSET_DEFAULT_METHOD APR_POLLSET_KQUEUE
|
||||
#elif defined(HAVE_PORT_CREATE)
|
||||
#define POLLSET_USES_PORT
|
||||
#define POLLSET_DEFAULT_METHOD APR_POLLSET_PORT
|
||||
#elif defined(HAVE_EPOLL)
|
||||
#define POLLSET_USES_EPOLL
|
||||
#define POLLSET_DEFAULT_METHOD APR_POLLSET_EPOLL
|
||||
#elif defined(HAVE_POLL)
|
||||
#define POLLSET_USES_POLL
|
||||
#define POLLSET_DEFAULT_METHOD APR_POLLSET_POLL
|
||||
#else
|
||||
#define POLLSET_USES_SELECT
|
||||
#define POLLSET_DEFAULT_METHOD APR_POLLSET_SELECT
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#define POLL_USES_SELECT
|
||||
#undef POLLSET_DEFAULT_METHOD
|
||||
#define POLLSET_DEFAULT_METHOD APR_POLLSET_SELECT
|
||||
#else
|
||||
#ifdef HAVE_POLL
|
||||
#define POLL_USES_POLL
|
||||
#else
|
||||
#define POLL_USES_SELECT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(POLLSET_USES_KQUEUE) || defined(POLLSET_USES_EPOLL) || defined(POLLSET_USES_PORT)
|
||||
|
||||
#include "apr_ring.h"
|
||||
|
||||
#if APR_HAS_THREADS
|
||||
#include "apr_thread_mutex.h"
|
||||
#define pollset_lock_rings() \
|
||||
if (pollset->flags & APR_POLLSET_THREADSAFE) \
|
||||
apr_thread_mutex_lock(pollset->p->ring_lock);
|
||||
#define pollset_unlock_rings() \
|
||||
if (pollset->flags & APR_POLLSET_THREADSAFE) \
|
||||
apr_thread_mutex_unlock(pollset->p->ring_lock);
|
||||
#else
|
||||
#define pollset_lock_rings()
|
||||
#define pollset_unlock_rings()
|
||||
#endif
|
||||
|
||||
typedef struct pfd_elem_t pfd_elem_t;
|
||||
|
||||
struct pfd_elem_t {
|
||||
APR_RING_ENTRY(pfd_elem_t) link;
|
||||
apr_pollfd_t pfd;
|
||||
#ifdef HAVE_PORT_CREATE
|
||||
int on_query_ring;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct apr_pollset_private_t apr_pollset_private_t;
|
||||
typedef struct apr_pollset_provider_t apr_pollset_provider_t;
|
||||
typedef struct apr_pollcb_provider_t apr_pollcb_provider_t;
|
||||
struct apr_pollset_t
|
||||
{
|
||||
apr_pool_t *pool;
|
||||
apr_uint32_t nelts;
|
||||
apr_uint32_t nalloc;
|
||||
apr_uint32_t flags;
|
||||
/* Pipe descriptors used for wakeup */
|
||||
apr_file_t *wakeup_pipe[2];
|
||||
apr_pollfd_t wakeup_pfd;
|
||||
apr_pollset_private_t *p;
|
||||
apr_pollset_provider_t *provider;
|
||||
};
|
||||
|
||||
typedef union {
|
||||
#if defined(HAVE_EPOLL)
|
||||
struct epoll_event *epoll;
|
||||
#endif
|
||||
#if defined(HAVE_PORT_CREATE)
|
||||
port_event_t *port;
|
||||
#endif
|
||||
#if defined(HAVE_KQUEUE)
|
||||
struct kevent *ke;
|
||||
#endif
|
||||
#if defined(HAVE_POLL)
|
||||
struct pollfd *ps;
|
||||
#endif
|
||||
void *undef;
|
||||
} apr_pollcb_pset;
|
||||
|
||||
struct apr_pollcb_t {
|
||||
apr_pool_t *pool;
|
||||
apr_uint32_t nelts;
|
||||
apr_uint32_t nalloc;
|
||||
int fd;
|
||||
apr_pollcb_pset pollset;
|
||||
apr_pollfd_t **copyset;
|
||||
apr_pollcb_provider_t *provider;
|
||||
};
|
||||
|
||||
struct apr_pollset_provider_t {
|
||||
apr_status_t (*create)(apr_pollset_t *, apr_uint32_t, apr_pool_t *, apr_uint32_t);
|
||||
apr_status_t (*add)(apr_pollset_t *, const apr_pollfd_t *);
|
||||
apr_status_t (*remove)(apr_pollset_t *, const apr_pollfd_t *);
|
||||
apr_status_t (*poll)(apr_pollset_t *, apr_interval_time_t, apr_int32_t *, const apr_pollfd_t **);
|
||||
apr_status_t (*cleanup)(apr_pollset_t *);
|
||||
const char *name;
|
||||
};
|
||||
|
||||
struct apr_pollcb_provider_t {
|
||||
apr_status_t (*create)(apr_pollcb_t *, apr_uint32_t, apr_pool_t *, apr_uint32_t);
|
||||
apr_status_t (*add)(apr_pollcb_t *, apr_pollfd_t *);
|
||||
apr_status_t (*remove)(apr_pollcb_t *, apr_pollfd_t *);
|
||||
apr_status_t (*poll)(apr_pollcb_t *, apr_interval_time_t, apr_pollcb_cb_t, void *);
|
||||
const char *name;
|
||||
};
|
||||
|
||||
/* Private functions */
|
||||
void apr_pollset_drain_wakeup_pipe(apr_pollset_t *pollset);
|
||||
|
||||
#endif /* APR_ARCH_POLL_PRIVATE_H */
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user