├── .editorconfig ├── .github └── workflows │ ├── linux.yml │ ├── macos.yml │ ├── windows-vcpkg.yml │ └── windows.yml ├── .gitignore ├── CHANGES ├── CMakeLists.txt ├── LICENSE ├── Makefile.in ├── Makefile.win ├── NOTICE ├── NWGNUmakefile ├── README ├── README.FREETDS ├── README.cmake ├── SConscript ├── SConstruct ├── STATUS ├── apr-config.in ├── apr.dsp ├── apr.dsw ├── apr.pc.in ├── atomic ├── netware │ └── apr_atomic.c ├── os390 │ └── atomic.c ├── unix │ ├── builtins.c │ ├── builtins64.c │ ├── ia32.c │ ├── mutex.c │ ├── mutex64.c │ ├── ppc.c │ ├── s390.c │ └── solaris.c └── win32 │ ├── apr_atomic.c │ └── apr_atomic64.c ├── buckets ├── apr_brigade.c ├── apr_buckets.c ├── apr_buckets_alloc.c ├── apr_buckets_eos.c ├── apr_buckets_file.c ├── apr_buckets_flush.c ├── apr_buckets_heap.c ├── apr_buckets_mmap.c ├── apr_buckets_pipe.c ├── apr_buckets_pool.c ├── apr_buckets_refcount.c ├── apr_buckets_simple.c └── apr_buckets_socket.c ├── buffer └── apr_buffer.c ├── build.conf ├── build ├── MakeEtags ├── NWGNUenvironment.inc ├── NWGNUhead.inc ├── NWGNUmakefile ├── NWGNUtail.inc ├── PrintPath ├── __init__.py ├── aplibtool.c ├── apr_common.m4 ├── apr_hints.m4 ├── apr_network.m4 ├── apr_rules.mk.in ├── apr_threads.m4 ├── apr_win32.m4 ├── aprapp.dsp ├── aprconf.py ├── aprenv.py ├── apu-conf.m4 ├── apu-hints.m4 ├── ax_prog_cc_for_build.m4 ├── buildcheck.sh ├── config.guess ├── config.sub ├── crypto.m4 ├── cvtdsp.pl ├── dbd.m4 ├── dbm.m4 ├── dso.m4 ├── find_apr.m4 ├── fixwin32mak.pl ├── gen-build.py ├── get-version.sh ├── iconv.m4 ├── install.sh ├── jlibtool.c ├── ldap.m4 ├── libaprapp.dsp ├── lineends.pl ├── make_exports.awk ├── make_nw_export.awk ├── make_var_export.awk ├── mkdir.sh ├── nw_export.h ├── nw_ver.awk ├── pkg │ ├── README │ ├── buildpkg.sh │ └── pkginfo.in ├── preaprapp.dsp ├── prelibaprapp.dsp ├── rpm │ └── apr.spec.in ├── run-gcov.sh ├── subst.py ├── vcpkg │ └── apr-2 │ │ ├── portfile.cmake │ │ └── vcpkg.json ├── win32ver.awk └── xml.m4 ├── buildconf ├── config.layout ├── configure.in ├── crypto ├── apr_crypto.c ├── apr_crypto_commoncrypto.c ├── apr_crypto_nss.c ├── apr_crypto_nss.dsp ├── apr_crypto_openssl.c ├── apr_crypto_openssl.dsp ├── apr_crypto_prng.c ├── apr_md4.c ├── apr_md5.c ├── apr_passwd.c ├── apr_sha1.c ├── apr_siphash.c ├── crypt_blowfish.c ├── crypt_blowfish.h ├── getuuid.c └── uuid.c ├── dbd ├── NWGNUdbdmysql ├── NWGNUdbdpgsql ├── NWGNUdbdsqli2 ├── NWGNUdbdsqli3 ├── NWGNUmakefile ├── apr_dbd.c ├── apr_dbd_mysql.c ├── apr_dbd_mysql.dsp ├── apr_dbd_odbc.c ├── apr_dbd_odbc.dsp ├── apr_dbd_oracle.c ├── apr_dbd_oracle.dsp ├── apr_dbd_pgsql.c ├── apr_dbd_pgsql.dsp ├── apr_dbd_sqlite2.c ├── apr_dbd_sqlite2.dsp ├── apr_dbd_sqlite3.c ├── apr_dbd_sqlite3.dsp └── unsupported │ ├── NWGNUdbdfreetds │ ├── apr_dbd_freetds.c │ └── apr_dbd_freetds.dsp ├── dbm ├── NWGNUdbmdb ├── NWGNUdbmgdbm ├── NWGNUmakefile ├── apr_dbm.c ├── apr_dbm_berkeleydb.c ├── apr_dbm_db.dsp ├── apr_dbm_gdbm.c ├── apr_dbm_gdbm.dsp ├── apr_dbm_lmdb.c ├── apr_dbm_ndbm.c ├── apr_dbm_sdbm.c └── sdbm │ ├── sdbm.c │ ├── sdbm_hash.c │ ├── sdbm_lock.c │ ├── sdbm_pair.c │ ├── sdbm_pair.h │ ├── sdbm_private.h │ └── sdbm_tune.h ├── docs ├── APRDesign.html ├── canonical_filenames.html ├── doxygen.conf ├── incomplete_types ├── non_apr_programs ├── pool-design.html └── win32_builds.html ├── dso ├── aix │ └── dso.c ├── beos │ └── dso.c ├── netware │ └── dso.c ├── os2 │ └── dso.c ├── os390 │ └── dso.c ├── unix │ └── dso.c └── win32 │ └── dso.c ├── emacs-mode ├── encoding ├── apr_base64.c ├── apr_encode.c └── apr_escape.c ├── file_io ├── netware │ ├── filestat.c │ ├── filesys.c │ ├── flock.c │ ├── mktemp.c │ └── pipe.c ├── os2 │ ├── buffer.c │ ├── copy.c │ ├── dir.c │ ├── dir_make_recurse.c │ ├── fileacc.c │ ├── filedup.c │ ├── filepath.c │ ├── filepath_util.c │ ├── filestat.c │ ├── filesys.c │ ├── flock.c │ ├── fullrw.c │ ├── link.c │ ├── maperrorcode.c │ ├── mktemp.c │ ├── open.c │ ├── pipe.c │ ├── printf.c │ ├── readwrite.c │ ├── seek.c │ └── tempdir.c ├── unix │ ├── buffer.c │ ├── copy.c │ ├── dir.c │ ├── fileacc.c │ ├── filedup.c │ ├── filepath.c │ ├── filepath_util.c │ ├── filestat.c │ ├── flock.c │ ├── fullrw.c │ ├── mktemp.c │ ├── open.c │ ├── pipe.c │ ├── printf.c │ ├── readwrite.c │ ├── seek.c │ └── tempdir.c └── win32 │ ├── buffer.c │ ├── dir.c │ ├── filedup.c │ ├── filepath.c │ ├── filestat.c │ ├── filesys.c │ ├── flock.c │ ├── open.c │ ├── pipe.c │ ├── readwrite.c │ └── seek.c ├── helpers └── apr_rename.pl ├── hooks └── apr_hooks.c ├── include ├── apr.h.in ├── apr.hnw ├── apr.hw ├── apr.hwc ├── apr_allocator.h ├── apr_anylock.h ├── apr_atomic.h ├── apr_base64.h ├── apr_buckets.h ├── apr_buffer.h ├── apr_crypto.h ├── apr_cstr.h ├── apr_date.h ├── apr_dbd.h ├── apr_dbm.h ├── apr_dso.h ├── apr_encode.h ├── apr_env.h ├── apr_errno.h ├── apr_escape.h ├── apr_file_info.h ├── apr_file_io.h ├── apr_fnmatch.h ├── apr_general.h ├── apr_getopt.h ├── apr_global_mutex.h ├── apr_hash.h ├── apr_hooks.h ├── apr_inherit.h ├── apr_jose.h ├── apr_json.h ├── apr_ldap.h ├── apr_lib.h ├── apr_md4.h ├── apr_md5.h ├── apr_memcache.h ├── apr_mmap.h ├── apr_network_io.h ├── apr_optional.h ├── apr_optional_hooks.h ├── apr_perms_set.h ├── apr_poll.h ├── apr_pools.h ├── apr_portable.h ├── apr_proc_mutex.h ├── apr_queue.h ├── apr_random.h ├── apr_redis.h ├── apr_reslist.h ├── apr_ring.h ├── apr_rmm.h ├── apr_sdbm.h ├── apr_sha1.h ├── apr_shm.h ├── apr_signal.h ├── apr_siphash.h ├── apr_skiplist.h ├── apr_strings.h ├── apr_strmatch.h ├── apr_tables.h ├── apr_thread_cond.h ├── apr_thread_mutex.h ├── apr_thread_pool.h ├── apr_thread_proc.h ├── apr_thread_rwlock.h ├── apr_time.h ├── apr_uri.h ├── apr_user.h ├── apr_uuid.h ├── apr_version.h ├── apr_want.h ├── apr_xlate.h ├── apr_xml.h ├── apu.h ├── apu_errno.h ├── apu_version.h ├── apu_want.h.in ├── apu_want.hnw ├── apu_want.hw ├── arch │ ├── aix │ │ └── apr_arch_dso.h │ ├── beos │ │ ├── apr_arch_dso.h │ │ ├── apr_arch_proc_mutex.h │ │ ├── apr_arch_thread_cond.h │ │ ├── apr_arch_thread_mutex.h │ │ ├── apr_arch_thread_rwlock.h │ │ └── apr_arch_threadproc.h │ ├── netware │ │ ├── apr_arch_dso.h │ │ ├── apr_arch_file_io.h │ │ ├── apr_arch_global_mutex.h │ │ ├── apr_arch_internal_time.h │ │ ├── apr_arch_networkio.h │ │ ├── apr_arch_pre_nw.h │ │ ├── apr_arch_proc_mutex.h │ │ ├── apr_arch_thread_cond.h │ │ ├── apr_arch_thread_mutex.h │ │ ├── apr_arch_thread_rwlock.h │ │ ├── apr_arch_threadproc.h │ │ └── apr_private.h │ ├── os2 │ │ ├── apr_arch_dso.h │ │ ├── apr_arch_file_io.h │ │ ├── apr_arch_networkio.h │ │ ├── apr_arch_os2calls.h │ │ ├── apr_arch_proc_mutex.h │ │ ├── apr_arch_thread_cond.h │ │ ├── apr_arch_thread_mutex.h │ │ ├── apr_arch_thread_rwlock.h │ │ └── apr_arch_threadproc.h │ ├── os390 │ │ └── apr_arch_dso.h │ ├── unix │ │ ├── apr_arch_atomic.h │ │ ├── apr_arch_dso.h │ │ ├── apr_arch_file_io.h │ │ ├── apr_arch_global_mutex.h │ │ ├── apr_arch_inherit.h │ │ ├── apr_arch_internal_time.h │ │ ├── apr_arch_misc.h │ │ ├── apr_arch_networkio.h │ │ ├── apr_arch_poll_private.h │ │ ├── apr_arch_proc_mutex.h │ │ ├── apr_arch_shm.h │ │ ├── apr_arch_thread_cond.h │ │ ├── apr_arch_thread_mutex.h │ │ ├── apr_arch_thread_rwlock.h │ │ └── apr_arch_threadproc.h │ └── win32 │ │ ├── apr_arch_atime.h │ │ ├── apr_arch_dso.h │ │ ├── apr_arch_file_io.h │ │ ├── apr_arch_inherit.h │ │ ├── apr_arch_misc.h │ │ ├── apr_arch_networkio.h │ │ ├── apr_arch_proc_mutex.h │ │ ├── apr_arch_thread_cond.h │ │ ├── apr_arch_thread_mutex.h │ │ ├── apr_arch_thread_rwlock.h │ │ ├── apr_arch_threadproc.h │ │ ├── apr_arch_utf8.h │ │ ├── apr_dbg_win32_handles.h │ │ └── apr_private.h └── private │ ├── apr_crypto_internal.h │ ├── apr_dbd_internal.h │ ├── apr_dbd_odbc_v2.h │ ├── apr_dbm_private.h │ ├── apr_encode_private.h │ ├── apr_ldap_internal.h │ ├── apr_support.h │ ├── apu_internal.h │ ├── apu_ldap_internal.h.in │ ├── apu_ldap_internal.hw │ ├── apu_select_dbm.h.in │ └── apu_select_dbm.hw ├── jose ├── apr_jose.c ├── apr_jose_decode.c └── apr_jose_encode.c ├── json ├── apr_json.c ├── apr_json_decode.c └── apr_json_encode.c ├── ldap ├── apr_ldap.c ├── apr_ldap_stub.c └── apr_ldap_url.c ├── libapr.dsp ├── libapr.rc ├── locks ├── beos │ ├── proc_mutex.c │ ├── thread_cond.c │ ├── thread_mutex.c │ └── thread_rwlock.c ├── netware │ ├── proc_mutex.c │ ├── thread_cond.c │ ├── thread_mutex.c │ └── thread_rwlock.c ├── os2 │ ├── proc_mutex.c │ ├── thread_cond.c │ ├── thread_mutex.c │ └── thread_rwlock.c ├── unix │ ├── global_mutex.c │ ├── proc_mutex.c │ ├── thread_cond.c │ ├── thread_mutex.c │ └── thread_rwlock.c └── win32 │ ├── proc_mutex.c │ ├── thread_cond.c │ ├── thread_mutex.c │ └── thread_rwlock.c ├── memcache └── apr_memcache.c ├── memory └── unix │ └── apr_pools.c ├── misc ├── netware │ ├── apr.xdc │ ├── charset.c │ ├── libprews.c │ ├── rand.c │ └── start.c ├── unix │ ├── charset.c │ ├── env.c │ ├── errorcodes.c │ ├── getopt.c │ ├── otherchild.c │ ├── rand.c │ ├── randbyte_os2.inc │ ├── start.c │ └── version.c └── win32 │ ├── apr_app.c │ ├── charset.c │ ├── env.c │ ├── internal.c │ ├── misc.c │ ├── rand.c │ ├── start.c │ └── utf8.c ├── mmap ├── unix │ ├── common.c │ └── mmap.c └── win32 │ └── mmap.c ├── network_io ├── beos │ ├── sendrecv.c │ └── socketcommon.c ├── os2 │ ├── inet_ntop.c │ ├── inet_pton.c │ ├── multicast.c │ ├── os2calls.c │ ├── sendrecv.c │ ├── sendrecv_udp.c │ ├── sockaddr.c │ ├── socket_util.c │ ├── sockets.c │ └── sockopt.c ├── unix │ ├── inet_ntop.c │ ├── inet_pton.c │ ├── multicast.c │ ├── sendrecv.c │ ├── sockaddr.c │ ├── socket_util.c │ ├── sockets.c │ └── sockopt.c └── win32 │ ├── sendrecv.c │ ├── socket_pipe.c │ ├── sockets.c │ └── sockopt.c ├── passwd └── apr_getpass.c ├── poll ├── os2 │ ├── poll.c │ ├── pollcb.c │ └── pollset.c └── unix │ ├── epoll.c │ ├── kqueue.c │ ├── poll.c │ ├── pollcb.c │ ├── pollset.c │ ├── port.c │ ├── select.c │ ├── wakeup.c │ └── z_asio.c ├── random └── unix │ ├── apr_random.c │ ├── sha2.c │ ├── sha2.h │ └── sha2_glue.c ├── redis └── apr_redis.c ├── shmem ├── beos │ └── shm.c ├── os2 │ └── shm.c ├── unix │ └── shm.c └── win32 │ └── shm.c ├── strings ├── apr_cpystrn.c ├── apr_cstr.c ├── apr_fnmatch.c ├── apr_snprintf.c ├── apr_strings.c ├── apr_strnatcmp.c └── apr_strtok.c ├── strmatch └── apr_strmatch.c ├── support ├── os2 │ └── waitio.c └── unix │ └── waitio.c ├── tables ├── apr_hash.c ├── apr_skiplist.c └── apr_tables.c ├── test ├── Makefile.in ├── Makefile.win ├── NWGNUaprtest ├── NWGNUechod ├── NWGNUglobalmutexchild ├── NWGNUmakefile ├── NWGNUmemcachedmock ├── NWGNUmod_test ├── NWGNUproc_child ├── NWGNUreadchild ├── NWGNUsockchild ├── NWGNUsockperf ├── NWGNUtestatmc ├── NWGNUtryread ├── README ├── abts.c ├── abts.h ├── abts_tests.h ├── data │ ├── billion-laughs.xml │ ├── file_datafile.txt │ ├── mmap_datafile.txt │ └── mmap_large_datafile.txt ├── dbd.c ├── echoargs.bat ├── echoargs.c ├── echod.c ├── globalmutexchild.c ├── internal │ ├── Makefile.in │ ├── Makefile.win │ ├── testregex.c │ └── testutf.c ├── memcachedmock.c ├── mod_test.c ├── nw_misc.c ├── occhild.c ├── proc_child.c ├── readchild.c ├── sendfile.c ├── sockchild.c ├── sockperf.c ├── testall.dsw ├── testapp.c ├── testargs.c ├── testatomic.c ├── testbase64.c ├── testbuckets.c ├── testbuffer.c ├── testcond.c ├── testcrypto.c ├── testdate.c ├── testdbd.c ├── testdbm.c ├── testdir.c ├── testdll.dsp ├── testdso.c ├── testdup.c ├── testencode.c ├── testenv.c ├── testescape.c ├── testfile.c ├── testfilecopy.c ├── testfileinfo.c ├── testflock.c ├── testflock.h ├── testfmt.c ├── testfnmatch.c ├── testglobalmutex.c ├── testglobalmutex.h ├── testhash.c ├── testhooks.c ├── testipsub.c ├── testjose.c ├── testjson.c ├── testldap.c ├── testlfs.c ├── testlfsabi.c ├── testlfsabi.h ├── testlfsabi32.c ├── testlfsabi64.c ├── testlfsabi_include.c ├── testlib.dsp ├── testlock.c ├── testlockperf.c ├── testmd4.c ├── testmd5.c ├── testmemcache.c ├── testmemcache.h ├── testmmap.c ├── testmutexscope.c ├── testnames.c ├── testoc.c ├── testpass.c ├── testpath.c ├── testpipe.c ├── testpoll.c ├── testpools.c ├── testproc.c ├── testprocmutex.c ├── testqueue.c ├── testrand.c ├── testredis.c ├── testreslist.c ├── testrmm.c ├── testshm.c ├── testshm.h ├── testshmconsumer.c ├── testshmproducer.c ├── testsiphash.c ├── testskiplist.c ├── testsleep.c ├── testsock.c ├── testsock.h ├── testsockets.c ├── testsockopt.c ├── teststr.c ├── teststrmatch.c ├── teststrnatcmp.c ├── testtable.c ├── testtemp.c ├── testthread.c ├── testtime.c ├── testud.c ├── testuri.c ├── testuser.c ├── testutil.c ├── testutil.h ├── testuuid.c ├── testvsn.c ├── testxlate.c ├── testxml.c └── tryread.c ├── threadproc ├── beos │ ├── apr_proc_stub.c │ ├── proc.c │ ├── thread.c │ ├── threadpriv.c │ └── threadproc_common.c ├── netware │ ├── proc.c │ ├── procsup.c │ ├── signals.c │ ├── thread.c │ └── threadpriv.c ├── os2 │ ├── proc.c │ ├── signals.c │ ├── thread.c │ └── threadpriv.c ├── unix │ ├── proc.c │ ├── procsup.c │ ├── signals.c │ ├── thread.c │ └── threadpriv.c └── win32 │ ├── proc.c │ ├── signals.c │ ├── thread.c │ └── threadpriv.c ├── time ├── unix │ ├── time.c │ └── timestr.c └── win32 │ ├── time.c │ └── timestr.c ├── tools └── gen_test_char.c ├── uri └── apr_uri.c ├── user ├── netware │ ├── groupinfo.c │ └── userinfo.c ├── unix │ ├── groupinfo.c │ └── userinfo.c └── win32 │ ├── groupinfo.c │ └── userinfo.c ├── util-misc ├── apr_date.c ├── apr_error.c ├── apr_queue.c ├── apr_reslist.c ├── apr_rmm.c ├── apr_thread_pool.c └── apu_dso.c ├── xlate └── xlate.c └── xml ├── NWGNUmakefile ├── apr_xml.c ├── apr_xml_expat.c ├── apr_xml_internal.h ├── apr_xml_libxml2.c └── apr_xml_xmllite.c /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | guidelines = dashed 78 5 | indent_style = space 6 | insert_final_newline = true 7 | trim_trailing_whitespace = true 8 | 9 | [**/CMakeLists.txt] 10 | indent_size = 2 11 | 12 | [*.json] 13 | ident_size = 2 14 | 15 | [*.{c,h}] 16 | cpp_indent_within_parentheses = align_to_parenthesis 17 | cpp_indent_preserve_within_parentheses = true 18 | 19 | cpp_space_pointer_reference_alignment = right 20 | cpp_indent_preserve_comments = true 21 | -------------------------------------------------------------------------------- /.github/workflows/macos.yml: -------------------------------------------------------------------------------- 1 | name: macOS 2 | 3 | on: 4 | push: 5 | branches: [ "*" ] 6 | tags: [ "*" ] 7 | pull_request: 8 | branches: [ "trunk" ] 9 | 10 | env: 11 | MARGS: "-j2" 12 | 13 | jobs: 14 | 15 | build: 16 | strategy: 17 | matrix: 18 | os: [ "macos-latest" ] 19 | 20 | runs-on: ${{ matrix.os }} 21 | timeout-minutes: 15 22 | env: 23 | NOTEST_CFLAGS: ${{ matrix.notest-cflags }} 24 | name: ${{ matrix.name }} 25 | steps: 26 | - name: Install prerequisites 27 | run: brew install libtool autoconf make bash 28 | - uses: actions/checkout@v4 29 | - name: buildconf 30 | run: ./buildconf 31 | - name: configure 32 | run: ./configure 33 | - name: make 34 | run: make $MARGS 35 | - name: make check 36 | run: make check || true 37 | -------------------------------------------------------------------------------- /.github/workflows/windows-vcpkg.yml: -------------------------------------------------------------------------------- 1 | name: Vcpkg (Windows) 2 | 3 | on: 4 | push: 5 | branches: [ "trunk" ] 6 | 7 | jobs: 8 | build: 9 | strategy: 10 | matrix: 11 | os: [windows-latest] 12 | triplet: 13 | - x64-windows 14 | - x64-windows-static 15 | - x64-windows-static-md 16 | - x86-windows 17 | - x86-windows-static 18 | port: 19 | - apr-2 20 | - apr-2[core] 21 | - apr-2[crypto,dbd-sqlite3,dbd-odbc,dbd-postgresql,ldap,private-headers,xlate] 22 | fail-fast: false 23 | 24 | name: "${{ matrix.port }}:${{ matrix.triplet }} on ${{ matrix.os }}" 25 | # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. 26 | # You can convert this to a matrix build if you need cross-platform coverage. 27 | # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix 28 | runs-on: ${{ matrix.os }} 29 | 30 | env: 31 | VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" 32 | 33 | steps: 34 | - name: Export GitHub Actions cache environment variables 35 | uses: actions/github-script@v7 36 | with: 37 | script: | 38 | core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); 39 | core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); 40 | 41 | - uses: actions/checkout@v4 42 | 43 | - name: Vcpkg Install 44 | run: C:\vcpkg\vcpkg.exe install ${{ matrix.port }} --head --overlay-ports ${{ github.workspace }}\build\vcpkg --triplet ${{ matrix.triplet }} --enforce-port-checks 45 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Apache Portable Runtime 2 | Copyright 2025 The Apache Software Foundation. 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | 7 | Portions of this software were developed at the National Center 8 | for Supercomputing Applications (NCSA) at the University of 9 | Illinois at Urbana-Champaign. 10 | 11 | This software contains code derived from the RSA Data Security 12 | Inc. MD5 Message-Digest Algorithm. 13 | 14 | This software contains code derived from UNIX V7, Copyright(C) 15 | Caldera International Inc. 16 | -------------------------------------------------------------------------------- /README.FREETDS: -------------------------------------------------------------------------------- 1 | The APR DBD Driver for FreeTDS has been removed from the build. 2 | It is known to have problems, and we are not able to maintain it. 3 | 4 | The source code is still available. If you want it and are able 5 | to manage maintenance for yourself, you can patch the build and 6 | work through issues that affect you, but you're on your own. 7 | 8 | We expect that for most users, the ODBC driver will serve as 9 | an alternative. 10 | 11 | Sorry. 12 | -------------------------------------------------------------------------------- /SConscript: -------------------------------------------------------------------------------- 1 | 2 | Import("env") 3 | 4 | files = env.core_lib_files() 5 | 6 | (major, minor, patch) = env.APRVersion() 7 | 8 | libapr = env.SharedLibrary('apr-%d' % (major), files) 9 | tests = Split(""" 10 | abts.c testutil.c 11 | testtime.c teststr.c testvsn.c testipsub.c testshm.c 12 | testmmap.c testud.c testtable.c testsleep.c testpools.c 13 | testfmt.c testfile.c testdir.c testfileinfo.c testrand.c 14 | testdso.c testoc.c testdup.c testsockets.c testproc.c 15 | testpoll.c testlock.c testsockopt.c testpipe.c 16 | testthread.c testhash.c testargs.c testnames.c testuser.c 17 | testpath.c testenv.c testprocmutex.c testfnmatch.c 18 | testatomic.c testflock.c testsock.c testglobalmutex.c 19 | teststrnatcmp.c testfilecopy.c testtemp.c testlfs.c 20 | testcond.c testuri.c testmemcache.c testdate.c 21 | testxlate.c testdbd.c testrmm.c testmd4.c 22 | teststrmatch.c testpass.c testcrypto.c testqueue.c 23 | testbuckets.c testxml.c testdbm.c testuuid.c testmd5.c 24 | testreslist.c dbd.c 25 | """) 26 | 27 | tenv = env.Clone() 28 | tenv.AppendUnique(LIBS = libapr) 29 | testall = tenv.Program('testall', source = ["test/"+t for t in tests]) 30 | 31 | targets = [libapr, testall] 32 | 33 | Return("targets") 34 | -------------------------------------------------------------------------------- /SConstruct: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env scons 2 | # 3 | 4 | from build import APREnv 5 | 6 | EnsureSConsVersion(1, 1, 0) 7 | 8 | vars = Variables('build.py') 9 | 10 | vars.Add('prefix', 'Installation Prefix', '/usr/local') 11 | vars.Add('maintainer_mode', 'Turn on debugging and compile time warnings', 0) 12 | vars.Add('profile', 'Turn on profiling for the build (GCC)', 0) 13 | vars.Add('lfs', 'Large file support on 32-bit platforms', 1) 14 | vars.Add('ipv6', 'IPv6 support', 1) 15 | vars.Add(EnumVariable('pool_debug', 'Turn on pools debugging', 'no', 16 | allowed_values=('yes', 'no', 'verbose', 'verbose-alloc', 'lifetime', 'owner', 'all'))) 17 | 18 | env = APREnv(args=ARGUMENTS, variables=vars) 19 | 20 | 21 | Help(vars.GenerateHelpText(env)) 22 | 23 | env.APRHints() 24 | 25 | env = env.APRAutoconf() 26 | 27 | if env['maintainer_mode']: 28 | if env.is_gcc(): 29 | env.AppendUnique(CPPFLAGS = ['-g', '-Wall', '-Wmissing-prototypes', '-Wstrict-prototypes', '-Wmissing-declarations']) 30 | 31 | if env['profile']: 32 | env.Filter(CPPFLAGS = '-g') 33 | env.AppendUnique(CPPFLAGS = ['-pg']) 34 | 35 | if env['pool_debug'] != 'no': 36 | flags = {'yes': 1, 37 | 'verbose': 2, 38 | 'lifetime': 4, 39 | 'owner': 8, 40 | 'verbose-alloc': 16, 41 | 'all': 31} 42 | env.AppendUnique(CPPFLAGS = "-DAPR_POOL_DEBUG=%d" % flags[env['pool_debug']]) 43 | 44 | Export("env") 45 | 46 | # TODO: Support debug/release builds 47 | targets = SConscript("SConscript", variant_dir='builds/default', duplicate=0) 48 | 49 | env.Default(targets) 50 | -------------------------------------------------------------------------------- /apr.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | APR_MAJOR_VERSION=@APR_MAJOR_VERSION@ 5 | includedir=@includedir@ 6 | 7 | Name: APR 8 | Description: The Apache Portable Runtime library 9 | Version: @APR_DOTTED_VERSION@ 10 | Libs: -L${libdir} -l@APR_LIBNAME@ @EXTRA_LIBS@ 11 | Cflags: @EXTRA_CPPFLAGS@ @EXTRA_CFLAGS@ -I${includedir} 12 | -------------------------------------------------------------------------------- /buckets/apr_buckets.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apr_buckets.h" 18 | 19 | APR_DECLARE_NONSTD(apr_status_t) apr_bucket_setaside_noop(apr_bucket *data, 20 | apr_pool_t *pool) 21 | { 22 | return APR_SUCCESS; 23 | } 24 | 25 | APR_DECLARE_NONSTD(apr_status_t) apr_bucket_setaside_notimpl(apr_bucket *data, 26 | apr_pool_t *pool) 27 | { 28 | return APR_ENOTIMPL; 29 | } 30 | 31 | APR_DECLARE_NONSTD(apr_status_t) apr_bucket_split_notimpl(apr_bucket *data, 32 | apr_size_t point) 33 | { 34 | return APR_ENOTIMPL; 35 | } 36 | 37 | APR_DECLARE_NONSTD(apr_status_t) apr_bucket_copy_notimpl(apr_bucket *e, 38 | apr_bucket **c) 39 | { 40 | return APR_ENOTIMPL; 41 | } 42 | 43 | APR_DECLARE_NONSTD(void) apr_bucket_destroy_noop(void *data) 44 | { 45 | return; 46 | } 47 | -------------------------------------------------------------------------------- /buckets/apr_buckets_eos.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apr_buckets.h" 18 | 19 | static apr_status_t eos_bucket_read(apr_bucket *b, const char **str, 20 | apr_size_t *len, apr_read_type_e block) 21 | { 22 | *str = NULL; 23 | *len = 0; 24 | return APR_SUCCESS; 25 | } 26 | 27 | APR_DECLARE(apr_bucket *) apr_bucket_eos_make(apr_bucket *b) 28 | { 29 | b->length = 0; 30 | b->start = 0; 31 | b->data = NULL; 32 | b->type = &apr_bucket_type_eos; 33 | 34 | return b; 35 | } 36 | 37 | APR_DECLARE(apr_bucket *) apr_bucket_eos_create(apr_bucket_alloc_t *list) 38 | { 39 | apr_bucket *b = apr_bucket_alloc(sizeof(*b), list); 40 | 41 | APR_BUCKET_INIT(b); 42 | b->free = apr_bucket_free; 43 | b->list = list; 44 | return apr_bucket_eos_make(b); 45 | } 46 | 47 | APR_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_eos = { 48 | "EOS", 5, APR_BUCKET_METADATA, 49 | apr_bucket_destroy_noop, 50 | eos_bucket_read, 51 | apr_bucket_setaside_noop, 52 | apr_bucket_split_notimpl, 53 | apr_bucket_simple_copy 54 | }; 55 | -------------------------------------------------------------------------------- /buckets/apr_buckets_flush.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apr_buckets.h" 18 | 19 | static apr_status_t flush_bucket_read(apr_bucket *b, const char **str, 20 | apr_size_t *len, apr_read_type_e block) 21 | { 22 | *str = NULL; 23 | *len = 0; 24 | return APR_SUCCESS; 25 | } 26 | 27 | APR_DECLARE(apr_bucket *) apr_bucket_flush_make(apr_bucket *b) 28 | { 29 | b->length = 0; 30 | b->start = 0; 31 | b->data = NULL; 32 | b->type = &apr_bucket_type_flush; 33 | 34 | return b; 35 | } 36 | 37 | APR_DECLARE(apr_bucket *) apr_bucket_flush_create(apr_bucket_alloc_t *list) 38 | { 39 | apr_bucket *b = apr_bucket_alloc(sizeof(*b), list); 40 | 41 | APR_BUCKET_INIT(b); 42 | b->free = apr_bucket_free; 43 | b->list = list; 44 | return apr_bucket_flush_make(b); 45 | } 46 | 47 | APR_DECLARE_DATA const apr_bucket_type_t apr_bucket_type_flush = { 48 | "FLUSH", 5, APR_BUCKET_METADATA, 49 | apr_bucket_destroy_noop, 50 | flush_bucket_read, 51 | apr_bucket_setaside_noop, 52 | apr_bucket_split_notimpl, 53 | apr_bucket_simple_copy 54 | }; 55 | -------------------------------------------------------------------------------- /buckets/apr_buckets_refcount.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apr_buckets.h" 18 | 19 | APR_DECLARE_NONSTD(apr_status_t) apr_bucket_shared_split(apr_bucket *a, 20 | apr_size_t point) 21 | { 22 | apr_bucket_refcount *r = a->data; 23 | apr_status_t rv; 24 | 25 | if ((rv = apr_bucket_simple_split(a, point)) != APR_SUCCESS) { 26 | return rv; 27 | } 28 | r->refcount++; 29 | 30 | return APR_SUCCESS; 31 | } 32 | 33 | APR_DECLARE_NONSTD(apr_status_t) apr_bucket_shared_copy(apr_bucket *a, 34 | apr_bucket **b) 35 | { 36 | apr_bucket_refcount *r = a->data; 37 | 38 | r->refcount++; 39 | 40 | return apr_bucket_simple_copy(a, b); 41 | } 42 | 43 | APR_DECLARE(int) apr_bucket_shared_destroy(void *data) 44 | { 45 | apr_bucket_refcount *r = data; 46 | r->refcount--; 47 | return (r->refcount == 0); 48 | } 49 | 50 | APR_DECLARE(apr_bucket *) apr_bucket_shared_make(apr_bucket *b, void *data, 51 | apr_off_t start, 52 | apr_size_t length) 53 | { 54 | apr_bucket_refcount *r = data; 55 | 56 | b->data = r; 57 | b->start = start; 58 | b->length = length; 59 | /* caller initializes the type field */ 60 | r->refcount = 1; 61 | 62 | return b; 63 | } 64 | -------------------------------------------------------------------------------- /build/MakeEtags: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This file illustrates how to generate a useful TAGS file via etags 4 | # for emacs. This should be invoked from the top source directory i.e.: 5 | # > build/MakeEtags 6 | # and will create a TAGS file in the top source directory. 7 | 8 | # This script falls under the Apache License. 9 | # See http://www.apache.org/docs/LICENSE 10 | 11 | # Once you have created ./TAGS in emacs you'll need to setup 12 | # tag-table-alist with an entry to assure it finds the single ./TAGS 13 | # file from the many source directories. Something along these lines: 14 | # (setq tag-table-alist 15 | # '(("/home/me/work/apr-x.y/" . "/home/me/work/apr-x.y/") 16 | # ("/home/me/work/apr-util-x.y/" . "/home/me/work/apr-util-x.y/") 17 | # ("/home/me/work/httpd-x.y/" . "/home/me/work/httpd-x.y/") 18 | # )) 19 | 20 | # This requires a special version of etags, i.e. the 21 | # one called "Exuberant ctags" available at: 22 | # http://ctags.sourceforge.net/ 23 | # Once that is setup you'll need to point to the 24 | # executable here: 25 | 26 | etags=${ETAGS-etags} 27 | 28 | # Exuberant etags is necessary since it can ignore some defined symbols 29 | # that obscure the function signatures. 30 | 31 | ignore=AP_DECLARE,AP_DECLARE_NONSTD,__declspec,APR_DECLARE,APR_DECLARE_NONSTD 32 | 33 | # Create an etags file at the root of the source 34 | # tree, then create symbol links to it from each 35 | # directory in the source tree. By passing etags 36 | # absolute pathnames we get a tag file that is 37 | # NOT portable when we move the directory tree. 38 | 39 | find . -name '*.[ch]' -print | $etags -I "$ignore" -L - 40 | 41 | -------------------------------------------------------------------------------- /build/NWGNUmakefile: -------------------------------------------------------------------------------- 1 | # 2 | # Declare the sub-directories to be built here 3 | # 4 | 5 | SUBDIRS = \ 6 | $(EOLIST) 7 | 8 | # 9 | # Get the 'head' of the build environment. This includes default targets and 10 | # paths to tools 11 | # 12 | 13 | include $(APR_WORK)/build/NWGNUhead.inc 14 | 15 | # 16 | # build this level's files 17 | 18 | # 19 | # Make sure all needed macro's are defined 20 | # 21 | 22 | # 23 | # These directories will be at the beginning of the include list, followed by 24 | # INCDIRS 25 | # 26 | XINCDIRS += \ 27 | $(APR)/include \ 28 | $(APR)/include/private \ 29 | $(APR)/include/arch/netware \ 30 | $(APR)/include/arch/unix \ 31 | $(APRBUILD) \ 32 | $(EOLIST) 33 | 34 | FILES_prebuild_headers = \ 35 | $(APR)/include/apr.h \ 36 | $(APR)/include/apu_want.h \ 37 | $(APR)/include/private/apu_select_dbm.h \ 38 | $(APR)/include/private/apr_escape_test_char.h \ 39 | $(EOLIST) 40 | 41 | nlms :: $(APR)/aprlib.imp 42 | 43 | $(APR)/aprlib.imp : make_nw_export.awk nw_export.i 44 | @echo $(DL)GEN $@$(DL) 45 | $(AWK) -v EXPPREFIX=APR$(VERSION_MAJMIN) -f $^ >$@ 46 | 47 | nw_export.i : nw_export.h $(FILES_prebuild_headers) $(CCOPT_DEPENDS) 48 | @echo $(DL)GEN $@$(DL) 49 | $(CPRE) $(CCFLAGS) -DGENEXPORTS $< -o $@ 50 | 51 | %.h: %.hnw 52 | @echo Creating $@ 53 | $(call COPY,$<,$@) 54 | 55 | %.h: %.hw 56 | @echo Creating $@ 57 | $(call COPY,$<,$@) 58 | 59 | $(APR)/include/private/apr_escape_test_char.h: gen_test_char.exe $(APR)/tools/gen_test_char.c 60 | @echo $(DL)GEN $@$(DL) 61 | $< > $@ 62 | 63 | %.exe: $(APR)/tools/%.c 64 | @echo $(DL)Creating Build Helper $@$(DL) 65 | $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -DCROSS_COMPILE $< -o $@ 66 | 67 | # 68 | # You can use this target if all that is needed is to copy files to the 69 | # installation area 70 | # 71 | install :: nlms FORCE 72 | 73 | 74 | clean :: 75 | $(call DEL,nw_export.i) 76 | $(call DEL,cc.opt) 77 | $(call DEL,NWGNUversion.inc) 78 | $(call DEL,$(APR)/aprlib.imp) 79 | $(foreach file,$(FILES_prebuild_headers),$(call DEL,$(file))) 80 | $(call DEL,gen_test_char.exe) 81 | 82 | # 83 | # Include the 'tail' makefile that has targets that depend on variables defined 84 | # in this makefile 85 | # 86 | 87 | include $(APRBUILD)/NWGNUtail.inc 88 | 89 | 90 | -------------------------------------------------------------------------------- /build/__init__.py: -------------------------------------------------------------------------------- 1 | from aprenv import * 2 | -------------------------------------------------------------------------------- /build/apr_win32.m4: -------------------------------------------------------------------------------- 1 | 2 | dnl if $2 contains '@dd', links against mingw symbols 3 | dnl otherwise calls AC_CHECK_LIB 4 | AC_DEFUN([APR_CHECK_DLL_FUNC],[ 5 | m4_define($1_function_name,m4_substr($2,0,m4_index($2,[@]))) 6 | m4_define($1_function_arglength,m4_substr($2,m4_incr(m4_index($2,[@])))) 7 | m4_define($1_[function_name]_arglength,m4_substr($2,m4_incr(m4_index($2,[@])))) 8 | dnl m4_define(apr_check_dll_id,$1_m4_defn($1_function_name)) 9 | 10 | AC_CACHE_CHECK([for $2 in $1],[ac_cv_lib_$1_]$1_function_name,[ 11 | 12 | ac_func_search_save_LIBS=$LIBS 13 | LIBS="$LIBS -l$1" 14 | 15 | AC_TRY_LINK([ 16 | #pragma pack(1) 17 | struct x { 18 | ]m4_for([byte_id], 1, m4_defn([$1_function_name_arglength]), 1,[[ char c]]byte_id; 19 | )[}; 20 | __stdcall ]$1_function_name[(]struct x[);],[ 21 | struct x s = {0}; 22 | ]$1_function_name[(s)], 23 | [ac_cv_lib_$1_]$1_function_name[=yes],[ac_cv_lib_$1_]$1_function_name[=no]) 24 | LIBS=$ac_func_search_save_LIBS 25 | ])dnl AC_CACHE_CHECK 26 | 27 | AS_IF([test $ac_cv_lib_$1_]$1_function_name[ = yes], 28 | [m4_default([$3], [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIB$1),,Enable if this library is available) 29 | LIBS="-l$1 $LIBS" 30 | ])], 31 | [$4])dnl 32 | ]) 33 | 34 | -------------------------------------------------------------------------------- /build/apu-hints.m4: -------------------------------------------------------------------------------- 1 | dnl -------------------------------------------------------- -*- autoconf -*- 2 | dnl Licensed to the Apache Software Foundation (ASF) under one or more 3 | dnl contributor license agreements. See the NOTICE file distributed with 4 | dnl this work for additional information regarding copyright ownership. 5 | dnl The ASF licenses this file to You under the Apache License, Version 2.0 6 | dnl (the "License"); you may not use this file except in compliance with 7 | dnl the License. You may obtain a copy of the License at 8 | dnl 9 | dnl http://www.apache.org/licenses/LICENSE-2.0 10 | dnl 11 | dnl Unless required by applicable law or agreed to in writing, software 12 | dnl distributed under the License is distributed on an "AS IS" BASIS, 13 | dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | dnl See the License for the specific language governing permissions and 15 | dnl limitations under the License. 16 | 17 | dnl ----------------------------------------------------------------- 18 | dnl apu-hints.m4: apr-util's autoconf macros for platform-specific hints 19 | dnl 20 | dnl We preload various configure settings depending 21 | dnl on previously obtained platform knowledge. 22 | dnl We allow all settings to be overridden from 23 | dnl the command-line. 24 | 25 | dnl 26 | dnl APU_PRELOAD 27 | dnl 28 | dnl Preload various build parameters based on outside knowledge. 29 | dnl 30 | AC_DEFUN([APU_PRELOAD], [ 31 | if test "x$apu_preload_done" != "xyes" ; then 32 | apu_preload_done="yes" 33 | 34 | echo "Applying apr-util hints file rules for $host" 35 | 36 | case "$host" in 37 | *-dec-osf*) 38 | APR_SETIFNULL(apu_crypt_threadsafe, [1]) 39 | ;; 40 | *-hp-hpux11.*) 41 | APR_SETIFNULL(apu_crypt_threadsafe, [1]) 42 | ;; 43 | *-ibm-aix4*|*-ibm-aix5.1*) 44 | APR_SETIFNULL(apu_iconv_inbuf_const, [1]) 45 | ;; 46 | *-ibm-os390) 47 | APR_SETIFNULL(apu_crypt_threadsafe, [1]) 48 | ;; 49 | *-solaris2*) 50 | APR_SETIFNULL(apu_iconv_inbuf_const, [1]) 51 | APR_SETIFNULL(apu_crypt_threadsafe, [1]) 52 | AC_SEARCH_LIBS(fdatasync, [rt posix4]) 53 | ;; 54 | *-sco3.2v5*) 55 | APR_SETIFNULL(apu_db_xtra_libs, [-lsocket]) 56 | ;; 57 | esac 58 | 59 | fi 60 | ]) 61 | 62 | 63 | -------------------------------------------------------------------------------- /build/get-version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # extract version numbers from a header file 4 | # 5 | # USAGE: get-version.sh CMD VERSION_HEADER PREFIX 6 | # where CMD is one of: all, major, libtool 7 | # where PREFIX is the prefix to {MAJOR|MINOR|PATCH}_VERSION defines 8 | # 9 | # get-version.sh all returns a dotted version number 10 | # get-version.sh major returns just the major version number 11 | # get-version.sh libtool returns a version "libtool -version-info" format 12 | # 13 | 14 | if test $# != 3; then 15 | echo "USAGE: $0 CMD VERSION_HEADER PREFIX" 16 | echo " where CMD is one of: all, major, libtool" 17 | exit 1 18 | fi 19 | 20 | major_sed="/#define.*$3_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p" 21 | minor_sed="/#define.*$3_MINOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p" 22 | patch_sed="/#define.*$3_PATCH_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p" 23 | major="`sed -n $major_sed $2`" 24 | minor="`sed -n $minor_sed $2`" 25 | patch="`sed -n $patch_sed $2`" 26 | 27 | if test "$1" = "all"; then 28 | echo ${major}.${minor}.${patch} 29 | elif test "$1" = "major"; then 30 | echo ${major} 31 | elif test "$1" = "libtool"; then 32 | # Yes, ${minor}:${patch}:${minor} is correct due to libtool idiocy. 33 | echo ${minor}:${patch}:${minor} 34 | else 35 | echo "ERROR: unknown version CMD ($1)" 36 | exit 1 37 | fi 38 | -------------------------------------------------------------------------------- /build/make_var_export.awk: -------------------------------------------------------------------------------- 1 | # Based on apr's make_export.awk, which is 2 | # based on Ryan Bloom's make_export.pl 3 | 4 | /^#[ \t]*if(def)? (AP[RUI]?_|!?defined).*/ { 5 | if (old_filename != FILENAME) { 6 | if (old_filename != "") printf("%s", line) 7 | macro_no = 0 8 | found = 0 9 | count = 0 10 | old_filename = FILENAME 11 | line = "" 12 | } 13 | macro_stack[macro_no++] = macro 14 | macro = substr($0, length($1)+2) 15 | count++ 16 | line = line "#ifdef " macro "\n" 17 | next 18 | } 19 | 20 | /^#[ \t]*endif/ { 21 | if (count > 0) { 22 | count-- 23 | line = line "#endif /* " macro " */\n" 24 | macro = macro_stack[--macro_no] 25 | } 26 | if (count == 0) { 27 | if (found != 0) { 28 | printf("%s", line) 29 | } 30 | line = "" 31 | } 32 | next 33 | } 34 | 35 | function add_symbol (sym_name) { 36 | if (count) { 37 | found++ 38 | } 39 | for (i = 0; i < count; i++) { 40 | line = line "\t" 41 | } 42 | line = line sym_name "\n" 43 | 44 | if (count == 0) { 45 | printf("%s", line) 46 | line = "" 47 | } 48 | } 49 | 50 | /^[ \t]*(extern[ \t]+)?AP[RUI]?_DECLARE_DATA .*;$/ { 51 | varname = $NF; 52 | gsub( /[*;]/, "", varname); 53 | gsub( /\[.*\]/, "", varname); 54 | add_symbol(varname); 55 | } 56 | 57 | END { 58 | printf("%s", line) 59 | } 60 | -------------------------------------------------------------------------------- /build/mkdir.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ## 3 | ## mkdir.sh -- make directory hierarchy 4 | ## 5 | ## Based on `mkinstalldirs' from Noah Friedman 6 | ## as of 1994-03-25, which was placed in the Public Domain. 7 | ## Cleaned up for Apache's Autoconf-style Interface (APACI) 8 | ## by Ralf S. Engelschall 9 | ## 10 | # 11 | # This script falls under the Apache License. 12 | # See http://www.apache.org/docs/LICENSE 13 | 14 | 15 | umask 022 16 | errstatus=0 17 | for file in ${1+"$@"} ; do 18 | set fnord `echo ":$file" |\ 19 | sed -e 's/^:\//%/' -e 's/^://' -e 's/\// /g' -e 's/^%/\//'` 20 | shift 21 | pathcomp= 22 | for d in ${1+"$@"}; do 23 | pathcomp="$pathcomp$d" 24 | case "$pathcomp" in 25 | -* ) pathcomp=./$pathcomp ;; 26 | ?: ) pathcomp="$pathcomp/" 27 | continue ;; 28 | esac 29 | if test ! -d "$pathcomp"; then 30 | thiserrstatus=0 31 | mkdir "$pathcomp" || thiserrstatus=$? 32 | # ignore errors due to races if a parallel mkdir.sh already 33 | # created the dir 34 | if test $thiserrstatus != 0 && test ! -d "$pathcomp" ; then 35 | errstatus=$thiserrstatus 36 | fi 37 | fi 38 | pathcomp="$pathcomp/" 39 | done 40 | done 41 | exit $errstatus 42 | 43 | -------------------------------------------------------------------------------- /build/nw_export.h: -------------------------------------------------------------------------------- 1 | /* Must include apr.h / apu.h first so that we can undefine 2 | ** the standard prototypes macros after it messes with them. 3 | */ 4 | #include "apr.h" 5 | 6 | #undef APR_DECLARE 7 | #undef APR_DECLARE_NONSTD 8 | #undef APR_DECLARE_HOOK 9 | #undef APR_POOL_DECLARE_ACCESSOR 10 | #undef APR_DECLARE_DATA 11 | 12 | /* Preprocess all of the standard APR headers. */ 13 | #include "apr_allocator.h" 14 | #include "apr_anylock.h" 15 | #include "apr_atomic.h" 16 | #include "apr_base64.h" 17 | #include "apr_buckets.h" 18 | #include "apr_date.h" 19 | #include "apr_dbd.h" 20 | #include "apr_dbm.h" 21 | #include "apr_dbm_private.h" 22 | #include "apr_dso.h" 23 | #include "apr_env.h" 24 | #include "apr_errno.h" 25 | #include "apr_escape.h" 26 | #include "apr_file_info.h" 27 | #include "apr_file_io.h" 28 | #include "apr_fnmatch.h" 29 | #include "apr_general.h" 30 | #include "apr_getopt.h" 31 | #include "apr_global_mutex.h" 32 | #include "apr_hash.h" 33 | #include "apr_hooks.h" 34 | #include "apr_inherit.h" 35 | #include "apr_lib.h" 36 | #include "apr_md4.h" 37 | #include "apr_md5.h" 38 | #include "apr_memcache.h" 39 | #include "apr_mmap.h" 40 | #include "apr_network_io.h" 41 | #include "apr_optional.h" 42 | #include "apr_optional_hooks.h" 43 | #include "apr_poll.h" 44 | #include "apr_pools.h" 45 | #include "apr_portable.h" 46 | #include "apr_proc_mutex.h" 47 | #include "apr_queue.h" 48 | #include "apr_random.h" 49 | #include "apr_reslist.h" 50 | #include "apr_ring.h" 51 | #include "apr_rmm.h" 52 | #include "apr_sdbm.h" 53 | #include "apr_sha1.h" 54 | #include "apr_shm.h" 55 | #include "apr_signal.h" 56 | #include "apr_siphash.h" 57 | #include "apr_skiplist.h" 58 | #include "apr_strings.h" 59 | #include "apr_strmatch.h" 60 | #include "apr_support.h" 61 | #include "apr_tables.h" 62 | #include "apr_thread_cond.h" 63 | #include "apr_thread_mutex.h" 64 | #include "apr_thread_pool.h" 65 | #include "apr_thread_proc.h" 66 | #include "apr_thread_rwlock.h" 67 | #include "apr_time.h" 68 | #include "apr_uri.h" 69 | #include "apr_user.h" 70 | #include "apr_uuid.h" 71 | #include "apr_version.h" 72 | #include "apr_want.h" 73 | #include "apr_xlate.h" 74 | #include "apr_xml.h" 75 | #include "apu_want.h" 76 | -------------------------------------------------------------------------------- /build/pkg/README: -------------------------------------------------------------------------------- 1 | The script in this directory will attempt to build a Solaris package 2 | out of a source tree for APR. 3 | 4 | To build a package, make sure you are in the root of the source tree, 5 | and run: 6 | 7 | build/pkg/buildpkg.sh 8 | 9 | A Solaris package called apr---local.gz will be 10 | created in the root of the source tree. 11 | 12 | By default, if you attempt to build packages for apr-util, it will 13 | search for the sources for apr in: 14 | 15 | ../apr 16 | 17 | You may override the location of apr like so: 18 | 19 | build/pkg/buildpkg.sh --with-apr=some/other/path 20 | 21 | -------------------------------------------------------------------------------- /build/pkg/buildpkg.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Licensed to the Apache Software Foundation (ASF) under one or more 3 | # contributor license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright ownership. 5 | # The ASF licenses this file to You under the Apache License, Version 2.0 6 | # (the "License"); you may not use this file except in compliance with 7 | # the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | # 18 | 19 | # buildpkg.sh: This script builds a Solaris PKG from the source tree 20 | # provided. 21 | 22 | PREFIX=/usr/local 23 | TEMPDIR=/var/tmp/$USER/apr-root 24 | rm -rf $TEMPDIR 25 | 26 | apr_src_dir=. 27 | 28 | while test $# -gt 0 29 | do 30 | # Normalize 31 | case "$1" in 32 | -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; 33 | *) optarg= ;; 34 | esac 35 | 36 | case "$1" in 37 | --with-apr=*) 38 | apr_src_dir=$optarg 39 | ;; 40 | esac 41 | 42 | shift 43 | done 44 | 45 | if [ -f "$apr_src_dir/configure.in" ]; then 46 | cd $apr_src_dir 47 | else 48 | echo "The apr source could not be found within $apr_src_dir" 49 | echo "Usage: buildpkg [--with-apr=dir]" 50 | exit 1 51 | fi 52 | 53 | ./configure --prefix=$PREFIX 54 | make 55 | make install DESTDIR=$TEMPDIR 56 | rm $TEMPDIR$PREFIX/lib/apr.exp 57 | . build/pkg/pkginfo 58 | cp build/pkg/pkginfo $TEMPDIR$PREFIX 59 | 60 | current=`pwd` 61 | cd $TEMPDIR$PREFIX 62 | echo "i pkginfo=./pkginfo" > prototype 63 | find . -print | grep -v ./prototype | grep -v ./pkginfo | pkgproto | awk '{print $1" "$2" "$3" "$4" root bin"}' >> prototype 64 | mkdir $TEMPDIR/pkg 65 | pkgmk -r $TEMPDIR$PREFIX -d $TEMPDIR/pkg 66 | 67 | cd $current 68 | pkgtrans -s $TEMPDIR/pkg $current/$NAME-$VERSION-$ARCH-local 69 | gzip $current/$NAME-$VERSION-$ARCH-local 70 | 71 | rm -rf $TEMPDIR 72 | 73 | -------------------------------------------------------------------------------- /build/pkg/pkginfo.in: -------------------------------------------------------------------------------- 1 | PKG="ASFapr-1" 2 | NAME="apr" 3 | ARCH="@target_cpu@" 4 | VERSION="@APR_DOTTED_VERSION@" 5 | CATEGORY="application" 6 | VENDOR="Apache Software Foundation" 7 | EMAIL="dev@apr.apache.org" 8 | PSTAMP="dev@apr.apache.org" 9 | BASEDIR="@prefix@" 10 | CLASSES="none" 11 | 12 | -------------------------------------------------------------------------------- /build/vcpkg/apr-2/portfile.cmake: -------------------------------------------------------------------------------- 1 | set(VERSION 2.0.0) 2 | # 3 | # Modify REF to latest commit id from https://github.com/apache/apr 4 | # Update SHA512 with actual SHA512 5 | # 6 | vcpkg_from_github( 7 | OUT_SOURCE_PATH SOURCE_PATH 8 | REPO apache/apr 9 | REF 6445e8804008922f8018aa238aa4d6bba608c49a 10 | SHA512 0 11 | HEAD_REF trunk 12 | ) 13 | 14 | if (VCPKG_TARGET_IS_WINDOWS) 15 | vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS 16 | FEATURES 17 | private-headers INSTALL_PRIVATE_H 18 | crypto FEATURE_CRYPTO 19 | xlate FEATURE_XLATE 20 | dbd-odbc FEATURE_DBD_ODBC 21 | dbd-sqlite3 FEATURE_DBD_SQLITE3 22 | dbd-postgresql FEATURE_DBD_PGQL 23 | ldap FEATURE_LDAP 24 | ) 25 | 26 | vcpkg_cmake_configure( 27 | SOURCE_PATH "${SOURCE_PATH}" 28 | OPTIONS 29 | -DAPR_BUILD_TESTAPR=OFF 30 | -DINSTALL_PDB=OFF 31 | -DAPU_HAVE_CRYPTO=${FEATURE_CRYPTO} 32 | -DAPU_HAVE_ICONV=${FEATURE_XLATE} 33 | -DAPU_HAVE_ODBC=${FEATURE_DBD_ODBC} 34 | -DAPU_HAVE_SQLITE3=${FEATURE_DBD_SQLITE3} 35 | -DAPU_HAVE_PGSQL=${FEATURE_DBD_PGQL} 36 | -DAPR_HAS_LDAP=${FEATURE_LDAP} 37 | -DAPU_USE_EXPAT=${APU_USE_EXPAT} 38 | -DAPR_INSTALL_PRIVATE_H=${INSTALL_PRIVATE_H} 39 | ) 40 | 41 | vcpkg_cmake_install() 42 | vcpkg_copy_pdbs() 43 | vcpkg_cmake_config_fixup(PACKAGE_NAME "apr" 44 | CONFIG_PATH "lib/cmake/apr") 45 | 46 | file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") 47 | else() 48 | # In development 49 | endif() 50 | 51 | file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") 52 | 53 | # Handle copyright 54 | file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) 55 | 56 | -------------------------------------------------------------------------------- /build/vcpkg/apr-2/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "apr-2", 3 | "version": "2.0.0", 4 | "port-version": 5, 5 | "description": "The Apache Portable Runtime (APR) is a C library that forms a system portability layer that covers many operating systems.", 6 | "homepage": "https://apr.apache.org/", 7 | "license": "Apache-2.0", 8 | "supports": "!uwp", 9 | "dependencies": [ 10 | "expat", 11 | { 12 | "name": "vcpkg-cmake", 13 | "host": true, 14 | "platform": "windows" 15 | }, 16 | { 17 | "name": "vcpkg-cmake-config", 18 | "host": true, 19 | "platform": "windows" 20 | } 21 | ], 22 | "features": { 23 | "crypto": { 24 | "description": "Crypto support", 25 | "dependencies": [ 26 | { 27 | "name": "openssl", 28 | "default-features": false, 29 | "features": [] 30 | } 31 | ] 32 | }, 33 | "dbd-odbc": { 34 | "description": "Build ODBC DBD driver" 35 | }, 36 | "dbd-sqlite3": { 37 | "description": "Build SQLite3 DBD driver", 38 | "dependencies": [ 39 | "sqlite3" 40 | ] 41 | }, 42 | "dbd-postgresql": { 43 | "description": "Build PostgreSQL DBD driver", 44 | "dependencies": [ 45 | { 46 | "name": "libpq", 47 | "default-features": false, 48 | "features": [] 49 | } 50 | ] 51 | }, 52 | "ldap": { 53 | "description": "LDAP support" 54 | }, 55 | "private-headers": { 56 | "description": "Install non-standard files required for building Apache httpd" 57 | }, 58 | "xlate": { 59 | "description": "Xlate support", 60 | "dependencies": [ 61 | "libiconv" 62 | ] 63 | } 64 | }, 65 | "default-features": [] 66 | } 67 | -------------------------------------------------------------------------------- /crypto/crypt_blowfish.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Written by Solar Designer in 2000-2011. 3 | * No copyright is claimed, and the software is hereby placed in the public 4 | * domain. In case this attempt to disclaim copyright and place the software 5 | * in the public domain is deemed null and void, then the software is 6 | * Copyright (c) 2000-2011 Solar Designer and it is hereby released to the 7 | * general public under the following terms: 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted. 11 | * 12 | * There's ABSOLUTELY NO WARRANTY, express or implied. 13 | * 14 | * See crypt_blowfish.c for more information. 15 | */ 16 | 17 | #ifndef _CRYPT_BLOWFISH_H 18 | #define _CRYPT_BLOWFISH_H 19 | 20 | #include "apr.h" /* for apr_size_t */ 21 | 22 | extern int _crypt_output_magic(const char *setting, char *output, apr_size_t size); 23 | extern char *_crypt_blowfish_rn(const char *key, const char *setting, 24 | char *output, apr_size_t size); 25 | extern char *_crypt_gensalt_blowfish_rn(const char *prefix, unsigned long count, 26 | const char *input, apr_size_t size, 27 | char *output, apr_size_t output_size); 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /dbm/sdbm/sdbm_hash.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * sdbm - ndbm work-alike hashed database library 19 | * based on Per-Aake Larson's Dynamic Hashing algorithms. BIT 18 (1978). 20 | * author: oz@nexus.yorku.ca 21 | * status: ex-public domain. keep it that way. 22 | * 23 | * hashing routine 24 | */ 25 | 26 | #include "apr_sdbm.h" 27 | #include "sdbm_private.h" 28 | 29 | /* 30 | * polynomial conversion ignoring overflows 31 | * [this seems to work remarkably well, in fact better 32 | * then the ndbm hash function. Replace at your own risk] 33 | * use: 65599 nice. 34 | * 65587 even better. 35 | */ 36 | long sdbm_hash(const char *str, int len) 37 | { 38 | register unsigned long n = 0; 39 | 40 | #define DUFF /* go ahead and use the loop-unrolled version */ 41 | #ifdef DUFF 42 | 43 | #define HASHC n = *str++ + 65599 * n 44 | 45 | if (len > 0) { 46 | register int loop = (len + 8 - 1) >> 3; 47 | 48 | switch(len & (8 - 1)) { 49 | case 0: do { 50 | HASHC; case 7: HASHC; 51 | case 6: HASHC; case 5: HASHC; 52 | case 4: HASHC; case 3: HASHC; 53 | case 2: HASHC; case 1: HASHC; 54 | } while (--loop); 55 | } 56 | 57 | } 58 | #else 59 | while (len--) 60 | n = *str++ + 65599 * n; 61 | #endif 62 | return n; 63 | } 64 | -------------------------------------------------------------------------------- /dbm/sdbm/sdbm_pair.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef SDBM_PAIR_H 18 | #define SDBM_PAIR_H 19 | 20 | /* Mini EMBED (pair.c) */ 21 | #define chkpage apu__sdbm_chkpage 22 | #define delpair apu__sdbm_delpair 23 | #define duppair apu__sdbm_duppair 24 | #define fitpair apu__sdbm_fitpair 25 | #define getnkey apu__sdbm_getnkey 26 | #define getpair apu__sdbm_getpair 27 | #define putpair apu__sdbm_putpair 28 | #define splpage apu__sdbm_splpage 29 | 30 | int fitpair(char *, int); 31 | void putpair(char *, apr_sdbm_datum_t, apr_sdbm_datum_t); 32 | apr_sdbm_datum_t getpair(char *, apr_sdbm_datum_t); 33 | int delpair(char *, apr_sdbm_datum_t); 34 | int chkpage (char *); 35 | apr_sdbm_datum_t getnkey(char *, int); 36 | void splpage(char *, char *, long); 37 | int duppair(char *, apr_sdbm_datum_t); 38 | 39 | #endif /* SDBM_PAIR_H */ 40 | 41 | -------------------------------------------------------------------------------- /dbm/sdbm/sdbm_tune.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* 18 | * sdbm - ndbm work-alike hashed database library 19 | * tuning and portability constructs [not nearly enough] 20 | * author: oz@nexus.yorku.ca 21 | */ 22 | 23 | #ifndef SDBM_TUNE_H 24 | #define SDBM_TUNE_H 25 | 26 | #include "apr_errno.h" 27 | 28 | /* ### this might be better off as sizeof(char *) */ 29 | #define BYTESIZ 8 30 | 31 | /* 32 | * misc 33 | */ 34 | #ifdef DEBUG 35 | #define debug(x) printf x 36 | #else 37 | #define debug(x) 38 | #endif 39 | 40 | #endif /* SDBM_TUNE_H */ 41 | -------------------------------------------------------------------------------- /docs/doxygen.conf: -------------------------------------------------------------------------------- 1 | PROJECT_NAME="Apache Portable Runtime" 2 | 3 | INPUT=. 4 | QUIET=YES 5 | RECURSIVE=YES 6 | FILE_PATTERNS=*.h 7 | 8 | OUTPUT_DIRECTORY=docs/dox 9 | 10 | MACRO_EXPANSION=YES 11 | EXPAND_ONLY_PREDEF=YES 12 | #EXPAND_AS_DEFINED= 13 | # not sure why this doesn't work as EXPAND_AS_DEFINED, it should! 14 | PREDEFINED="APR_DECLARE(x)=x" \ 15 | "APR_DECLARE_NONSTD(x)=x" \ 16 | "APR_DECLARE_LDAP(x)=x" \ 17 | "APR_DECLARE_DATA" \ 18 | "APR_POOL_DECLARE_ACCESSOR(x)=apr_pool_t* apr_##x##_pool_get (const apr_##x##_t *the##x)" \ 19 | "APR_DECLARE_INHERIT_SET(x)=apr_status_t apr_##x##_inherit_set(apr_##x##_t *the##x)" \ 20 | "APR_DECLARE_INHERIT_UNSET(x)=apr_status_t apr_##x##_inherit_unset(apr_##x##_t *the##x)" \ 21 | "APU_DECLARE_LDAP(x)=x" \ 22 | "APR_HAS_THREADS" \ 23 | "APR_HAS_MMAP" \ 24 | "APR_HAS_XLATE" \ 25 | "APR_MODULE_DECLARE_DATA" \ 26 | "__attribute__(x)=" \ 27 | DOXYGEN= 28 | 29 | OPTIMIZE_OUTPUT_FOR_C=YES 30 | STRIP_CODE_COMMENTS=NO 31 | 32 | FULL_PATH_NAMES=NO 33 | CASE_SENSE_NAMES=NO 34 | # some autoconf guru needs to make configure set this correctly... 35 | # in the meantime, simply listing the headers should be alright 36 | #STRIP_FROM_PATH=/buildpath/apr 37 | 38 | EXCLUDE_PATTERNS="*/acconfig.h" \ 39 | "*/test/*" \ 40 | "*/arch/*" 41 | 42 | GENERATE_TAGFILE=docs/dox/apr.tag 43 | 44 | -------------------------------------------------------------------------------- /docs/non_apr_programs: -------------------------------------------------------------------------------- 1 | How do I use APR'ized programs in connection with programs that don't 2 | use APR? These darn incomplete types don't let me fill out the APR types. 3 | 4 | The APR developers acknowledge that most programs are not using APR, and 5 | we don't expect them to migrate to using APR just because APR has been 6 | released. So, we have provided a way for non-APR'ized programs to interact 7 | very cleanly with APR. 8 | 9 | There are a set of functions, all documented in apr_portable.h, which allow 10 | a programmer to either get a native type from an APR type, or to setup an 11 | APR type from a native type. 12 | 13 | For example, if you are writing an add-on to another program that does not use 14 | APR for file I/O, but you (in your infinite wisdom) want to use APR to make 15 | sure your section is portable. Assume the program provides a type foo_t with 16 | a file descriptor in it (fd). 17 | 18 | void function_using_apr(foo_t non_apr_struct, ap_pool_t *p) 19 | { 20 | ap_file_t *apr_file = NULL; 21 | 22 | ap_put_os_file(&apr_file, &non_apr_struct->fd, p); 23 | 24 | ... 25 | } 26 | 27 | There are portable functions for each APR incomplete type. They are all 28 | called ap_put_os_foobar(), and they each take the same basic arguments, a 29 | pointer to a pointer to the incomplete type (the last pointer in that list 30 | should be NULL), a pointer to the native type, and a pool. Each of these can 31 | be found in apr_portable.h. 32 | 33 | If you have to do the exact opposite (take an APR type and convert it to a 34 | native type, there are functions for that too. For example: 35 | 36 | void function_not_using_apr(apr_file_t *apr_file) 37 | { 38 | int unix_file_desc; 39 | 40 | ap_get_os_file(&unix_file_desc, apr_file); 41 | 42 | ... 43 | } 44 | 45 | For each ap_put_os_foobar, there is a corresponding ap_get_os_file. These are 46 | also documented in apr_portable.h. 47 | 48 | -------------------------------------------------------------------------------- /emacs-mode: -------------------------------------------------------------------------------- 1 | ;; M-x load-file 2 | ;; or emacs -l 3 | ;; to use this style: C-c . apache 4 | (c-add-style "apache" 5 | '((inclass . ++) 6 | (defun-block-intro . ++) 7 | (statement-block-intro . ++) 8 | (substatement . ++) 9 | (brace-list-intro . ++) 10 | (statement-case-intro . ++) 11 | (inextern-lang . 0) 12 | )) 13 | (setq-default indent-tabs-mode nil) 14 | ;; if you forgot to do this at startup, then M-x eval-expression 15 | ;; (setq indent-tabs-mode nil) on each buffer 16 | -------------------------------------------------------------------------------- /file_io/netware/flock.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include "apr_arch_file_io.h" 19 | 20 | 21 | apr_status_t apr_file_lock(apr_file_t *thefile, int type) 22 | { 23 | int fc; 24 | 25 | fc = (type & APR_FLOCK_NONBLOCK) ? NX_RANGE_LOCK_TRYLOCK : NX_RANGE_LOCK_CHECK; 26 | 27 | if(NXFileRangeLock(thefile->filedes,fc, 0, 0) == -1) 28 | return errno; 29 | 30 | return APR_SUCCESS; 31 | } 32 | 33 | apr_status_t apr_file_unlock(apr_file_t *thefile) 34 | { 35 | if(NXFileRangeUnlock(thefile->filedes,NX_RANGE_LOCK_CANCEL,0 , 0) == -1) 36 | return errno; 37 | 38 | return APR_SUCCESS; 39 | } 40 | -------------------------------------------------------------------------------- /file_io/os2/copy.c: -------------------------------------------------------------------------------- 1 | #include "../unix/copy.c" 2 | -------------------------------------------------------------------------------- /file_io/os2/fileacc.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "../unix/fileacc.c" 18 | 19 | -------------------------------------------------------------------------------- /file_io/os2/filepath.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "../win32/filepath.c" 17 | -------------------------------------------------------------------------------- /file_io/os2/filepath_util.c: -------------------------------------------------------------------------------- 1 | #include "../unix/filepath_util.c" 2 | -------------------------------------------------------------------------------- /file_io/os2/flock.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apr_arch_file_io.h" 18 | 19 | APR_DECLARE(apr_status_t) apr_file_lock(apr_file_t *thefile, int type) 20 | { 21 | FILELOCK lockrange = { 0, 0x7fffffff }; 22 | ULONG rc; 23 | 24 | rc = DosSetFileLocks(thefile->filedes, NULL, &lockrange, 25 | (type & APR_FLOCK_NONBLOCK) ? 0 : (ULONG)-1, 26 | (type & APR_FLOCK_TYPEMASK) == APR_FLOCK_SHARED); 27 | return APR_FROM_OS_ERROR(rc); 28 | } 29 | 30 | APR_DECLARE(apr_status_t) apr_file_unlock(apr_file_t *thefile) 31 | { 32 | FILELOCK unlockrange = { 0, 0x7fffffff }; 33 | ULONG rc; 34 | 35 | rc = DosSetFileLocks(thefile->filedes, &unlockrange, NULL, 0, 0); 36 | return APR_FROM_OS_ERROR(rc); 37 | } 38 | -------------------------------------------------------------------------------- /file_io/os2/fullrw.c: -------------------------------------------------------------------------------- 1 | #include "../unix/fullrw.c" 2 | -------------------------------------------------------------------------------- /file_io/os2/link.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apr_arch_file_io.h" 18 | 19 | APR_DECLARE(apr_status_t) apr_file_link(const char *from_path, const char *to_path) 20 | { 21 | /* OS/2 doesn't support links */ 22 | return APR_ENOTIMPL; 23 | } 24 | -------------------------------------------------------------------------------- /file_io/os2/mktemp.c: -------------------------------------------------------------------------------- 1 | #include "../unix/mktemp.c" 2 | -------------------------------------------------------------------------------- /file_io/os2/printf.c: -------------------------------------------------------------------------------- 1 | #include "../unix/printf.c" 2 | -------------------------------------------------------------------------------- /file_io/os2/tempdir.c: -------------------------------------------------------------------------------- 1 | #include "../unix/tempdir.c" 2 | -------------------------------------------------------------------------------- /file_io/unix/buffer.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apr_arch_file_io.h" 18 | #include "apr_pools.h" 19 | #include "apr_thread_mutex.h" 20 | 21 | APR_DECLARE(apr_status_t) apr_file_buffer_set(apr_file_t *file, 22 | char * buffer, 23 | apr_size_t bufsize) 24 | { 25 | apr_status_t rv; 26 | 27 | file_lock(file); 28 | 29 | if(file->buffered) { 30 | /* Flush the existing buffer */ 31 | rv = apr_file_flush_locked(file); 32 | if (rv != APR_SUCCESS) { 33 | file_unlock(file); 34 | return rv; 35 | } 36 | } 37 | 38 | file->buffer = buffer; 39 | file->bufsize = bufsize; 40 | file->buffered = 1; 41 | file->bufpos = 0; 42 | file->direction = 0; 43 | file->dataRead = 0; 44 | 45 | if (file->bufsize == 0) { 46 | /* Setting the buffer size to zero is equivalent to turning 47 | * buffering off. 48 | */ 49 | file->buffered = 0; 50 | } 51 | 52 | file_unlock(file); 53 | 54 | return APR_SUCCESS; 55 | } 56 | 57 | APR_DECLARE(apr_size_t) apr_file_buffer_size_get(apr_file_t *file) 58 | { 59 | return file->bufsize; 60 | } 61 | -------------------------------------------------------------------------------- /file_io/unix/printf.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apr_file_io.h" 18 | #include "apr_strings.h" 19 | #include "apr_lib.h" 20 | 21 | #if APR_HAVE_STDLIB_H 22 | #include 23 | #endif 24 | 25 | struct apr_file_printf_data { 26 | apr_vformatter_buff_t vbuff; 27 | apr_file_t *fptr; 28 | char *buf; 29 | }; 30 | 31 | static int file_printf_flush(apr_vformatter_buff_t *buff) 32 | { 33 | struct apr_file_printf_data *data = (struct apr_file_printf_data *)buff; 34 | 35 | if (apr_file_write_full(data->fptr, data->buf, 36 | data->vbuff.curpos - data->buf, NULL)) { 37 | return -1; 38 | } 39 | 40 | data->vbuff.curpos = data->buf; 41 | return 0; 42 | } 43 | 44 | APR_DECLARE_NONSTD(int) apr_file_printf(apr_file_t *fptr, 45 | const char *format, ...) 46 | { 47 | struct apr_file_printf_data data; 48 | va_list ap; 49 | int count; 50 | 51 | /* don't really need a HUGE_STRING_LEN anymore */ 52 | data.buf = malloc(HUGE_STRING_LEN); 53 | if (data.buf == NULL) { 54 | return -1; 55 | } 56 | data.vbuff.curpos = data.buf; 57 | data.vbuff.endpos = data.buf + HUGE_STRING_LEN; 58 | data.fptr = fptr; 59 | va_start(ap, format); 60 | count = apr_vformatter(file_printf_flush, 61 | (apr_vformatter_buff_t *)&data, format, ap); 62 | /* apr_vformatter does not call flush for the last bits */ 63 | if (count >= 0) file_printf_flush((apr_vformatter_buff_t *)&data); 64 | 65 | va_end(ap); 66 | 67 | free(data.buf); 68 | 69 | return count; 70 | } 71 | -------------------------------------------------------------------------------- /file_io/win32/buffer.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apr_arch_file_io.h" 18 | #include "apr_thread_mutex.h" 19 | 20 | APR_DECLARE(apr_status_t) apr_file_buffer_set(apr_file_t *file, 21 | char * buffer, 22 | apr_size_t bufsize) 23 | { 24 | apr_status_t rv; 25 | 26 | if (file->flags & APR_FOPEN_XTHREAD) { 27 | apr_thread_mutex_lock(file->mutex); 28 | } 29 | 30 | if(file->buffered) { 31 | /* Flush the existing buffer */ 32 | rv = apr_file_flush(file); 33 | if (rv != APR_SUCCESS) { 34 | if (file->flags & APR_FOPEN_XTHREAD) { 35 | apr_thread_mutex_unlock(file->mutex); 36 | } 37 | return rv; 38 | } 39 | } 40 | 41 | file->buffer = buffer; 42 | file->bufsize = bufsize; 43 | file->buffered = 1; 44 | file->bufpos = 0; 45 | file->direction = 0; 46 | file->dataRead = 0; 47 | 48 | if (file->bufsize == 0) { 49 | /* Setting the buffer size to zero is equivalent to turning 50 | * buffering off. 51 | */ 52 | file->buffered = 0; 53 | } 54 | 55 | if (file->flags & APR_FOPEN_XTHREAD) { 56 | apr_thread_mutex_unlock(file->mutex); 57 | } 58 | 59 | return APR_SUCCESS; 60 | } 61 | 62 | APR_DECLARE(apr_size_t) apr_file_buffer_size_get(apr_file_t *file) 63 | { 64 | return file->bufsize; 65 | } 66 | -------------------------------------------------------------------------------- /file_io/win32/flock.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apr_arch_file_io.h" 18 | 19 | APR_DECLARE(apr_status_t) apr_file_lock(apr_file_t *thefile, int type) 20 | { 21 | const DWORD len = 0xffffffff; 22 | DWORD flags; 23 | 24 | flags = ((type & APR_FLOCK_NONBLOCK) ? LOCKFILE_FAIL_IMMEDIATELY : 0) 25 | + (((type & APR_FLOCK_TYPEMASK) == APR_FLOCK_SHARED) 26 | ? 0 : LOCKFILE_EXCLUSIVE_LOCK); 27 | /* Syntax is correct, len is passed for LengthLow and LengthHigh*/ 28 | OVERLAPPED offset; 29 | memset (&offset, 0, sizeof(offset)); 30 | if (!LockFileEx(thefile->filehand, flags, 0, len, len, &offset)) 31 | return apr_get_os_error(); 32 | 33 | return APR_SUCCESS; 34 | } 35 | 36 | APR_DECLARE(apr_status_t) apr_file_unlock(apr_file_t *thefile) 37 | { 38 | DWORD len = 0xffffffff; 39 | 40 | /* Syntax is correct, len is passed for LengthLow and LengthHigh*/ 41 | OVERLAPPED offset; 42 | memset (&offset, 0, sizeof(offset)); 43 | if (!UnlockFileEx(thefile->filehand, 0, len, len, &offset)) 44 | return apr_get_os_error(); 45 | 46 | return APR_SUCCESS; 47 | } 48 | -------------------------------------------------------------------------------- /include/apr_env.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef APR_ENV_H 18 | #define APR_ENV_H 19 | /** 20 | * @file apr_env.h 21 | * @brief APR Environment functions 22 | */ 23 | #include "apr_errno.h" 24 | #include "apr_pools.h" 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif /* __cplusplus */ 29 | 30 | /** 31 | * @defgroup apr_env Functions for manipulating the environment 32 | * @ingroup APR 33 | * @{ 34 | */ 35 | 36 | /** 37 | * Get the value of an environment variable 38 | * @param value the returned value, allocated from @a pool 39 | * @param envvar the name of the environment variable 40 | * @param pool where to allocate @a value and any temporary storage from 41 | */ 42 | APR_DECLARE(apr_status_t) apr_env_get(char **value, const char *envvar, 43 | apr_pool_t *pool); 44 | 45 | /** 46 | * Set the value of an environment variable 47 | * @param envvar the name of the environment variable 48 | * @param value the value to set 49 | * @param pool where to allocate temporary storage from 50 | */ 51 | APR_DECLARE(apr_status_t) apr_env_set(const char *envvar, const char *value, 52 | apr_pool_t *pool); 53 | 54 | /** 55 | * Delete a variable from the environment 56 | * @param envvar the name of the environment variable 57 | * @param pool where to allocate temporary storage from 58 | */ 59 | APR_DECLARE(apr_status_t) apr_env_delete(const char *envvar, apr_pool_t *pool); 60 | 61 | /** @} */ 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | #endif /* ! APR_ENV_H */ 68 | -------------------------------------------------------------------------------- /include/apr_inherit.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef APR_INHERIT_H 18 | #define APR_INHERIT_H 19 | 20 | /** 21 | * @file apr_inherit.h 22 | * @brief APR File Handle Inheritance Helpers 23 | * @remark This internal header includes internal declaration helpers 24 | * for other headers to declare apr_foo_inherit_[un]set functions. 25 | */ 26 | 27 | /** 28 | * Prototype for type-specific declarations of apr_foo_inherit_set 29 | * functions. 30 | * @remark Doxygen unwraps this macro (via doxygen.conf) to provide 31 | * actual help for each specific occurrence of apr_foo_inherit_set. 32 | * @remark the linkage is specified for APR. It would be possible to expand 33 | * the macros to support other linkages. 34 | */ 35 | #define APR_DECLARE_INHERIT_SET(type) \ 36 | APR_DECLARE(apr_status_t) apr_##type##_inherit_set( \ 37 | apr_##type##_t *the##type) 38 | 39 | /** 40 | * Prototype for type-specific declarations of apr_foo_inherit_unset 41 | * functions. 42 | * @remark Doxygen unwraps this macro (via doxygen.conf) to provide 43 | * actual help for each specific occurrence of apr_foo_inherit_unset. 44 | * @remark the linkage is specified for APR. It would be possible to expand 45 | * the macros to support other linkages. 46 | */ 47 | #define APR_DECLARE_INHERIT_UNSET(type) \ 48 | APR_DECLARE(apr_status_t) apr_##type##_inherit_unset( \ 49 | apr_##type##_t *the##type) 50 | 51 | #endif /* ! APR_INHERIT_H */ 52 | -------------------------------------------------------------------------------- /include/apr_perms_set.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef APR_PERMS_SET_H 18 | #define APR_PERMS_SET_H 19 | 20 | /** 21 | * @file apr_perms_set.h 22 | * @brief APR Process Locking Routines 23 | */ 24 | 25 | #include "apr.h" 26 | #include "apr_pools.h" 27 | #include "apr_errno.h" 28 | #include "apr_user.h" 29 | #include "apr_file_info.h" 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif /* __cplusplus */ 34 | 35 | /** 36 | * @defgroup apr_perms_set Object permission set functions 37 | * @ingroup APR 38 | * @{ 39 | */ 40 | 41 | /** Permission set callback function. */ 42 | typedef apr_status_t (apr_perms_setfn_t)(void *object, apr_fileperms_t perms, 43 | apr_uid_t uid, apr_gid_t gid); 44 | 45 | #define APR_PERMS_SET_IMPLEMENT(type) \ 46 | APR_DECLARE(apr_status_t) apr_##type##_perms_set \ 47 | (void *the##type, apr_fileperms_t perms, \ 48 | apr_uid_t uid, apr_gid_t gid) 49 | 50 | #define APR_PERMS_SET_ENOTIMPL(type) \ 51 | APR_DECLARE(apr_status_t) apr_##type##_perms_set \ 52 | (void *the##type, apr_fileperms_t perms, \ 53 | apr_uid_t uid, apr_gid_t gid) \ 54 | { return APR_ENOTIMPL ; } 55 | 56 | #define APR_PERMS_SET_FN(type) apr_##type##_perms_set 57 | 58 | 59 | /** @} */ 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | 65 | #endif /* ! APR_PERMS_SET */ 66 | -------------------------------------------------------------------------------- /include/apr_uuid.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @file apr_uuid.h 19 | * @brief APR UUID library 20 | */ 21 | #ifndef APR_UUID_H 22 | #define APR_UUID_H 23 | 24 | #include "apu.h" 25 | #include "apr_errno.h" 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif /* __cplusplus */ 30 | 31 | /** 32 | * @defgroup APR_UUID UUID Handling 33 | * @ingroup APR 34 | * @{ 35 | */ 36 | 37 | /** 38 | * we represent a UUID as a block of 16 bytes. 39 | */ 40 | 41 | typedef struct { 42 | unsigned char data[16]; /**< the actual UUID */ 43 | } apr_uuid_t; 44 | 45 | /** UUIDs are formatted as: 00112233-4455-6677-8899-AABBCCDDEEFF */ 46 | #define APR_UUID_FORMATTED_LENGTH 36 47 | 48 | 49 | /** 50 | * Generate and return a (new) UUID 51 | * @param uuid The resulting UUID 52 | */ 53 | APR_DECLARE(void) apr_uuid_get(apr_uuid_t *uuid); 54 | 55 | /** 56 | * Format a UUID into a string, following the standard format 57 | * @param buffer The buffer to place the formatted UUID string into. It must 58 | * be at least APR_UUID_FORMATTED_LENGTH + 1 bytes long to hold 59 | * the formatted UUID and a null terminator 60 | * @param uuid The UUID to format 61 | */ 62 | APR_DECLARE(void) apr_uuid_format(char *buffer, const apr_uuid_t *uuid); 63 | 64 | /** 65 | * Parse a standard-format string into a UUID 66 | * @param uuid The resulting UUID 67 | * @param uuid_str The formatted UUID 68 | */ 69 | APR_DECLARE(apr_status_t) apr_uuid_parse(apr_uuid_t *uuid, const char *uuid_str); 70 | 71 | /** @} */ 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | 76 | #endif /* APR_UUID_H */ 77 | -------------------------------------------------------------------------------- /include/apu.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* @file apu.h 18 | * @brief APR-Utility main file 19 | * @deprecated @see apr.h 20 | */ 21 | 22 | #include 23 | 24 | -------------------------------------------------------------------------------- /include/apu_want.h.in: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apu.h" /* configuration data */ 18 | 19 | /** 20 | * @file apu_want.h 21 | * @brief APR Standard Headers Support 22 | * 23 | *
24 |  * Features:
25 |  *
26 |  *   APU_WANT_DB:       <@apu_db_header@>
27 |  *
28 |  * Typical usage:
29 |  *
30 |  *   #define APU_WANT_DB
31 |  *   #include "apu_want.h"
32 |  *
33 |  * The appropriate headers will be included.
34 |  *
35 |  * Note: it is safe to use this in a header (it won't interfere with other
36 |  *       headers' or source files' use of apu_want.h)
37 |  * 
38 | */ 39 | 40 | /* --------------------------------------------------------------------- */ 41 | 42 | #ifdef APU_WANT_DB 43 | 44 | #if APU_HAVE_DB 45 | #include <@apu_db_header@> 46 | #endif 47 | 48 | #undef APU_WANT_DB 49 | #endif 50 | 51 | /* --------------------------------------------------------------------- */ 52 | -------------------------------------------------------------------------------- /include/apu_want.hnw: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apu.h" /* configuration data */ 18 | 19 | /** 20 | * @file apu_want.h 21 | * @brief APR Standard Headers Support 22 | * 23 | *
24 |  * Features:
25 |  *
26 |  *   APU_WANT_DB:       <@apu_db_header>
27 |  *
28 |  * Typical usage:
29 |  *
30 |  *   #define APU_WANT_DB
31 |  *   #include "apu_want.h"
32 |  *
33 |  * The appropriate headers will be included.
34 |  *
35 |  * Note: it is safe to use this in a header (it won't interfere with other
36 |  *       headers' or source files' use of apu_want.h)
37 |  * 
38 | */ 39 | 40 | /* --------------------------------------------------------------------- */ 41 | 42 | #ifdef APU_WANT_DB 43 | 44 | #if APU_HAVE_DB 45 | /* win32 note.. you will need to change this for db1 */ 46 | #include 47 | #endif 48 | 49 | #undef APU_WANT_DB 50 | #endif 51 | 52 | /* --------------------------------------------------------------------- */ 53 | -------------------------------------------------------------------------------- /include/apu_want.hw: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apu.h" /* configuration data */ 18 | 19 | /** 20 | * @file apu_want.h 21 | * @brief APR Standard Headers Support 22 | * 23 | *
24 |  * Features:
25 |  *
26 |  *   APU_WANT_DB:       
27 |  *
28 |  * Typical usage:
29 |  *
30 |  *   #define APU_WANT_DB
31 |  *   #include "apu_want.h"
32 |  *
33 |  * The appropriate headers will be included.
34 |  *
35 |  * Note: it is safe to use this in a header (it won't interfere with other
36 |  *       headers' or source files' use of apu_want.h)
37 |  * 
38 | */ 39 | 40 | /* --------------------------------------------------------------------- */ 41 | 42 | #ifdef APU_WANT_DB 43 | 44 | #if APU_HAVE_DB 45 | /* win32 note.. you will need to change this for db1 */ 46 | #include 47 | #endif 48 | 49 | #undef APU_WANT_DB 50 | #endif 51 | 52 | /* --------------------------------------------------------------------- */ 53 | -------------------------------------------------------------------------------- /include/arch/aix/apr_arch_dso.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef DSO_H 18 | #define DSO_H 19 | 20 | #include "apr_private.h" 21 | #include "apr_general.h" 22 | #include "apr_pools.h" 23 | #include "apr_dso.h" 24 | #include "apr.h" 25 | 26 | #if APR_HAS_DSO 27 | 28 | void *dlopen(const char *path, int mode); 29 | void *dlsym(void *handle, const char *symbol); 30 | const char *dlerror(void); 31 | int dlclose(void *handle); 32 | 33 | struct apr_dso_handle_t { 34 | apr_pool_t *pool; 35 | void *handle; 36 | const char *errormsg; 37 | }; 38 | 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /include/arch/beos/apr_arch_dso.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef DSO_H 18 | #define DSO_H 19 | 20 | #include "apr_private.h" 21 | #include "apr_general.h" 22 | #include "apr_pools.h" 23 | #include "apr_errno.h" 24 | #include "apr_dso.h" 25 | #include "apr.h" 26 | #include 27 | #include 28 | 29 | #if APR_HAS_DSO 30 | 31 | struct apr_dso_handle_t { 32 | image_id handle; /* Handle to the DSO loaded */ 33 | apr_pool_t *pool; 34 | const char *errormsg; /* if the load fails, we have an error 35 | * message here :) 36 | */ 37 | }; 38 | 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /include/arch/beos/apr_arch_proc_mutex.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef PROC_MUTEX_H 18 | #define PROC_MUTEX_H 19 | 20 | #include "apr_pools.h" 21 | #include "apr_proc_mutex.h" 22 | #include "apr_file_io.h" 23 | #include "apr_general.h" 24 | #include "apr_lib.h" 25 | #include "apr_portable.h" 26 | 27 | struct apr_proc_mutex_t { 28 | apr_pool_t *pool; 29 | 30 | /* Our lock :) */ 31 | sem_id Lock; 32 | int32 LockCount; 33 | }; 34 | 35 | #endif /* PROC_MUTEX_H */ 36 | 37 | -------------------------------------------------------------------------------- /include/arch/beos/apr_arch_thread_cond.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef THREAD_COND_H 18 | #define THREAD_COND_H 19 | 20 | #include 21 | #include "apr_pools.h" 22 | #include "apr_thread_cond.h" 23 | #include "apr_file_io.h" 24 | #include "apr_general.h" 25 | #include "apr_lib.h" 26 | #include "apr_portable.h" 27 | #include "apr_ring.h" 28 | 29 | struct waiter_t { 30 | APR_RING_ENTRY(waiter_t) link; 31 | sem_id sem; 32 | }; 33 | 34 | struct apr_thread_cond_t { 35 | apr_pool_t *pool; 36 | sem_id lock; 37 | apr_thread_mutex_t *condlock; 38 | thread_id owner; 39 | /* active list */ 40 | APR_RING_HEAD(active_list, waiter_t) alist; 41 | /* free list */ 42 | APR_RING_HEAD(free_list, waiter_t) flist; 43 | }; 44 | 45 | #endif /* THREAD_COND_H */ 46 | 47 | -------------------------------------------------------------------------------- /include/arch/beos/apr_arch_thread_mutex.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef THREAD_MUTEX_H 18 | #define THREAD_MUTEX_H 19 | 20 | #include 21 | #include "apr_pools.h" 22 | #include "apr_thread_mutex.h" 23 | #include "apr_file_io.h" 24 | #include "apr_general.h" 25 | #include "apr_lib.h" 26 | #include "apr_portable.h" 27 | 28 | struct apr_thread_mutex_t { 29 | apr_pool_t *pool; 30 | 31 | /* Our lock :) */ 32 | sem_id Lock; 33 | int32 LockCount; 34 | 35 | /* If we nest locks we need these... */ 36 | int nested; 37 | apr_os_thread_t owner; 38 | int owner_ref; 39 | }; 40 | 41 | #endif /* THREAD_MUTEX_H */ 42 | 43 | -------------------------------------------------------------------------------- /include/arch/beos/apr_arch_thread_rwlock.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef THREAD_RWLOCK_H 18 | #define THREAD_RWLOCK_H 19 | 20 | #include 21 | #include "apr_pools.h" 22 | #include "apr_thread_rwlock.h" 23 | #include "apr_file_io.h" 24 | #include "apr_general.h" 25 | #include "apr_lib.h" 26 | #include "apr_portable.h" 27 | 28 | struct apr_thread_rwlock_t { 29 | apr_pool_t *pool; 30 | 31 | /* Our lock :) */ 32 | sem_id Lock; 33 | int32 LockCount; 34 | /* Read/Write lock stuff */ 35 | sem_id Read; 36 | int32 ReadCount; 37 | sem_id Write; 38 | int32 WriteCount; 39 | int32 Nested; 40 | 41 | thread_id writer; 42 | }; 43 | 44 | #endif /* THREAD_RWLOCK_H */ 45 | 46 | -------------------------------------------------------------------------------- /include/arch/netware/apr_arch_dso.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef DSO_H 18 | #define DSO_H 19 | 20 | #include "apr_private.h" 21 | #include "apr_general.h" 22 | #include "apr_pools.h" 23 | #include "apr_dso.h" 24 | #include "apr.h" 25 | 26 | #include 27 | 28 | typedef struct sym_list sym_list; 29 | 30 | struct sym_list { 31 | sym_list *next; 32 | char *symbol; 33 | }; 34 | 35 | struct apr_dso_handle_t { 36 | apr_pool_t *pool; 37 | void *handle; 38 | const char *errormsg; 39 | sym_list *symbols; 40 | char *path; 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /include/arch/netware/apr_arch_global_mutex.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef GLOBAL_MUTEX_H 18 | #define GLOBAL_MUTEX_H 19 | 20 | #include "apr_global_mutex.h" 21 | #include "apr_thread_mutex.h" 22 | 23 | struct apr_global_mutex_t { 24 | apr_pool_t *pool; 25 | apr_thread_mutex_t *mutex; 26 | }; 27 | 28 | #endif /* GLOBAL_MUTEX_H */ 29 | 30 | -------------------------------------------------------------------------------- /include/arch/netware/apr_arch_internal_time.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef TIME_INTERNAL_H 18 | #define TIME_INTERNAL_H 19 | 20 | #include "apr.h" 21 | 22 | #define TZONE (*___timezone()) 23 | 24 | void apr_netware_setup_time(void); 25 | 26 | #endif /* TIME_INTERNAL_H */ 27 | -------------------------------------------------------------------------------- /include/arch/netware/apr_arch_networkio.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef NETWORK_IO_H 18 | 19 | #ifdef USE_WINSOCK 20 | /* Making sure that we include the correct networkio.h since the 21 | the project file is configured to first look for headers in 22 | arch/netware and then arch/unix. But in this specific case we 23 | want arch/win32. 24 | */ 25 | #include <../win32/apr_arch_networkio.h> 26 | #else 27 | #include <../unix/apr_arch_networkio.h> 28 | #endif 29 | 30 | #endif /* ! NETWORK_IO_H */ 31 | 32 | -------------------------------------------------------------------------------- /include/arch/netware/apr_arch_pre_nw.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef __pre_nw__ 17 | #define __pre_nw__ 18 | 19 | #include 20 | 21 | #ifdef __MWERKS__ 22 | #pragma precompile_target "precomp.mch" 23 | #endif 24 | 25 | #ifndef NETWARE 26 | #define NETWARE 27 | #endif 28 | 29 | #ifndef N_PLAT_NLM 30 | #define N_PLAT_NLM 31 | #endif 32 | 33 | #define FAR 34 | #define far 35 | 36 | /* no-op for Codewarrior C compiler; all functions are cdecl by default */ 37 | #define cdecl 38 | 39 | /* if we have wchar_t enabled in C++, predefine this type to avoid 40 | a conflict in Novell's header files */ 41 | #ifndef __GNUC__ 42 | #ifndef DOXYGEN 43 | #if (__option(cplusplus) && __option(wchar_type)) 44 | #define _WCHAR_T 45 | #endif 46 | #endif 47 | #endif 48 | 49 | /* C9X defintion used by MSL C++ library */ 50 | #define DECIMAL_DIG 17 51 | 52 | /* some code may want to use the MS convention for long long */ 53 | #ifndef __int64 54 | #define __int64 long long 55 | #endif 56 | 57 | #endif 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /include/arch/netware/apr_arch_proc_mutex.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef PROC_MUTEX_H 18 | #define PROC_MUTEX_H 19 | 20 | #include "apr_proc_mutex.h" 21 | #include "apr_thread_mutex.h" 22 | 23 | struct apr_proc_mutex_t { 24 | apr_pool_t *pool; 25 | apr_thread_mutex_t *mutex; 26 | }; 27 | 28 | #endif /* PROC_MUTEX_H */ 29 | 30 | -------------------------------------------------------------------------------- /include/arch/netware/apr_arch_thread_cond.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef THREAD_COND_H 18 | #define THREAD_COND_H 19 | 20 | #include "apr_thread_cond.h" 21 | #include 22 | 23 | struct apr_thread_cond_t { 24 | apr_pool_t *pool; 25 | NXCond_t *cond; 26 | }; 27 | 28 | #endif /* THREAD_COND_H */ 29 | 30 | -------------------------------------------------------------------------------- /include/arch/netware/apr_arch_thread_mutex.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef THREAD_MUTEX_H 18 | #define THREAD_MUTEX_H 19 | 20 | #include "apr_thread_mutex.h" 21 | #include "apr_thread_cond.h" 22 | #include 23 | 24 | struct apr_thread_mutex_t { 25 | apr_pool_t *pool; 26 | NXMutex_t *mutex; 27 | apr_thread_cond_t *cond; 28 | int locked, num_waiters; 29 | }; 30 | 31 | #endif /* THREAD_MUTEX_H */ 32 | 33 | -------------------------------------------------------------------------------- /include/arch/netware/apr_arch_thread_rwlock.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef THREAD_RWLOCK_H 18 | #define THREAD_RWLOCK_H 19 | 20 | #include "apr_thread_rwlock.h" 21 | #include 22 | 23 | struct apr_thread_rwlock_t { 24 | apr_pool_t *pool; 25 | NXRwLock_t *rwlock; 26 | }; 27 | 28 | #endif /* THREAD_RWLOCK_H */ 29 | 30 | -------------------------------------------------------------------------------- /include/arch/netware/apr_arch_threadproc.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apr.h" 18 | #include "apr_thread_proc.h" 19 | #include "apr_file_io.h" 20 | 21 | #include 22 | 23 | #ifndef THREAD_PROC_H 24 | #define THREAD_PROC_H 25 | 26 | #define SHELL_PATH "" 27 | #define APR_DEFAULT_STACK_SIZE 65536 28 | 29 | struct apr_thread_t { 30 | apr_pool_t *pool; 31 | NXContext_t ctx; 32 | NXThreadId_t td; 33 | char *thread_name; 34 | apr_int32_t cancel; 35 | apr_int32_t cancel_how; 36 | void *data; 37 | apr_thread_start_t func; 38 | apr_status_t exitval; 39 | int detached; 40 | }; 41 | 42 | struct apr_threadattr_t { 43 | apr_pool_t *pool; 44 | apr_size_t stack_size; 45 | apr_int32_t detach; 46 | char *thread_name; 47 | apr_size_t max_free; 48 | }; 49 | 50 | struct apr_threadkey_t { 51 | apr_pool_t *pool; 52 | NXKey_t key; 53 | }; 54 | 55 | struct apr_procattr_t { 56 | apr_pool_t *pool; 57 | apr_file_t *parent_in; 58 | apr_file_t *child_in; 59 | apr_file_t *parent_out; 60 | apr_file_t *child_out; 61 | apr_file_t *parent_err; 62 | apr_file_t *child_err; 63 | char *currdir; 64 | apr_int32_t cmdtype; 65 | apr_int32_t detached; 66 | apr_int32_t addrspace; 67 | }; 68 | 69 | struct apr_thread_once_t { 70 | unsigned long value; 71 | }; 72 | 73 | /* 74 | struct apr_proc_t { 75 | apr_pool_t *pool; 76 | pid_t pid; 77 | apr_procattr_t *attr; 78 | }; 79 | */ 80 | 81 | #endif /* ! THREAD_PROC_H */ 82 | 83 | -------------------------------------------------------------------------------- /include/arch/os2/apr_arch_dso.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef DSO_H 18 | #define DSO_H 19 | 20 | #include "apr_private.h" 21 | #include "apr_general.h" 22 | #include "apr_pools.h" 23 | #include "apr_dso.h" 24 | #include "apr.h" 25 | 26 | #if APR_HAS_DSO 27 | 28 | struct apr_dso_handle_t { 29 | apr_pool_t *cont; /* Context for returning error strings */ 30 | HMODULE handle; /* Handle to the DSO loaded */ 31 | apr_status_t load_error; 32 | char *failed_module; 33 | }; 34 | 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /include/arch/os2/apr_arch_proc_mutex.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef PROC_MUTEX_H 18 | #define PROC_MUTEX_H 19 | 20 | #include "apr_proc_mutex.h" 21 | #include "apr_file_io.h" 22 | 23 | struct apr_proc_mutex_t { 24 | apr_pool_t *pool; 25 | HMTX hMutex; 26 | TID owner; 27 | int lock_count; 28 | }; 29 | 30 | #endif /* PROC_MUTEX_H */ 31 | 32 | -------------------------------------------------------------------------------- /include/arch/os2/apr_arch_thread_cond.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef THREAD_COND_H 18 | #define THREAD_COND_H 19 | 20 | #include "apr_thread_cond.h" 21 | #include "apr_file_io.h" 22 | 23 | struct apr_thread_cond_t { 24 | apr_pool_t *pool; 25 | HEV semaphore; 26 | HMTX mutex; 27 | unsigned long num_waiting; 28 | unsigned long num_wake; 29 | unsigned long generation; 30 | }; 31 | 32 | #endif /* THREAD_COND_H */ 33 | 34 | -------------------------------------------------------------------------------- /include/arch/os2/apr_arch_thread_mutex.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef THREAD_MUTEX_H 18 | #define THREAD_MUTEX_H 19 | 20 | #include "apr_thread_mutex.h" 21 | #include "apr_file_io.h" 22 | 23 | struct apr_thread_mutex_t { 24 | apr_pool_t *pool; 25 | HMTX hMutex; 26 | }; 27 | 28 | #endif /* THREAD_MUTEX_H */ 29 | 30 | -------------------------------------------------------------------------------- /include/arch/os2/apr_arch_thread_rwlock.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef THREAD_RWLOCK_H 18 | #define THREAD_RWLOCK_H 19 | 20 | #include "apr_thread_rwlock.h" 21 | #include "apr_file_io.h" 22 | 23 | struct apr_thread_rwlock_t { 24 | apr_pool_t *pool; 25 | int readers; 26 | HMTX write_lock; 27 | HEV read_done; 28 | }; 29 | 30 | #endif /* THREAD_RWLOCK_H */ 31 | 32 | -------------------------------------------------------------------------------- /include/arch/os2/apr_arch_threadproc.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apr_thread_proc.h" 18 | #include "apr_file_io.h" 19 | 20 | #ifndef THREAD_PROC_H 21 | #define THREAD_PROC_H 22 | 23 | #define APR_THREADATTR_DETACHED 1 24 | 25 | #define SHELL_PATH "cmd.exe" 26 | #define APR_THREAD_STACKSIZE 65536 27 | 28 | struct apr_threadattr_t { 29 | apr_pool_t *pool; 30 | unsigned long attr; 31 | apr_size_t stacksize; 32 | apr_size_t max_free; 33 | }; 34 | 35 | struct apr_thread_t { 36 | apr_pool_t *pool; 37 | struct apr_threadattr_t *attr; 38 | unsigned long tid; 39 | apr_thread_start_t func; 40 | void *data; 41 | apr_status_t exitval; 42 | }; 43 | 44 | struct apr_threadkey_t { 45 | apr_pool_t *pool; 46 | unsigned long *key; 47 | }; 48 | 49 | struct apr_procattr_t { 50 | apr_pool_t *pool; 51 | apr_file_t *parent_in; 52 | apr_file_t *child_in; 53 | apr_file_t *parent_out; 54 | apr_file_t *child_out; 55 | apr_file_t *parent_err; 56 | apr_file_t *child_err; 57 | char *currdir; 58 | apr_int32_t cmdtype; 59 | apr_int32_t detached; 60 | }; 61 | 62 | struct apr_thread_once_t { 63 | unsigned long sem; 64 | char hit; 65 | }; 66 | 67 | #endif /* ! THREAD_PROC_H */ 68 | 69 | -------------------------------------------------------------------------------- /include/arch/os390/apr_arch_dso.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef DSO_H 18 | #define DSO_H 19 | 20 | #include "apr_private.h" 21 | #include "apr_general.h" 22 | #include "apr_pools.h" 23 | #include "apr_dso.h" 24 | #include "apr.h" 25 | 26 | #if APR_HAS_DSO 27 | 28 | #include 29 | 30 | struct apr_dso_handle_t { 31 | dllhandle *handle; /* Handle to the DSO loaded */ 32 | int failing_errno; /* Don't save the buffer returned by 33 | strerror(); it gets reused */ 34 | apr_pool_t *pool; 35 | }; 36 | 37 | #endif 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /include/arch/unix/apr_arch_atomic.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef ATOMIC_H 18 | #define ATOMIC_H 19 | 20 | #include "apr.h" 21 | #include "apr_pools.h" 22 | #include "apr_private.h" 23 | #include "apr_atomic.h" 24 | 25 | #if defined(USE_ATOMICS_GENERIC) 26 | /* noop */ 27 | #elif HAVE_ATOMIC_BUILTINS 28 | # define USE_ATOMICS_BUILTINS 29 | #elif defined(SOLARIS2) && SOLARIS2 >= 10 30 | # define USE_ATOMICS_SOLARIS 31 | #elif defined(__GNUC__) && defined(__STRICT_ANSI__) 32 | /* force use of generic atomics if building e.g. with -std=c89, which 33 | * doesn't allow inline asm */ 34 | # define USE_ATOMICS_GENERIC 35 | #elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) 36 | # define USE_ATOMICS_IA32 37 | #elif defined(__GNUC__) && (defined(__powerpc__) \ 38 | || defined(__PPC__) \ 39 | || defined(__ppc__)) 40 | # define USE_ATOMICS_PPC 41 | #elif defined(__GNUC__) && (defined(__s390__) || defined(__s390x__)) 42 | # define USE_ATOMICS_S390 43 | #else 44 | # define USE_ATOMICS_GENERIC 45 | #endif 46 | 47 | #if defined(USE_ATOMICS_GENERIC64) 48 | /* noop */ 49 | #elif HAVE_ATOMIC_BUILTINS64 50 | # define USE_ATOMICS_BUILTINS64 51 | #else 52 | # define USE_ATOMICS_GENERIC64 53 | #endif 54 | #if defined(USE_ATOMICS_GENERIC64) 55 | apr_status_t apr__atomic_generic64_init(apr_pool_t *p); 56 | #endif 57 | 58 | #endif /* ATOMIC_H */ 59 | -------------------------------------------------------------------------------- /include/arch/unix/apr_arch_dso.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef DSO_H 18 | #define DSO_H 19 | 20 | #include "apr_private.h" 21 | #include "apr_general.h" 22 | #include "apr_pools.h" 23 | #include "apr_dso.h" 24 | #include "apr.h" 25 | 26 | #if APR_HAS_DSO 27 | 28 | #ifdef HAVE_MACH_O_DYLD_H 29 | #include 30 | #endif 31 | 32 | #ifdef HAVE_DLFCN_H 33 | #include 34 | #endif 35 | 36 | #ifdef HAVE_DL_H 37 | #include 38 | #endif 39 | 40 | #ifndef RTLD_NOW 41 | #define RTLD_NOW 1 42 | #endif 43 | 44 | #ifndef RTLD_GLOBAL 45 | #define RTLD_GLOBAL 0 46 | #endif 47 | 48 | #if (defined(__DragonFly__) ||\ 49 | defined(__FreeBSD__) ||\ 50 | defined(__OpenBSD__) ||\ 51 | defined(__NetBSD__) ) && !defined(__ELF__) 52 | #define DLSYM_NEEDS_UNDERSCORE 53 | #endif 54 | 55 | struct apr_dso_handle_t { 56 | apr_pool_t *pool; 57 | void *handle; 58 | const char *errormsg; 59 | }; 60 | 61 | #endif 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /include/arch/unix/apr_arch_global_mutex.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef GLOBAL_MUTEX_H 18 | #define GLOBAL_MUTEX_H 19 | 20 | #include "apr.h" 21 | #include "apr_private.h" 22 | #include "apr_general.h" 23 | #include "apr_lib.h" 24 | #include "apr_global_mutex.h" 25 | #include "apr_arch_proc_mutex.h" 26 | #include "apr_arch_thread_mutex.h" 27 | 28 | struct apr_global_mutex_t { 29 | apr_pool_t *pool; 30 | apr_proc_mutex_t *proc_mutex; 31 | #if APR_HAS_THREADS 32 | apr_thread_mutex_t *thread_mutex; 33 | #endif /* APR_HAS_THREADS */ 34 | }; 35 | 36 | #endif /* GLOBAL_MUTEX_H */ 37 | 38 | -------------------------------------------------------------------------------- /include/arch/unix/apr_arch_internal_time.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef TIME_INTERNAL_H 18 | #define TIME_INTERNAL_H 19 | 20 | #include "apr.h" 21 | 22 | void apr_unix_setup_time(void); 23 | 24 | #endif /* TIME_INTERNAL_H */ 25 | -------------------------------------------------------------------------------- /include/arch/unix/apr_arch_misc.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef MISC_H 18 | #define MISC_H 19 | 20 | #include "apr.h" 21 | #include "apr_portable.h" 22 | #include "apr_private.h" 23 | #include "apr_general.h" 24 | #include "apr_pools.h" 25 | #include "apr_getopt.h" 26 | #include "apr_thread_proc.h" 27 | #include "apr_file_io.h" 28 | #include "apr_errno.h" 29 | #include "apr_getopt.h" 30 | 31 | #if APR_HAVE_STDIO_H 32 | #include 33 | #endif 34 | #if APR_HAVE_SIGNAL_H 35 | #include 36 | #endif 37 | #if APR_HAVE_PTHREAD_H 38 | #include 39 | #endif 40 | 41 | #if APR_HAVE_STDLIB_H 42 | #include 43 | #endif 44 | #if APR_HAVE_STRING_H 45 | #include 46 | #endif 47 | 48 | #ifdef BEOS 49 | #include 50 | #endif 51 | 52 | struct apr_other_child_rec_t { 53 | apr_pool_t *p; 54 | struct apr_other_child_rec_t *next; 55 | apr_proc_t *proc; 56 | void (*maintenance) (int, void *, int); 57 | void *data; 58 | }; 59 | 60 | #if defined(WIN32) || defined(NETWARE) 61 | #define WSAHighByte 2 62 | #define WSALowByte 0 63 | #endif 64 | 65 | #endif /* ! MISC_H */ 66 | 67 | -------------------------------------------------------------------------------- /include/arch/unix/apr_arch_shm.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef SHM_H 18 | #define SHM_H 19 | 20 | #include "apr.h" 21 | #include "apr_private.h" 22 | #include "apr_general.h" 23 | #include "apr_lib.h" 24 | #include "apr_shm.h" 25 | #include "apr_pools.h" 26 | #include "apr_file_io.h" 27 | #include "apr_network_io.h" 28 | #include "apr_portable.h" 29 | 30 | #if APR_HAVE_UNISTD_H 31 | #include 32 | #endif 33 | #ifdef HAVE_SYS_MMAN_H 34 | #include 35 | #endif 36 | #ifdef HAVE_SYS_IPC_H 37 | #include 38 | #endif 39 | #ifdef HAVE_SYS_MUTEX_H 40 | #include 41 | #endif 42 | #ifdef HAVE_SYS_SHM_H 43 | #include 44 | #endif 45 | #if !defined(SHM_R) 46 | #define SHM_R 0400 47 | #endif 48 | #if !defined(SHM_W) 49 | #define SHM_W 0200 50 | #endif 51 | #ifdef HAVE_SYS_FILE_H 52 | #include 53 | #endif 54 | 55 | /* Not all systems seem to have MAP_FAILED defined, but it should always 56 | * just be (void *)-1. */ 57 | #ifndef MAP_FAILED 58 | #define MAP_FAILED ((void *)-1) 59 | #endif 60 | 61 | struct apr_shm_t { 62 | apr_pool_t *pool; 63 | void *base; /* base real address */ 64 | void *usable; /* base usable address */ 65 | apr_size_t reqsize; /* requested segment size */ 66 | apr_size_t realsize; /* actual segment size */ 67 | const char *filename; /* NULL if anonymous */ 68 | #if APR_USE_SHMEM_SHMGET || APR_USE_SHMEM_SHMGET_ANON 69 | int shmid; /* shmem ID returned from shmget() */ 70 | key_t shmkey; /* shmem key IPC_ANON or returned from ftok() */ 71 | #endif 72 | }; 73 | 74 | #endif /* SHM_H */ 75 | -------------------------------------------------------------------------------- /include/arch/unix/apr_arch_thread_cond.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef THREAD_COND_H 18 | #define THREAD_COND_H 19 | 20 | #include "apr.h" 21 | #include "apr_private.h" 22 | #include "apr_general.h" 23 | #include "apr_lib.h" 24 | #include "apr_thread_mutex.h" 25 | #include "apr_thread_cond.h" 26 | #include "apr_pools.h" 27 | 28 | #if APR_HAVE_PTHREAD_H 29 | #include 30 | #endif 31 | 32 | /* XXX: Should we have a better autoconf search, something like 33 | * APR_HAS_PTHREAD_COND? -aaron */ 34 | #if APR_HAS_THREADS 35 | struct apr_thread_cond_t { 36 | apr_pool_t *pool; 37 | pthread_cond_t cond; 38 | }; 39 | #endif 40 | 41 | #endif /* THREAD_COND_H */ 42 | 43 | -------------------------------------------------------------------------------- /include/arch/unix/apr_arch_thread_mutex.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef THREAD_MUTEX_H 18 | #define THREAD_MUTEX_H 19 | 20 | #include "apr.h" 21 | #include "apr_private.h" 22 | #include "apr_general.h" 23 | #include "apr_thread_mutex.h" 24 | #include "apr_thread_cond.h" 25 | #include "apr_portable.h" 26 | #include "apr_atomic.h" 27 | 28 | #if APR_HAVE_PTHREAD_H 29 | #include 30 | #endif 31 | 32 | #if APR_HAS_THREADS 33 | struct apr_thread_mutex_t { 34 | apr_pool_t *pool; 35 | pthread_mutex_t mutex; 36 | #ifndef HAVE_PTHREAD_MUTEX_TIMEDLOCK 37 | apr_thread_cond_t *cond; 38 | int locked, num_waiters; 39 | #endif 40 | }; 41 | #endif 42 | 43 | #endif /* THREAD_MUTEX_H */ 44 | 45 | -------------------------------------------------------------------------------- /include/arch/unix/apr_arch_thread_rwlock.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef THREAD_RWLOCK_H 18 | #define THREAD_RWLOCK_H 19 | 20 | #include "apr.h" 21 | #include "apr_private.h" 22 | #include "apr_general.h" 23 | #include "apr_thread_rwlock.h" 24 | #include "apr_pools.h" 25 | 26 | #if APR_HAVE_PTHREAD_H 27 | /* this gives us pthread_rwlock_t */ 28 | #include 29 | #endif 30 | 31 | #if APR_HAS_THREADS 32 | #ifdef HAVE_PTHREAD_RWLOCKS 33 | 34 | struct apr_thread_rwlock_t { 35 | apr_pool_t *pool; 36 | pthread_rwlock_t rwlock; 37 | }; 38 | 39 | #else 40 | 41 | struct apr_thread_rwlock_t { 42 | apr_pool_t *pool; 43 | }; 44 | #endif 45 | 46 | #endif 47 | 48 | #endif /* THREAD_RWLOCK_H */ 49 | 50 | -------------------------------------------------------------------------------- /include/arch/win32/apr_arch_atime.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef ATIME_H 18 | #define ATIME_H 19 | 20 | #include "apr_private.h" 21 | #include "apr_time.h" 22 | #if APR_HAVE_TIME_H 23 | #include 24 | #endif 25 | 26 | struct atime_t { 27 | apr_pool_t *cntxt; 28 | apr_time_t currtime; 29 | SYSTEMTIME *explodedtime; 30 | }; 31 | 32 | 33 | /* Number of micro-seconds between the beginning of the Windows epoch 34 | * (Jan. 1, 1601) and the Unix epoch (Jan. 1, 1970) 35 | */ 36 | #define APR_DELTA_EPOCH_IN_USEC APR_TIME_C(11644473600000000); 37 | 38 | 39 | static APR_INLINE void FileTimeToAprTime(apr_time_t *result, FILETIME *input) 40 | { 41 | /* Convert FILETIME one 64 bit number so we can work with it. */ 42 | *result = input->dwHighDateTime; 43 | *result = (*result) << 32; 44 | *result |= input->dwLowDateTime; 45 | *result /= 10; /* Convert from 100 nano-sec periods to micro-seconds. */ 46 | *result -= APR_DELTA_EPOCH_IN_USEC; /* Convert from Windows epoch to Unix epoch */ 47 | return; 48 | } 49 | 50 | 51 | static APR_INLINE void AprTimeToFileTime(LPFILETIME pft, apr_time_t t) 52 | { 53 | LONGLONG ll; 54 | t += APR_DELTA_EPOCH_IN_USEC; 55 | ll = t * 10; 56 | pft->dwLowDateTime = (DWORD)ll; 57 | pft->dwHighDateTime = (DWORD) (ll >> 32); 58 | return; 59 | } 60 | 61 | 62 | #endif /* ! ATIME_H */ 63 | 64 | -------------------------------------------------------------------------------- /include/arch/win32/apr_arch_dso.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef DSO_H 18 | #define DSO_H 19 | 20 | #include "apr_private.h" 21 | #include "apr_general.h" 22 | #include "apr_pools.h" 23 | #include "apr_dso.h" 24 | #include "apr.h" 25 | 26 | #if APR_HAS_DSO 27 | 28 | struct apr_dso_handle_t { 29 | apr_pool_t *cont; 30 | void *handle; 31 | apr_status_t load_error; 32 | }; 33 | 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /include/arch/win32/apr_arch_inherit.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef INHERIT_H 18 | #define INHERIT_H 19 | 20 | #include "apr_inherit.h" 21 | 22 | #define APR_INHERIT (1 << 24) /* Must not conflict with other bits */ 23 | 24 | #define APR_IMPLEMENT_INHERIT_SET(name, flag, pool, cleanup) \ 25 | APR_DECLARE(apr_status_t) apr_##name##_inherit_set(apr_##name##_t *the##name) \ 26 | { \ 27 | if (!SetHandleInformation(the##name->filehand, \ 28 | HANDLE_FLAG_INHERIT, \ 29 | HANDLE_FLAG_INHERIT)) \ 30 | return apr_get_os_error(); \ 31 | return APR_SUCCESS; \ 32 | } 33 | 34 | #define APR_IMPLEMENT_INHERIT_UNSET(name, flag, pool, cleanup) \ 35 | APR_DECLARE(apr_status_t) apr_##name##_inherit_unset(apr_##name##_t *the##name)\ 36 | { \ 37 | if (!SetHandleInformation(the##name->filehand, \ 38 | HANDLE_FLAG_INHERIT, 0)) \ 39 | return apr_get_os_error(); \ 40 | return APR_SUCCESS; \ 41 | } 42 | 43 | 44 | #endif /* ! INHERIT_H */ 45 | -------------------------------------------------------------------------------- /include/arch/win32/apr_arch_proc_mutex.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef PROC_MUTEX_H 18 | #define PROC_MUTEX_H 19 | 20 | #include "apr_proc_mutex.h" 21 | 22 | struct apr_proc_mutex_t { 23 | apr_pool_t *pool; 24 | HANDLE handle; 25 | const char *fname; 26 | }; 27 | 28 | #endif /* PROC_MUTEX_H */ 29 | 30 | -------------------------------------------------------------------------------- /include/arch/win32/apr_arch_thread_cond.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef THREAD_COND_H 18 | #define THREAD_COND_H 19 | 20 | #include "apr_thread_cond.h" 21 | 22 | struct apr_thread_cond_t { 23 | apr_pool_t *pool; 24 | HANDLE semaphore; 25 | CRITICAL_SECTION csection; 26 | unsigned long num_waiting; 27 | unsigned long num_wake; 28 | unsigned long generation; 29 | }; 30 | 31 | #endif /* THREAD_COND_H */ 32 | 33 | -------------------------------------------------------------------------------- /include/arch/win32/apr_arch_thread_mutex.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef THREAD_MUTEX_H 18 | #define THREAD_MUTEX_H 19 | 20 | #include "apr_pools.h" 21 | 22 | typedef enum thread_mutex_type { 23 | thread_mutex_critical_section, 24 | thread_mutex_unnested_semaphore, 25 | thread_mutex_nested_mutex 26 | } thread_mutex_type; 27 | 28 | /* handle applies only to unnested_semaphore on all platforms 29 | * and nested_mutex on Win9x only. Otherwise critical_section 30 | * is used for NT nexted mutexes providing optimal performance. 31 | */ 32 | struct apr_thread_mutex_t { 33 | apr_pool_t *pool; 34 | thread_mutex_type type; 35 | HANDLE handle; 36 | CRITICAL_SECTION section; 37 | }; 38 | 39 | #endif /* THREAD_MUTEX_H */ 40 | 41 | -------------------------------------------------------------------------------- /include/arch/win32/apr_arch_thread_rwlock.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef THREAD_RWLOCK_H 18 | #define THREAD_RWLOCK_H 19 | 20 | #include "apr_thread_rwlock.h" 21 | 22 | struct apr_thread_rwlock_t { 23 | apr_pool_t *pool; 24 | SRWLOCK lock; 25 | int has_wrlock; 26 | }; 27 | 28 | #endif /* THREAD_RWLOCK_H */ 29 | 30 | -------------------------------------------------------------------------------- /include/arch/win32/apr_arch_threadproc.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apr_private.h" 18 | #include "apr_thread_proc.h" 19 | #include "apr_file_io.h" 20 | 21 | #ifndef THREAD_PROC_H 22 | #define THREAD_PROC_H 23 | 24 | #define SHELL_PATH "cmd.exe" 25 | 26 | struct apr_thread_t { 27 | apr_pool_t *pool; 28 | HANDLE td; 29 | apr_int32_t cancel; 30 | apr_int32_t cancel_how; 31 | void *data; 32 | apr_thread_start_t func; 33 | apr_status_t exitval; 34 | int exited; 35 | }; 36 | 37 | struct apr_threadattr_t { 38 | apr_pool_t *pool; 39 | apr_int32_t detach; 40 | apr_size_t stacksize; 41 | apr_size_t max_free; 42 | }; 43 | 44 | struct apr_threadkey_t { 45 | apr_pool_t *pool; 46 | DWORD key; 47 | }; 48 | 49 | struct apr_procattr_t { 50 | apr_pool_t *pool; 51 | apr_file_t *parent_in; 52 | apr_file_t *child_in; 53 | apr_file_t *parent_out; 54 | apr_file_t *child_out; 55 | apr_file_t *parent_err; 56 | apr_file_t *child_err; 57 | char *currdir; 58 | apr_int32_t cmdtype; 59 | apr_int32_t detached; 60 | apr_child_errfn_t *errfn; 61 | apr_int32_t errchk; 62 | HANDLE user_token; 63 | LPSECURITY_ATTRIBUTES sa; 64 | LPVOID sd; 65 | }; 66 | 67 | struct apr_thread_once_t { 68 | INIT_ONCE once; 69 | }; 70 | 71 | #endif /* ! THREAD_PROC_H */ 72 | 73 | -------------------------------------------------------------------------------- /include/private/apu_internal.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apr.h" 18 | #include "apr_dso.h" 19 | #include "apu.h" 20 | #include "apu_errno.h" 21 | 22 | #ifndef APU_INTERNAL_H 23 | #define APU_INTERNAL_H 24 | 25 | #if APR_HAVE_MODULAR_DSO 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* For modular dso loading, an internal interlock to allow us to 32 | * continue to initialize modules by multiple threads, the caller 33 | * of apu_dso_load must lock first, and not unlock until any init 34 | * finalization is complete. 35 | */ 36 | apr_status_t apu_dso_init(apr_pool_t *pool); 37 | 38 | apr_status_t apu_dso_mutex_lock(void); 39 | apr_status_t apu_dso_mutex_unlock(void); 40 | 41 | apr_status_t apu_dso_load(apr_dso_handle_t **dso, apr_dso_handle_sym_t *dsoptr, 42 | const char *module, const char *modsym, 43 | apr_pool_t *pool, apu_err_t *err); 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | #endif /* APR_HAVE_MODULAR_DSO */ 50 | 51 | #endif /* APU_INTERNAL_H */ 52 | 53 | -------------------------------------------------------------------------------- /include/private/apu_ldap_internal.h.in: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef APU_LDAP_INTERNAL_H 18 | #define APU_LDAP_INTERNAL_H 19 | 20 | /* 21 | ** The following macros control what features APRUTIL will use 22 | */ 23 | #define APR_HAVE_LDAP_SASL_INTERACTIVE_BIND @apu_have_ldap_sasl_interactive_bind@ 24 | #define APR_HAVE_LDAP_CONNECT @apu_have_ldap_connect@ 25 | 26 | #endif /* !APU_LDAP_INTERNAL_H */ 27 | -------------------------------------------------------------------------------- /include/private/apu_ldap_internal.hw: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef APU_LDAP_INTERNAL_H 18 | #define APU_LDAP_INTERNAL_H 19 | 20 | /* 21 | ** The following macros control what features APRUTIL will use 22 | */ 23 | #define APR_HAVE_LDAP_SASL_INTERACTIVE_BIND 0 24 | #define APR_HAVE_LDAP_CONNECT 1 25 | 26 | #endif /* !APU_LDAP_INTERNAL_H */ 27 | -------------------------------------------------------------------------------- /include/private/apu_select_dbm.h.in: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef APU_SELECT_DBM_H 18 | #define APU_SELECT_DBM_H 19 | 20 | /* 21 | ** The following macros control what features APRUTIL will use 22 | */ 23 | #define APU_USE_SDBM @apu_use_sdbm@ 24 | #define APU_USE_LMDB @apu_use_lmdb@ 25 | #define APU_USE_NDBM @apu_use_ndbm@ 26 | #define APU_USE_GDBM @apu_use_gdbm@ 27 | #define APU_USE_DB @apu_use_db@ 28 | 29 | #endif /* !APU_SELECT_DBM_H */ 30 | -------------------------------------------------------------------------------- /include/private/apu_select_dbm.hw: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef APU_SELECT_DBM_H 18 | #define APU_SELECT_DBM_H 19 | 20 | /* 21 | ** The following macros control what features APRUTIL will use 22 | */ 23 | #define APU_USE_SDBM 1 24 | #define APU_USE_GDBM 0 25 | #define APU_USE_NDBM 0 26 | #define APU_USE_DB 0 27 | 28 | #endif /* !APU_SELECT_DBM_H */ 29 | -------------------------------------------------------------------------------- /misc/netware/apr.xdc: -------------------------------------------------------------------------------- 1 | BAGFMPK_Bag MT Safe NLM -------------------------------------------------------------------------------- /misc/netware/charset.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apr.h" 18 | #include "apr_strings.h" 19 | #include "apr_portable.h" 20 | 21 | /* static struct utsname sysinfo; */ 22 | 23 | /* XXX This needs to be fixed to produce the correct system language */ 24 | 25 | APR_DECLARE(const char*) apr_os_default_encoding (apr_pool_t *pool) 26 | { 27 | return apr_pstrdup(pool, "CP1252"); 28 | } 29 | 30 | 31 | APR_DECLARE(const char*) apr_os_locale_encoding (apr_pool_t *pool) 32 | { 33 | return apr_os_default_encoding(pool); 34 | } 35 | -------------------------------------------------------------------------------- /misc/netware/rand.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #define APR_WANT_MEMFUNC 18 | #include "apr_want.h" 19 | #include "apr_general.h" 20 | #include "apr_private.h" 21 | 22 | #if APR_HAS_RANDOM 23 | 24 | #include 25 | 26 | static int NXSeedRandomInternal( size_t width, void *seed ) 27 | { 28 | static int init = 0; 29 | int *s = (int *) seed; 30 | union { int x; char y[4]; } u; 31 | 32 | if (!init) { 33 | srand(NXGetSystemTick()); 34 | init = 1; 35 | } 36 | 37 | if (width > 3) 38 | { 39 | do 40 | { 41 | *s++ = rand(); 42 | } 43 | while ((width -= 4) > 3); 44 | } 45 | 46 | if (width > 0) 47 | { 48 | char *p = (char *) s; 49 | 50 | u.x = rand(); 51 | 52 | while (width > 0) 53 | *p++ = u.y[width--]; 54 | } 55 | 56 | return APR_SUCCESS; 57 | } 58 | 59 | APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char *buf, 60 | apr_size_t length) 61 | { 62 | if (NXSeedRandom(length, buf) != 0) { 63 | return NXSeedRandomInternal (length, buf); 64 | } 65 | return APR_SUCCESS; 66 | } 67 | 68 | 69 | 70 | #endif /* APR_HAS_RANDOM */ 71 | -------------------------------------------------------------------------------- /misc/unix/version.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apr_version.h" 18 | #include "apr_general.h" /* for APR_STRINGIFY */ 19 | 20 | APR_DECLARE(void) apr_version(apr_version_t *pvsn) 21 | { 22 | pvsn->major = APR_MAJOR_VERSION; 23 | pvsn->minor = APR_MINOR_VERSION; 24 | pvsn->patch = APR_PATCH_VERSION; 25 | #ifdef APR_IS_DEV_VERSION 26 | pvsn->is_dev = 1; 27 | #else 28 | pvsn->is_dev = 0; 29 | #endif 30 | } 31 | 32 | APR_DECLARE(const char *) apr_version_string(void) 33 | { 34 | return APR_VERSION_STRING; 35 | } 36 | -------------------------------------------------------------------------------- /misc/win32/charset.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apr.h" 18 | #include "apr_strings.h" 19 | #include "apr_portable.h" 20 | 21 | 22 | APR_DECLARE(const char*) apr_os_default_encoding (apr_pool_t *pool) 23 | { 24 | return apr_psprintf(pool, "CP%u", (unsigned) GetACP()); 25 | } 26 | 27 | 28 | APR_DECLARE(const char*) apr_os_locale_encoding (apr_pool_t *pool) 29 | { 30 | #ifdef _UNICODE 31 | int i; 32 | #endif 33 | LCID locale = GetThreadLocale(); 34 | int len = GetLocaleInfo(locale, LOCALE_IDEFAULTANSICODEPAGE, NULL, 0); 35 | char *cp = apr_palloc(pool, (len * sizeof(TCHAR)) + 2); 36 | if (0 < GetLocaleInfo(locale, LOCALE_IDEFAULTANSICODEPAGE, (TCHAR*) (cp + 2), len)) 37 | { 38 | /* Fix up the returned number to make a valid codepage name of 39 | the form "CPnnnn". */ 40 | cp[0] = 'C'; 41 | cp[1] = 'P'; 42 | #ifdef _UNICODE 43 | for(i = 0; i < len; i++) { 44 | cp[i + 2] = (char) ((TCHAR*) (cp + 2))[i]; 45 | } 46 | #endif 47 | return cp; 48 | } 49 | 50 | return apr_os_default_encoding(pool); 51 | } 52 | -------------------------------------------------------------------------------- /misc/win32/rand.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apr.h" 18 | #include 19 | #include 20 | #include 21 | #include "apr_private.h" 22 | #include "apr_general.h" 23 | #include "apr_portable.h" 24 | #include "apr_arch_misc.h" 25 | 26 | 27 | APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char * buf, 28 | apr_size_t length) 29 | { 30 | NTSTATUS ntstatus; 31 | 32 | ntstatus = BCryptGenRandom(NULL, buf, (DWORD) length, 33 | BCRYPT_USE_SYSTEM_PREFERRED_RNG); 34 | 35 | if (BCRYPT_SUCCESS(ntstatus)) { 36 | return APR_SUCCESS; 37 | } 38 | else if (ntstatus == STATUS_INVALID_PARAMETER) { 39 | return APR_FROM_OS_ERROR(ERROR_INVALID_PARAMETER); 40 | } 41 | else { 42 | return APR_EGENERAL; 43 | } 44 | } 45 | 46 | 47 | APR_DECLARE(apr_status_t) apr_os_uuid_get(unsigned char *uuid_data) 48 | { 49 | /* Note: this call doesn't actually require CoInitialize() first 50 | * 51 | * XXX: we should scramble the bytes or some such to eliminate the 52 | * possible misuse/abuse since uuid is based on the NIC address, and 53 | * is therefore not only a uniqifier, but an identity (which might not 54 | * be appropriate in all cases. 55 | * 56 | * Note that Win2000, XP and later no longer suffer from this problem, 57 | * a scrambling fix is only needed for (apr_os_level < APR_WIN_2000) 58 | */ 59 | if (FAILED(UuidCreate((UUID *)uuid_data))) { 60 | return APR_EGENERAL; 61 | } 62 | return APR_SUCCESS; 63 | } 64 | -------------------------------------------------------------------------------- /mmap/unix/common.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* common .c 18 | * This file has any function that is truly common and platform 19 | * neutral. Or at least that's the theory. 20 | * 21 | * The header files are a problem so there are a few #ifdef's to take 22 | * care of those. 23 | * 24 | */ 25 | 26 | #include "apr.h" 27 | #include "apr_private.h" 28 | #include "apr_mmap.h" 29 | #include "apr_errno.h" 30 | 31 | #if APR_HAS_MMAP || defined(BEOS) 32 | 33 | APR_DECLARE(apr_status_t) apr_mmap_offset(void **addr, apr_mmap_t *mmap, 34 | apr_off_t offset) 35 | { 36 | if (offset < 0 || (apr_size_t)offset > mmap->size) 37 | return APR_EINVAL; 38 | 39 | (*addr) = (char *) mmap->mm + offset; 40 | return APR_SUCCESS; 41 | } 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /network_io/beos/socketcommon.c: -------------------------------------------------------------------------------- 1 | #include "../unix/inet_ntop.c" 2 | #include "../unix/inet_pton.c" 3 | #include "../unix/sockets.c" 4 | #include "../unix/sockaddr.c" 5 | #include "../unix/sockopt.c" 6 | #include "../unix/socket_util.c" 7 | -------------------------------------------------------------------------------- /network_io/os2/inet_ntop.c: -------------------------------------------------------------------------------- 1 | #include "../unix/inet_ntop.c" 2 | -------------------------------------------------------------------------------- /network_io/os2/inet_pton.c: -------------------------------------------------------------------------------- 1 | #include "../unix/inet_pton.c" 2 | -------------------------------------------------------------------------------- /network_io/os2/multicast.c: -------------------------------------------------------------------------------- 1 | #include "../unix/multicast.c" 2 | -------------------------------------------------------------------------------- /network_io/os2/sockaddr.c: -------------------------------------------------------------------------------- 1 | #include "../unix/sockaddr.c" 2 | -------------------------------------------------------------------------------- /network_io/os2/socket_util.c: -------------------------------------------------------------------------------- 1 | #include "../unix/socket_util.c" 2 | -------------------------------------------------------------------------------- /random/unix/sha2.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /* 17 | * FILE: sha2.h 18 | * AUTHOR: Aaron D. Gifford 19 | * 20 | * A licence was granted to the ASF by Aaron on 4 November 2003. 21 | */ 22 | 23 | #ifndef __SHA2_H__ 24 | #define __SHA2_H__ 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | #include "apr.h" 31 | 32 | /*** SHA-256 Various Length Definitions ***********************/ 33 | #define SHA256_BLOCK_LENGTH 64 34 | #define SHA256_DIGEST_LENGTH 32 35 | #define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1) 36 | 37 | 38 | /*** SHA-256/384/512 Context Structures *******************************/ 39 | typedef struct _SHA256_CTX { 40 | apr_uint32_t state[8]; 41 | apr_uint64_t bitcount; 42 | apr_byte_t buffer[SHA256_BLOCK_LENGTH]; 43 | } SHA256_CTX; 44 | 45 | 46 | /*** SHA-256/384/512 Function Prototypes ******************************/ 47 | void apr__SHA256_Init(SHA256_CTX *); 48 | void apr__SHA256_Update(SHA256_CTX *, const apr_byte_t *, size_t); 49 | void apr__SHA256_Final(apr_byte_t [SHA256_DIGEST_LENGTH], SHA256_CTX *); 50 | char* apr__SHA256_End(SHA256_CTX *, char [SHA256_DIGEST_STRING_LENGTH]); 51 | char* apr__SHA256_Data(const apr_byte_t *, size_t, 52 | char [SHA256_DIGEST_STRING_LENGTH]); 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif /* __cplusplus */ 57 | 58 | #endif /* __SHA2_H__ */ 59 | 60 | -------------------------------------------------------------------------------- /random/unix/sha2_glue.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include "sha2.h" 21 | 22 | static void sha256_init(apr_crypto_hash_t *h) 23 | { 24 | apr__SHA256_Init(h->data); 25 | } 26 | 27 | static void sha256_add(apr_crypto_hash_t *h,const void *data, 28 | apr_size_t bytes) 29 | { 30 | apr__SHA256_Update(h->data,data,bytes); 31 | } 32 | 33 | static void sha256_finish(apr_crypto_hash_t *h,unsigned char *result) 34 | { 35 | apr__SHA256_Final(result,h->data); 36 | } 37 | 38 | APR_DECLARE(apr_crypto_hash_t *) apr_crypto_sha256_new(apr_pool_t *p) 39 | { 40 | apr_crypto_hash_t *h=apr_palloc(p,sizeof *h); 41 | 42 | h->data=apr_palloc(p,sizeof(SHA256_CTX)); 43 | h->init=sha256_init; 44 | h->add=sha256_add; 45 | h->finish=sha256_finish; 46 | h->size=256/8; 47 | 48 | return h; 49 | } 50 | -------------------------------------------------------------------------------- /strings/apr_strtok.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifdef HAVE_STDDEF_H 18 | #include /* for NULL */ 19 | #endif 20 | 21 | #include "apr.h" 22 | #include "apr_strings.h" 23 | 24 | #define APR_WANT_STRFUNC /* for strchr() */ 25 | #include "apr_want.h" 26 | 27 | APR_DECLARE(char *) apr_strtok(char *str, const char *sep, char **last) 28 | { 29 | char *token; 30 | 31 | if (!str) /* subsequent call */ 32 | str = *last; /* start where we left off */ 33 | 34 | /* skip characters in sep (will terminate at '\0') */ 35 | while (*str && strchr(sep, *str)) 36 | ++str; 37 | 38 | if (!*str) /* no more tokens */ 39 | return NULL; 40 | 41 | token = str; 42 | 43 | /* skip valid token characters to terminate token and 44 | * prepare for the next call (will terminate at '\0) 45 | */ 46 | *last = token + 1; 47 | while (**last && !strchr(sep, **last)) 48 | ++*last; 49 | 50 | if (**last) { 51 | **last = '\0'; 52 | ++*last; 53 | } 54 | 55 | return token; 56 | } 57 | -------------------------------------------------------------------------------- /support/os2/waitio.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apr_arch_file_io.h" 18 | #include "apr_arch_networkio.h" 19 | #include "apr_errno.h" 20 | #include "apr_support.h" 21 | 22 | apr_status_t apr_wait_for_io_or_timeout(apr_file_t *f, apr_socket_t *s, 23 | int for_read) 24 | { 25 | if (f) { 26 | return apr_file_pipe_wait(f, for_read ? APR_WAIT_READ : APR_WAIT_WRITE); 27 | } 28 | else if (s) { 29 | return apr_socket_wait(s, for_read ? APR_WAIT_READ : APR_WAIT_WRITE); 30 | } 31 | 32 | /* Didn't specify a file or socket */ 33 | return APR_EINVAL; 34 | } 35 | -------------------------------------------------------------------------------- /test/data/billion-laughs.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | ]> 36 | &laugh30; 37 | -------------------------------------------------------------------------------- /test/data/file_datafile.txt: -------------------------------------------------------------------------------- 1 | This is the file data file. -------------------------------------------------------------------------------- /test/data/mmap_datafile.txt: -------------------------------------------------------------------------------- 1 | This is the MMAP data file. 2 | -------------------------------------------------------------------------------- /test/echoargs.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo 1: [%1] 3 | echo 2: [%2] 4 | echo 3: [%3] 5 | echo 4: [%4] 6 | echo 5: [%5] 7 | echo 6: [%6] 8 | echo 7: [%7] 9 | echo 8: [%8] 10 | echo 9: [%9] 11 | -------------------------------------------------------------------------------- /test/echoargs.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* Simple echo daemon, designed to be used for network throughput 18 | * benchmarks. The aim is to allow us to monitor changes in performance 19 | * of APR networking code, nothing more. 20 | */ 21 | 22 | #include 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | int main(int argc, const char * const *argv, const char* const* env) 29 | { 30 | apr_pool_t* pool; 31 | apr_file_t* file; 32 | int i; 33 | 34 | apr_app_initialize(&argc, &argv, &env); 35 | apr_pool_create(&pool, NULL); 36 | 37 | apr_file_open_stdout(&file, pool); 38 | for (i = 1; i < argc; i++) 39 | { 40 | apr_file_printf(file, "%d: [%s]\n", i, argv[i]); 41 | } 42 | 43 | apr_terminate(); 44 | 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /test/globalmutexchild.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "testglobalmutex.h" 18 | #include "apr_pools.h" 19 | #include "apr_file_io.h" 20 | #include "apr_general.h" 21 | #include "apr_global_mutex.h" 22 | #include "apr_strings.h" 23 | #include "apr.h" 24 | 25 | #if APR_HAVE_STDLIB_H 26 | #include 27 | #endif 28 | 29 | 30 | int main(int argc, const char * const argv[]) 31 | { 32 | apr_pool_t *p; 33 | int i = 0; 34 | apr_lockmech_e mech; 35 | apr_global_mutex_t *global_lock; 36 | apr_status_t rv; 37 | 38 | apr_initialize(); 39 | atexit(apr_terminate); 40 | 41 | apr_pool_create(&p, NULL); 42 | if (argc >= 2) { 43 | mech = (apr_lockmech_e)apr_strtoi64(argv[1], NULL, 0); 44 | } 45 | else { 46 | mech = APR_LOCK_DEFAULT; 47 | } 48 | rv = apr_global_mutex_create(&global_lock, LOCKNAME, mech, p); 49 | if (rv != APR_SUCCESS) { 50 | exit(-rv); 51 | } 52 | apr_global_mutex_child_init(&global_lock, LOCKNAME, p); 53 | 54 | while (1) { 55 | apr_global_mutex_lock(global_lock); 56 | if (i == MAX_ITER) { 57 | apr_global_mutex_unlock(global_lock); 58 | exit(i); 59 | } 60 | i++; 61 | apr_global_mutex_unlock(global_lock); 62 | } 63 | exit(0); 64 | } 65 | -------------------------------------------------------------------------------- /test/internal/Makefile.in: -------------------------------------------------------------------------------- 1 | srcdir = @srcdir@ 2 | VPATH = @srcdir@ 3 | 4 | NONPORTABLE = \ 5 | testregex@EXEEXT@ 6 | 7 | PROGRAMS = \ 8 | 9 | TARGETS = $(PROGRAMS) $(NONPORTABLE) 10 | 11 | # bring in rules.mk for standard functionality 12 | @INCLUDE_RULES@ 13 | 14 | LOCAL_LIBS=../../lib@APR_LIBNAME@.la 15 | 16 | CLEAN_TARGETS = testregex@EXEEXT@ 17 | 18 | INCDIR=../../include 19 | INCLUDES=-I$(INCDIR) 20 | 21 | CFLAGS=$(MY_CFLAGS) 22 | 23 | all: $(PROGRAMS) $(NONPORTABLE) 24 | 25 | check: $(PROGRAMS) $(NONPORTABLE) 26 | for prog in $(PROGRAMS) $(NONPORTABLE); do \ 27 | ./$$prog; \ 28 | if test $$i = 255; then \ 29 | echo "$$prog failed"; \ 30 | break; \ 31 | fi \ 32 | done 33 | 34 | testregex@EXEEXT@: testregex.lo $(LOCAL_LIBS) 35 | $(LINK) testregex.lo $(LOCAL_LIBS) $(ALL_LIBS) 36 | 37 | # DO NOT REMOVE 38 | -------------------------------------------------------------------------------- /test/mod_test.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apr_strings.h" 18 | 19 | void print_hello(char str[256]); 20 | int count_reps(int reps); 21 | 22 | void print_hello(char str[256]) 23 | { 24 | apr_cpystrn(str, "Hello - I'm a DSO!\n", strlen("Hello - I'm a DSO!\n") + 1); 25 | } 26 | 27 | int count_reps(int reps) 28 | { 29 | int i = 0; 30 | for (i = 0;i < reps; i++); 31 | return i; 32 | } 33 | -------------------------------------------------------------------------------- /test/nw_misc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | /* 5 | #include "testutil.h" 6 | */ 7 | 8 | /* function to keep the screen open if not launched from bash */ 9 | void _NonAppStop( void ) 10 | { 11 | if (getenv("_IN_NETWARE_BASH_") == NULL) { 12 | printf("\r\n "); 13 | getcharacter(); 14 | } 15 | } 16 | 17 | /* 18 | static void test_not_impl(CuTest *tc) 19 | { 20 | CuNotImpl(tc, "Test not implemented on this platform yet"); 21 | } 22 | */ 23 | 24 | -------------------------------------------------------------------------------- /test/occhild.c: -------------------------------------------------------------------------------- 1 | #include "apr.h" 2 | #include "apr_file_io.h" 3 | #include "apr.h" 4 | 5 | #if APR_HAVE_STDLIB_H 6 | #include 7 | #endif 8 | 9 | int main(void) 10 | { 11 | char buf[256]; 12 | apr_file_t *err; 13 | apr_pool_t *p; 14 | 15 | apr_initialize(); 16 | atexit(apr_terminate); 17 | 18 | apr_pool_create(&p, NULL); 19 | apr_file_open_stdin(&err, p); 20 | 21 | while (1) { 22 | apr_size_t length = 256; 23 | apr_file_read(err, buf, &length); 24 | } 25 | exit(0); /* just to keep the compiler happy */ 26 | } 27 | -------------------------------------------------------------------------------- /test/proc_child.c: -------------------------------------------------------------------------------- 1 | #include "apr.h" 2 | #include 3 | #if APR_HAVE_UNISTD_H 4 | #include 5 | #endif 6 | #if APR_HAVE_IO_H 7 | #include 8 | #endif 9 | #include 10 | 11 | int main(void) 12 | { 13 | char buf[256]; 14 | int bytes, rv = 0; 15 | 16 | bytes = (int)read(STDIN_FILENO, buf, 256); 17 | if (bytes > 0) 18 | rv = write(STDOUT_FILENO, buf, (unsigned int)bytes) == bytes ? 0 : 1; 19 | 20 | return rv; 21 | } 22 | -------------------------------------------------------------------------------- /test/readchild.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include "apr_file_io.h" 20 | 21 | int main(int argc, char *argv[]) 22 | { 23 | apr_file_t *in, *out; 24 | apr_size_t nbytes, total_bytes; 25 | apr_pool_t *p; 26 | char buf[128]; 27 | apr_status_t rv; 28 | 29 | apr_initialize(); 30 | atexit(apr_terminate); 31 | apr_pool_create(&p, NULL); 32 | 33 | apr_file_open_stdin(&in, p); 34 | apr_file_open_stdout(&out, p); 35 | 36 | total_bytes = 0; 37 | nbytes = sizeof(buf); 38 | while ((rv = apr_file_read(in, buf, &nbytes)) == APR_SUCCESS) { 39 | total_bytes += nbytes; 40 | nbytes = sizeof(buf); 41 | } 42 | 43 | apr_file_printf(out, "%" APR_SIZE_T_FMT " bytes were read\n", 44 | total_bytes); 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /test/testapp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc, const char * const * argv, const char * const *env) 5 | { 6 | apr_app_initialize(&argc, &argv, &env); 7 | 8 | 9 | apr_terminate(); 10 | } 11 | -------------------------------------------------------------------------------- /test/testflock.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef TESTFLOCK 18 | #define TESTFLOCK 19 | 20 | #define TESTFILE "data/testfile.lock" 21 | 22 | #define FAILED_READ 0 23 | #define SUCCESSFUL_READ 1 24 | #define UNEXPECTED_ERROR 2 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /test/testglobalmutex.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef TESTGLOBALMUTEX_H 18 | #define TESTGLOBALMUTEX_H 19 | 20 | /* set this to 255 so that the child processes can return it successfully. */ 21 | #define MAX_ITER 255 22 | #define MAX_COUNTER (MAX_ITER * 4) 23 | 24 | #define LOCKNAME "data/apr_globalmutex.lock" 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /test/testlfsabi.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "testutil.h" 18 | #include "testlfsabi.h" 19 | #include "apr_file_info.h" 20 | 21 | /* 22 | * Check that various types don't change size depending on 23 | * -D_FILE_OFFSET_BITS=64 24 | */ 25 | 26 | extern void get_type_sizes32(int *res); 27 | extern void get_type_sizes64(int *res); 28 | 29 | static void get_type_sizes(int *res) 30 | { 31 | #include "testlfsabi_include.c" 32 | } 33 | 34 | static void check_type_sizes(abts_case *tc, void *data) 35 | { 36 | int normal[IDX_MAX], bits32[IDX_MAX], bits64[IDX_MAX]; 37 | get_type_sizes(normal); 38 | get_type_sizes32(bits32); 39 | get_type_sizes64(bits64); 40 | CHECKSIZE(tc, normal, bits32, apr_dev_t); 41 | CHECKSIZE(tc, normal, bits64, apr_dev_t); 42 | CHECKSIZE(tc, normal, bits32, apr_ino_t); 43 | CHECKSIZE(tc, normal, bits64, apr_ino_t); 44 | CHECKSIZE(tc, normal, bits32, apr_off_t); 45 | CHECKSIZE(tc, normal, bits64, apr_off_t); 46 | CHECKSIZE(tc, normal, bits32, apr_socklen_t); 47 | CHECKSIZE(tc, normal, bits64, apr_socklen_t); 48 | CHECKSIZE(tc, normal, bits32, apr_size_t); 49 | CHECKSIZE(tc, normal, bits64, apr_size_t); 50 | } 51 | 52 | abts_suite *testlfsabi(abts_suite *suite) 53 | { 54 | suite = ADD_SUITE(suite) 55 | 56 | abts_run_test(suite, check_type_sizes, NULL); 57 | 58 | return suite; 59 | } 60 | 61 | -------------------------------------------------------------------------------- /test/testlfsabi.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "abts.h" 18 | 19 | #define IDX_apr_dev_t 0 20 | #define IDX_apr_ino_t 1 21 | #define IDX_apr_off_t 2 22 | #define IDX_apr_socklen_t 3 23 | #define IDX_apr_size_t 4 24 | #define IDX_MAX 5 25 | 26 | #define GETSIZE(res, type) res[(IDX_##type)] = sizeof(type) 27 | #define CHECKSIZE(tc, res1, res2, type) \ 28 | ABTS_INT_EQUAL(tc, res1[(IDX_##type)], res2[(IDX_##type)]); 29 | 30 | extern void get_type_sizes32(int *res); 31 | extern void get_type_sizes64(int *res); 32 | 33 | -------------------------------------------------------------------------------- /test/testlfsabi32.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifdef _FILE_OFFSET_BITS 18 | #undef _FILE_OFFSET_BITS 19 | #endif 20 | 21 | #define _FILE_OFFSET_BITS 32 22 | 23 | #include "testlfsabi.h" 24 | #include "apr_file_info.h" 25 | 26 | void get_type_sizes32(int *res) 27 | { 28 | #include "testlfsabi_include.c" 29 | } 30 | -------------------------------------------------------------------------------- /test/testlfsabi64.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifdef _FILE_OFFSET_BITS 18 | #undef _FILE_OFFSET_BITS 19 | #endif 20 | 21 | #define _FILE_OFFSET_BITS 64 22 | 23 | #include "testlfsabi.h" 24 | #include "apr_file_info.h" 25 | 26 | void get_type_sizes64(int *res) 27 | { 28 | #include "testlfsabi_include.c" 29 | } 30 | -------------------------------------------------------------------------------- /test/testlfsabi_include.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | GETSIZE(res, apr_dev_t); 18 | GETSIZE(res, apr_ino_t); 19 | GETSIZE(res, apr_off_t); 20 | GETSIZE(res, apr_socklen_t); 21 | GETSIZE(res, apr_size_t); 22 | -------------------------------------------------------------------------------- /test/testmemcache.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef TESTMEMCACHE_H 18 | #define TESTMEMCACHE_H 19 | 20 | #define MOCK_HOST "localhost" 21 | #define MOCK_PORT 11231 22 | 23 | #endif 24 | 25 | -------------------------------------------------------------------------------- /test/testshmconsumer.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apr_shm.h" 18 | #include "apr_errno.h" 19 | #include "apr_general.h" 20 | #include "apr_lib.h" 21 | #include "apr_strings.h" 22 | #include "apr_time.h" 23 | #include "testshm.h" 24 | #include "apr.h" 25 | 26 | #if APR_HAVE_STDLIB_H 27 | #include 28 | #endif 29 | 30 | 31 | #if APR_HAS_SHARED_MEMORY 32 | 33 | int main(void) 34 | { 35 | apr_status_t rv; 36 | apr_pool_t *pool; 37 | apr_shm_t *shm; 38 | int recvd; 39 | 40 | apr_initialize(); 41 | 42 | if (apr_pool_create(&pool, NULL) != APR_SUCCESS) { 43 | exit(-1); 44 | } 45 | 46 | rv = apr_shm_attach(&shm, SHARED_FILENAME, pool); 47 | if (rv != APR_SUCCESS) { 48 | exit(-2); 49 | } 50 | 51 | boxes = apr_shm_baseaddr_get(shm); 52 | 53 | /* consume messages on all of the boxes */ 54 | recvd = msgwait(MSG, N_MESSAGES, 30, 1); 55 | 56 | rv = apr_shm_detach(shm); 57 | if (rv != APR_SUCCESS) { 58 | exit(-3); 59 | } 60 | 61 | return recvd; 62 | } 63 | 64 | #else /* APR_HAS_SHARED_MEMORY */ 65 | 66 | int main(void) 67 | { 68 | /* Just return, this program will never be called, so we don't need 69 | * to print a message 70 | */ 71 | return 0; 72 | } 73 | 74 | #endif /* APR_HAS_SHARED_MEMORY */ 75 | 76 | -------------------------------------------------------------------------------- /test/testsleep.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "time.h" 18 | #include "apr_thread_proc.h" 19 | #include "apr_errno.h" 20 | #include "apr_general.h" 21 | #include "apr_lib.h" 22 | #include 23 | #include 24 | #include "testutil.h" 25 | 26 | #define SLEEP_INTERVAL 5 27 | 28 | static void sleep_one(abts_case *tc, void *data) 29 | { 30 | time_t pretime = time(NULL); 31 | time_t posttime; 32 | time_t timediff; 33 | 34 | apr_sleep(apr_time_from_sec(SLEEP_INTERVAL)); 35 | posttime = time(NULL); 36 | 37 | /* normalize the timediff. We should have slept for SLEEP_INTERVAL, so 38 | * we should just subtract that out. 39 | */ 40 | timediff = posttime - pretime - SLEEP_INTERVAL; 41 | ABTS_TRUE(tc, timediff >= 0); 42 | ABTS_TRUE(tc, timediff <= 1); 43 | } 44 | 45 | abts_suite *testsleep(abts_suite *suite) 46 | { 47 | suite = ADD_SUITE(suite) 48 | 49 | abts_run_test(suite, sleep_one, NULL); 50 | 51 | return suite; 52 | } 53 | 54 | -------------------------------------------------------------------------------- /test/testsock.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef TESTSOCK_H 18 | #define TESTSOCK_H 19 | 20 | #define DATASTR "This is a test" 21 | #define STRLEN 8092 22 | 23 | /* This is a hack. We can't return APR_TIMEOUT from sockchild, because 24 | * Unix OSes only return the least significant 8 bits of the return code, 25 | * which means that instead of receiving 70007, testsock gets 119. But, 26 | * we also don't want to return -1, because we use that value for general 27 | * errors from sockchild. So, we define 1 to mean that the read/write 28 | * operation timed out. This means that we can't write a test that tries 29 | * to send a single character between ends of the socket. 30 | */ 31 | #define SOCKET_TIMEOUT 1 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /test/testtemp.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "testutil.h" 18 | #include "apr_file_io.h" 19 | #include "apr_strings.h" 20 | 21 | static void test_temp_dir(abts_case *tc, void *data) 22 | { 23 | const char *tempdir = NULL; 24 | apr_status_t rv; 25 | 26 | rv = apr_temp_dir_get(&tempdir, p); 27 | APR_ASSERT_SUCCESS(tc, "Error finding Temporary Directory", rv); 28 | ABTS_PTR_NOTNULL(tc, tempdir); 29 | } 30 | 31 | static void test_mktemp(abts_case *tc, void *data) 32 | { 33 | apr_file_t *f = NULL; 34 | const char *tempdir = NULL; 35 | char *filetemplate; 36 | apr_status_t rv; 37 | 38 | rv = apr_temp_dir_get(&tempdir, p); 39 | APR_ASSERT_SUCCESS(tc, "Error finding Temporary Directory", rv); 40 | 41 | filetemplate = apr_pstrcat(p, tempdir, "/tempfileXXXXXX", NULL); 42 | rv = apr_file_mktemp(&f, filetemplate, 0, p); 43 | APR_ASSERT_SUCCESS(tc, "Error opening Temporary file", rv); 44 | } 45 | 46 | abts_suite *testtemp(abts_suite *suite) 47 | { 48 | suite = ADD_SUITE(suite) 49 | 50 | abts_run_test(suite, test_temp_dir, NULL); 51 | abts_run_test(suite, test_mktemp, NULL); 52 | 53 | return suite; 54 | } 55 | 56 | -------------------------------------------------------------------------------- /test/testuuid.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "testutil.h" 18 | #include "apr_general.h" 19 | #include "apr_uuid.h" 20 | 21 | static void test_uuid_parse(abts_case *tc, void *data) 22 | { 23 | apr_uuid_t uuid; 24 | apr_uuid_t uuid2; 25 | char buf[APR_UUID_FORMATTED_LENGTH + 1]; 26 | 27 | apr_uuid_get(&uuid); 28 | apr_uuid_format(buf, &uuid); 29 | 30 | apr_uuid_parse(&uuid2, buf); 31 | ABTS_ASSERT(tc, "parse produced a different UUID", 32 | memcmp(&uuid, &uuid2, sizeof(uuid)) == 0); 33 | } 34 | 35 | static void test_gen2(abts_case *tc, void *data) 36 | { 37 | apr_uuid_t uuid; 38 | apr_uuid_t uuid2; 39 | 40 | /* generate two of them quickly */ 41 | apr_uuid_get(&uuid); 42 | apr_uuid_get(&uuid2); 43 | 44 | ABTS_ASSERT(tc, "generated the same UUID twice", 45 | memcmp(&uuid, &uuid2, sizeof(uuid)) != 0); 46 | } 47 | 48 | abts_suite *testuuid(abts_suite *suite) 49 | { 50 | suite = ADD_SUITE(suite); 51 | 52 | abts_run_test(suite, test_uuid_parse, NULL); 53 | abts_run_test(suite, test_gen2, NULL); 54 | 55 | return suite; 56 | } 57 | -------------------------------------------------------------------------------- /test/testvsn.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include "testutil.h" 20 | #include "apr_version.h" 21 | #include "apr_general.h" 22 | 23 | 24 | static void test_strings(abts_case *tc, void *data) 25 | { 26 | ABTS_STR_EQUAL(tc, APR_VERSION_STRING, apr_version_string()); 27 | } 28 | 29 | #ifdef APR_IS_DEV_VERSION 30 | # define IS_DEV 1 31 | #else 32 | # define IS_DEV 0 33 | #endif 34 | 35 | static void test_ints(abts_case *tc, void *data) 36 | { 37 | apr_version_t vsn; 38 | 39 | apr_version(&vsn); 40 | 41 | ABTS_INT_EQUAL(tc, APR_MAJOR_VERSION, vsn.major); 42 | ABTS_INT_EQUAL(tc, APR_MINOR_VERSION, vsn.minor); 43 | ABTS_INT_EQUAL(tc, APR_PATCH_VERSION, vsn.patch); 44 | ABTS_INT_EQUAL(tc, IS_DEV, vsn.is_dev); 45 | } 46 | 47 | abts_suite *testvsn(abts_suite *suite) 48 | { 49 | suite = ADD_SUITE(suite) 50 | 51 | abts_run_test(suite, test_strings, NULL); 52 | abts_run_test(suite, test_ints, NULL); 53 | 54 | return suite; 55 | } 56 | 57 | -------------------------------------------------------------------------------- /test/tryread.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "testflock.h" 18 | #include "apr_pools.h" 19 | #include "apr_file_io.h" 20 | #include "apr_general.h" 21 | #include "apr.h" 22 | 23 | #if APR_HAVE_STDLIB_H 24 | #include 25 | #endif 26 | 27 | int main(int argc, const char * const *argv) 28 | { 29 | apr_file_t *file; 30 | apr_status_t status; 31 | apr_pool_t *p; 32 | 33 | apr_initialize(); 34 | apr_pool_create(&p, NULL); 35 | 36 | if (apr_file_open(&file, TESTFILE, APR_FOPEN_WRITE, APR_FPROT_OS_DEFAULT, p) 37 | != APR_SUCCESS) { 38 | 39 | exit(UNEXPECTED_ERROR); 40 | } 41 | status = apr_file_lock(file, APR_FLOCK_EXCLUSIVE | APR_FLOCK_NONBLOCK); 42 | if (status == APR_SUCCESS) { 43 | exit(SUCCESSFUL_READ); 44 | } 45 | if (APR_STATUS_IS_EAGAIN(status)) { 46 | exit(FAILED_READ); 47 | } 48 | exit(UNEXPECTED_ERROR); 49 | } 50 | -------------------------------------------------------------------------------- /threadproc/beos/apr_proc_stub.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | struct pipefd { 23 | int in; 24 | int out; 25 | int err; 26 | }; 27 | 28 | int main(int argc, char *argv[]) { 29 | /* we expect the following... 30 | * 31 | * argv[0] = this stub 32 | * argv[1] = directory to run in... 33 | * argv[2] = progname to execute 34 | * rest of arguments to be passed to program 35 | */ 36 | char *progname = argv[2]; 37 | char *directory = argv[1]; 38 | struct pipefd *pfd; 39 | thread_id sender; 40 | void *buffer; 41 | char ** newargs; 42 | int i = 0; 43 | 44 | newargs = (char**)malloc(sizeof(char*) * (argc - 1)); 45 | 46 | buffer = (void*)malloc(sizeof(struct pipefd)); 47 | /* this will block until we get the data */ 48 | receive_data(&sender, buffer, sizeof(struct pipefd)); 49 | pfd = (struct pipefd*)buffer; 50 | 51 | if (pfd->in > STDERR_FILENO) { 52 | if (dup2(pfd->in, STDIN_FILENO) != STDIN_FILENO) return (-1); 53 | close (pfd->in); 54 | } 55 | if (pfd->out > STDERR_FILENO) { 56 | if (dup2(pfd->out, STDOUT_FILENO) != STDOUT_FILENO) return (-1); 57 | close (pfd->out); 58 | } 59 | if (pfd->err > STDERR_FILENO) { 60 | if (dup2(pfd->err, STDERR_FILENO) != STDERR_FILENO) return (-1); 61 | close (pfd->err); 62 | } 63 | 64 | for (i=3;i<=argc;i++){ 65 | newargs[i-3] = argv[i]; 66 | } 67 | 68 | /* tell the caller we're OK to start */ 69 | send_data(sender,1,NULL,0); 70 | 71 | if (directory != NULL) 72 | chdir(directory); 73 | execve (progname, newargs, environ); 74 | 75 | return (-1); 76 | } 77 | -------------------------------------------------------------------------------- /threadproc/beos/threadproc_common.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /* As the signal code is identical, use the unix version to reduce 18 | code duplication */ 19 | #include "../unix/signals.c" 20 | #include "../unix/procsup.c" 21 | 22 | -------------------------------------------------------------------------------- /threadproc/netware/signals.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apr_arch_threadproc.h" 18 | #include "apr_private.h" 19 | #include "apr_pools.h" 20 | #include "apr_signal.h" 21 | #include "apr_strings.h" 22 | 23 | #include 24 | #if APR_HAS_THREADS && APR_HAVE_PTHREAD_H 25 | #include 26 | #endif 27 | 28 | APR_DECLARE(apr_status_t) apr_proc_kill(apr_proc_t *proc, int signum) 29 | { 30 | return APR_ENOTIMPL; 31 | } 32 | 33 | 34 | void apr_signal_init(apr_pool_t *pglobal) 35 | { 36 | } 37 | 38 | const char *apr_signal_description_get(int signum) 39 | { 40 | switch (signum) 41 | { 42 | case SIGABRT: 43 | return "Abort"; 44 | case SIGFPE: 45 | return "Arithmetic exception"; 46 | case SIGILL: 47 | return "Illegal instruction"; 48 | case SIGINT: 49 | return "Interrupt"; 50 | case SIGSEGV: 51 | return "Segmentation fault"; 52 | case SIGTERM: 53 | return "Terminated"; 54 | case SIGPOLL: 55 | return "Pollable event occurred"; 56 | default: 57 | return "unknown signal (not supported)"; 58 | } 59 | } 60 | 61 | static void *signal_thread_func(void *signal_handler) 62 | { 63 | return NULL; 64 | } 65 | 66 | #if (APR_HAVE_SIGWAIT || APR_HAVE_SIGSUSPEND) 67 | APR_DECLARE(apr_status_t) apr_setup_signal_thread(void) 68 | { 69 | return 0; 70 | } 71 | #endif /* (APR_HAVE_SIGWAIT || APR_HAVE_SIGSUSPEND) */ 72 | 73 | APR_DECLARE(apr_status_t) apr_signal_block(int signum) 74 | { 75 | return APR_ENOTIMPL; 76 | } 77 | 78 | APR_DECLARE(apr_status_t) apr_signal_unblock(int signum) 79 | { 80 | return APR_ENOTIMPL; 81 | } 82 | -------------------------------------------------------------------------------- /threadproc/os2/signals.c: -------------------------------------------------------------------------------- 1 | #define SIGPROCMASK_SETS_THREAD_MASK 1 2 | #include "../unix/signals.c" 3 | -------------------------------------------------------------------------------- /threadproc/win32/signals.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apr_arch_threadproc.h" 18 | #include "apr_arch_file_io.h" 19 | #include "apr_thread_proc.h" 20 | #include "apr_signal.h" 21 | #include "apr_file_io.h" 22 | #include "apr_general.h" 23 | #if APR_HAVE_SIGNAL_H 24 | #include 25 | #endif 26 | #include 27 | #if APR_HAVE_SYS_WAIT 28 | #include 29 | #endif 30 | 31 | /* Windows only really support killing process, but that will do for now. 32 | * 33 | * ### Actually, closing the input handle to the proc should also do fine 34 | * for most console apps. This definitely needs improvement... 35 | */ 36 | APR_DECLARE(apr_status_t) apr_proc_kill(apr_proc_t *proc, int signal) 37 | { 38 | if (proc->hproc != NULL) { 39 | if (TerminateProcess(proc->hproc, signal) == 0) { 40 | return apr_get_os_error(); 41 | } 42 | /* On unix, SIGKILL leaves a apr_proc_wait()able pid lying around, 43 | * so we will leave hproc alone until the app calls apr_proc_wait(). 44 | */ 45 | return APR_SUCCESS; 46 | } 47 | return APR_EPROC_UNKNOWN; 48 | } 49 | 50 | void apr_signal_init(apr_pool_t *pglobal) 51 | { 52 | } 53 | 54 | APR_DECLARE(const char *) apr_signal_description_get(int signum) 55 | { 56 | return "unknown signal (not supported)"; 57 | } 58 | 59 | APR_DECLARE(apr_status_t) apr_signal_block(int signum) 60 | { 61 | return APR_ENOTIMPL; 62 | } 63 | 64 | APR_DECLARE(apr_status_t) apr_signal_unblock(int signum) 65 | { 66 | return APR_ENOTIMPL; 67 | } 68 | -------------------------------------------------------------------------------- /user/netware/groupinfo.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apr_strings.h" 18 | #include "apr_portable.h" 19 | #include "apr_user.h" 20 | #include "apr_private.h" 21 | #ifdef HAVE_GRP_H 22 | #include 23 | #endif 24 | #if APR_HAVE_SYS_TYPES_H 25 | #include 26 | #endif 27 | #if APR_HAVE_UNISTD_H 28 | #include /* for _POSIX_THREAD_SAFE_FUNCTIONS */ 29 | #endif 30 | 31 | APR_DECLARE(apr_status_t) apr_gid_name_get(char **groupname, apr_gid_t groupid, 32 | apr_pool_t *p) 33 | { 34 | return APR_ENOTIMPL; 35 | } 36 | 37 | APR_DECLARE(apr_status_t) apr_gid_get(apr_gid_t *groupid, 38 | const char *groupname, apr_pool_t *p) 39 | { 40 | return APR_ENOTIMPL; 41 | } 42 | -------------------------------------------------------------------------------- /user/netware/userinfo.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "apr_strings.h" 18 | #include "apr_portable.h" 19 | #include "apr_user.h" 20 | #include "apr_private.h" 21 | #ifdef HAVE_PWD_H 22 | #include 23 | #endif 24 | #if APR_HAVE_SYS_TYPES_H 25 | #include 26 | #endif 27 | #if APR_HAVE_UNISTD_H 28 | #include /* for _POSIX_THREAD_SAFE_FUNCTIONS */ 29 | #endif 30 | 31 | #define PWBUF_SIZE 512 32 | 33 | static apr_status_t getpwnam_safe(const char *username, 34 | struct passwd *pw, 35 | char pwbuf[PWBUF_SIZE]) 36 | { 37 | return APR_ENOTIMPL; 38 | } 39 | 40 | APR_DECLARE(apr_status_t) apr_uid_homepath_get(char **dirname, 41 | const char *username, 42 | apr_pool_t *p) 43 | { 44 | return APR_ENOTIMPL; 45 | } 46 | 47 | 48 | 49 | APR_DECLARE(apr_status_t) apr_uid_current(apr_uid_t *uid, 50 | apr_gid_t *gid, 51 | apr_pool_t *p) 52 | { 53 | return APR_ENOTIMPL; 54 | } 55 | 56 | 57 | 58 | 59 | APR_DECLARE(apr_status_t) apr_uid_get(apr_uid_t *uid, apr_gid_t *gid, 60 | const char *username, apr_pool_t *p) 61 | { 62 | return APR_ENOTIMPL; 63 | } 64 | 65 | APR_DECLARE(apr_status_t) apr_uid_name_get(char **username, apr_uid_t userid, 66 | apr_pool_t *p) 67 | { 68 | return APR_ENOTIMPL; 69 | } 70 | 71 | -------------------------------------------------------------------------------- /util-misc/apr_error.c: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * levelations under the License. 15 | */ 16 | 17 | #include "apu.h" 18 | #include "apr_strings.h" 19 | #include "apr_pools.h" 20 | #include "apu_errno.h" 21 | 22 | APR_DECLARE_NONSTD(apu_err_t *) apr_errprintf(apu_err_t *result, 23 | apr_pool_t *p, const char *reason, int rc, const char *fmt, ...) 24 | { 25 | va_list ap; 26 | 27 | if (!result) { 28 | result = apr_pcalloc(p, sizeof(apu_err_t)); 29 | if (!result) { 30 | return NULL; 31 | } 32 | } 33 | 34 | va_start(ap, fmt); 35 | result->msg = apr_pvsprintf(p, fmt, ap); 36 | va_end(ap); 37 | 38 | result->reason = reason; 39 | result->rc = rc; 40 | 41 | return result; 42 | } 43 | 44 | -------------------------------------------------------------------------------- /xml/apr_xml_internal.h: -------------------------------------------------------------------------------- 1 | /* Licensed to the Apache Software Foundation (ASF) under one or more 2 | * contributor license agreements. See the NOTICE file distributed with 3 | * this work for additional information regarding copyright ownership. 4 | * The ASF licenses this file to You under the Apache License, Version 2.0 5 | * (the "License"); you may not use this file except in compliance with 6 | * the License. You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef APR_XML_INTERNAL_H 18 | #define APR_XML_INTERNAL_H 19 | 20 | 21 | struct XMLParserImpl { 22 | /** parse callback */ 23 | apr_status_t (*Parse)(apr_xml_parser*, const char*, apr_size_t, int); 24 | /** cleanup callback */ 25 | apr_status_t (*cleanup)(void*); 26 | }; 27 | typedef struct XMLParserImpl XMLParserImpl; 28 | XMLParserImpl* apr_xml_get_parser_impl(void); 29 | 30 | 31 | /* the real (internal) definition of the parser context */ 32 | struct apr_xml_parser { 33 | /** the doc we're parsing */ 34 | apr_xml_doc *doc; 35 | /** the pool we allocate from */ 36 | apr_pool_t *p; 37 | /** current element */ 38 | apr_xml_elem *cur_elem; 39 | /** an error has occurred */ 40 | int error; 41 | #define APR_XML_ERROR_EXPAT 1 42 | #define APR_XML_ERROR_PARSE_DONE 2 43 | /* also: public APR_XML_NS_ERROR_* values (if any) */ 44 | 45 | /** the actual (Expat) XML parser */ 46 | XML_Parser xp; 47 | /** stored Expat error code */ 48 | XML_Error xp_err; 49 | /** message */ 50 | const char *xp_msg; 51 | /** XML parser implementation */ 52 | XMLParserImpl *impl; 53 | }; 54 | 55 | apr_xml_parser* apr_xml_parser_create_internal(apr_pool_t*, void*, void*, void*); 56 | 57 | #endif 58 | --------------------------------------------------------------------------------