--- /dev/null
+#include <bindings.dsl.h>
+#include <apr_portable.h>
+
+module Bindings.APR.Portable where
+#strict_import
+import Bindings.APR
+import Bindings.APR.DSO
+import Bindings.APR.ErrNo
+import Bindings.APR.File.Info
+import Bindings.APR.File.Types
+import Bindings.APR.Global.Mutex
+import Bindings.APR.Network.IO
+import Bindings.APR.Pools
+import Bindings.APR.Proc.Mutex
+import Bindings.APR.Shm
+import Bindings.APR.Thread.Mutex
+import Bindings.APR.Thread.Proc
+import Bindings.APR.Time
+
+#opaque_t apr_os_file_t
+#opaque_t apr_os_dir_t
+#opaque_t apr_os_sock_t
+#opaque_t apr_os_proc_mutex_t
+#opaque_t apr_os_thread_t
+#opaque_t apr_os_proc_t
+#opaque_t apr_os_threadkey_t
+#opaque_t apr_os_imp_time_t
+#opaque_t apr_os_exp_time_t
+#opaque_t apr_os_dso_handle_t
+#opaque_t apr_os_shm_t
+
+#starttype struct apr_os_sock_info_t
+# field os_sock , Ptr <apr_os_sock_t>
+-- FIXME
+-- # field local , Ptr <sockaddr>
+-- # field remote , Ptr <sockaddr>
+# field family , CInt
+# field type , CInt
+# field protocol, CInt
+#stoptype
+
+#if APR_PROC_MUTEX_IS_GLOBAL
+type C'apr_os_global_mutex_t = C'apr_os_proc_mutex_t
+
+c'apr_os_global_mutex_get :: Ptr C'apr_os_global_mutex_t -> Ptr C'apr_global_mutex_t -> IO C'apr_status_t
+c'apr_os_global_mutex_get = c'apr_os_proc_mutex_get
+#else
+# starttype struct apr_os_global_mutex_t
+# field pool , Ptr <apr_pool_t>
+# field proc_mutex, Ptr <apr_proc_mutex_t>
+# if APR_HAS_THREADS
+# field thread_mutex, Ptr <apr_thread_mutex_t>
+# endif
+# stoptype
+
+# ccall apr_os_global_mutex_get, Ptr <apr_os_global_mutex_t> -> Ptr <apr_global_mutex_t> -> IO <apr_status_t>
+#endif
+
+#ccall apr_os_file_get , Ptr <apr_os_file_t> -> Ptr <apr_file_t> -> IO <apr_status_t>
+#ccall apr_os_dir_get , Ptr (Ptr <apr_os_dir_t>) -> Ptr <apr_dir_t> -> IO <apr_status_t>
+#ccall apr_os_sock_get , Ptr <apr_os_sock_t> -> Ptr <apr_socket_t> -> IO <apr_status_t>
+#ccall apr_os_proc_mutex_get, Ptr <apr_os_proc_mutex_t> -> Ptr <apr_proc_mutex_t> -> IO <apr_status_t>
+#ccall apr_os_exp_time_get , Ptr (Ptr <apr_os_exp_time_t>) -> Ptr <apr_time_exp_t> -> Ptr <apr_status_t>
+#ccall apr_os_imp_time_get , Ptr (Ptr <apr_os_imp_time_t>) -> Ptr <apr_time_t> -> Ptr <apr_status_t>
+#ccall apr_os_shm_get , Ptr <apr_os_shm_t> -> Ptr <apr_shm_t> -> IO <apr_status_t>
+
+#if APR_HAS_THREADS
+# ccall apr_os_thread_get , Ptr (Ptr <apr_os_thread_t>) -> Ptr <apr_thread_t> -> IO <apr_status_t>
+# ccall apr_os_threadkey_get , Ptr <apr_os_threadkey_t> -> Ptr <apr_threadkey_t> -> IO <apr_status_t>
+# ccall apr_os_thread_put , Ptr (Ptr <apr_thread_t>) -> Ptr <apr_os_thread_t> -> Ptr <apr_pool_t> -> IO <apr_status_t>
+# ccall apr_os_threadkey_put , Ptr (Ptr <apr_threadkey_t>) -> Ptr <apr_os_threadkey_t> -> Ptr <apr_pool_t> -> IO <apr_status_t>
+-- FIXME: apr_os_thread_t
+-- # ccall apr_os_thread_current, IO <apr_os_thread_t>
+#endif
+
+#ccall apr_os_file_put , Ptr (Ptr <apr_file_t>) -> Ptr <apr_os_file_t> -> <apr_int32_t> -> Ptr <apr_pool_t> -> IO <apr_status_t>
+#ccall apr_os_pipe_put , Ptr (Ptr <apr_file_t>) -> Ptr <apr_os_file_t> -> Ptr <apr_pool_t> -> IO <apr_status_t>
+#ccall apr_os_pipe_put_ex , Ptr (Ptr <apr_file_t>) -> Ptr <apr_os_file_t> -> CInt -> Ptr <apr_pool_t> -> IO <apr_status_t>
+#ccall apr_os_dir_put , Ptr (Ptr <apr_dir_t>) -> Ptr <apr_os_dir_t> -> Ptr <apr_pool_t> -> IO <apr_status_t>
+#ccall apr_os_sock_put , Ptr (Ptr <apr_socket_t>) -> Ptr <apr_os_sock_t> -> Ptr <apr_pool_t> -> IO <apr_status_t>
+#ccall apr_os_sock_make , Ptr (Ptr <apr_socket_t>) -> Ptr <apr_os_sock_info_t> -> Ptr <apr_pool_t> -> IO <apr_status_t>
+#ccall apr_os_proc_mutex_put, Ptr (Ptr <apr_proc_mutex_t>) -> Ptr <apr_os_proc_mutex_t> -> Ptr <apr_pool_t> -> IO <apr_status_t>
+#ccall apr_os_imp_time_put , Ptr <apr_time_t> -> Ptr (Ptr <apr_os_imp_time_t>) -> Ptr <apr_pool_t> -> IO <apr_status_t>
+#ccall apr_os_exp_time_put , Ptr <apr_time_exp_t> -> Ptr (Ptr <apr_os_exp_time_t>) -> Ptr <apr_pool_t> -> IO <apr_status_t>
+#ccall apr_os_shm_put , Ptr (Ptr <apr_shm_t>) -> Ptr <apr_os_shm_t> -> Ptr <apr_pool_t> -> IO <apr_status_t>
+
+#if APR_HAS_DSO
+# ccall apr_os_dso_handle_put, Ptr (Ptr <apr_dso_handle_t>) -> Ptr <apr_os_dso_handle_t> -> Ptr <apr_pool_t> -> IO <apr_status_t>
+# ccall apr_os_dso_handle_get, Ptr (Ptr <apr_os_dso_handle_t>) -> Ptr <apr_dso_handle_t> -> IO <apr_status_t>
+# if APR_HAS_OS_UUID
+# ccall apr_os_uuid_get , Ptr CUChar -> IO <apr_status_t>
+# endif
+#endif
+
+#ccall apr_os_default_encoding, Ptr <apr_pool_t> -> IO (Ptr CChar)
+#ccall apr_os_locale_encoding , Ptr <apr_pool_t> -> IO (Ptr CChar)
--- /dev/null
+#include <bindings.dsl.h>
+#include <apr_thread_proc.h>
+
+module Bindings.APR.Thread.Proc where
+#strict_import
+import Bindings.APR
+import Bindings.APR.ErrNo
+import Bindings.APR.File.Types
+import Bindings.APR.Pools
+import System.Posix.Types
+
+#integral_t apr_cmdtype_e
+#num APR_SHELLCMD
+#num APR_PROGRAM
+#num APR_PROGRAM_ENV
+#num APR_PROGRAM_PATH
+#num APR_SHELLCMD_ENV
+
+#integral_t apr_wait_how_e
+#num APR_WAIT
+#num APR_NOWAIT
+
+#integral_t apr_exit_why_e
+#num APR_PROC_EXIT
+#num APR_PROC_SIGNAL
+#num APR_PROC_SIGNAL_CORE
+
+#cinline APR_PROC_CHECK_EXIT , Ptr <apr_exit_why_e> -> IO CInt
+#cinline APR_PROC_CHECK_SIGNALED , Ptr <apr_exit_why_e> -> IO CInt
+#cinline APR_PROC_CHECK_CORE_DUMP, Ptr <apr_exit_why_e> -> IO CInt
+
+#num APR_NO_PIPE
+#num APR_FULL_BLOCK
+#num APR_FULL_NONBLOCK
+#num APR_PARENT_BLOCK
+#num APR_CHILD_BLOCK
+#num APR_NO_FILE
+
+#num APR_READ_BLOCK
+#num APR_WRITE_BLOCK
+
+#num APR_LIMIT_CPU
+#num APR_LIMIT_MEM
+#num APR_LIMIT_NPROC
+#num APR_LIMIT_NOFILE
+
+#num APR_OC_REASON_DEATH
+#num APR_OC_REASON_UNWRITABLE
+#num APR_OC_REASON_RESTART
+#num APR_OC_REASON_UNREGISTER
+#num APR_OC_REASON_LOST
+#num APR_OC_REASON_RUNNING
+
+#starttype struct apr_proc_t
+# field pid, CPid
+# field in , Ptr <apr_file_t>
+# field out, Ptr <apr_file_t>
+# field err, Ptr <apr_file_t>
+# if APR_HAS_PROC_INVOKED
+# field invoked, Ptr CCHar
+# endif
+#stoptype
+
+#callback apr_child_errfn_t, Ptr <apr_pool_t> -> <apr_status_t> -> Ptr CChar -> IO ()
+
+#opaque_t apr_thread_t
+#opaque_t apr_threadattr_t
+#opaque_t apr_procattr_t
+#opaque_t apr_thread_once_t
+#opaque_t apr_threadkey_t
+#opaque_t apr_other_child_rec_t
+
+#callback apr_thread_start_t, Ptr <apr_thread_t> -> Ptr () -> IO (Ptr ())
+
+#integral_t apr_kill_conditions_e
+#num APR_KILL_NEVER
+#num APR_KILL_ALWAYS
+#num APR_KILL_AFTER_TIMEOUT
+#num APR_JUST_WAIT
+#num APR_KILL_ONLY_ONCE
+
+#if APR_HAS_THREADS
+
+# ccall apr_threadattr_create , Ptr (Ptr <apr_threadattr_t>) -> Ptr <apr_pool_t> -> IO <apr_status_t>
+# ccall apr_threadattr_detach_set , Ptr <apr_threadattr_t> -> <apr_int32_t> -> IO <apr_status_t>
+# ccall apr_threadattr_detach_get , Ptr <apr_threadattr_t> -> IO <apr_status_t>
+# ccall apr_threadattr_stacksize_set, Ptr <apr_threadattr_t> -> <apr_size_t> -> IO <apr_status_t>
+# ccall apr_threadattr_guardsize_set, Ptr <apr_threadattr_t> -> <apr_size_t> -> IO <apr_status_t>
+
+# ccall apr_thread_create , Ptr (Ptr <apr_thread_t>) -> Ptr <apr_threadattr_t> -> <apr_thread_start_t> -> Ptr () -> Ptr <apr_pool_t> -> IO <apr_status_t>
+# ccall apr_thread_exit , Ptr <apr_thread_t> -> <apr_status_t> -> IO <apr_status_t>
+# ccall apr_thread_join , Ptr <apr_status_t> -> Ptr <apr_thread_t> -> IO <apr_status_t>
+# ccall apr_thread_yield , IO ()
+
+# ccall apr_thread_once_init, Ptr (Ptr <apr_thread_once_t>) -> Ptr <apr_pool_t> -> IO <apr_status_t>
+# ccall apr_thread_once , Ptr <apr_thread_once_t> -> FunPtr (IO ()) -> IO <apr_status_t>
+
+# ccall apr_thread_detach , Ptr <apr_thread_t> -> IO <apr_status_t>
+# ccall apr_thread_data_get , Ptr (Ptr ()) -> Ptr CChar -> Ptr <apr_thread_t> -> IO <apr_status_t>
+# ccall apr_thread_data_set , Ptr () -> Ptr CChar -> FunPtr (Ptr () -> IO <apr_status_t>) -> Ptr <apr_thread_t> -> IO <apr_status_t>
+
+# ccall apr_threadkey_private_create, Ptr (Ptr <apr_threadkey_t>) -> FunPtr (Ptr () -> IO ()) -> Ptr <apr_pool_t> -> IO <apr_status_t>
+# ccall apr_threadkey_private_get , Ptr (Ptr ()) -> Ptr <apr_threadkey_t> -> IO <apr_status_t>
+# ccall apr_threadkey_private_set , Ptr () -> Ptr <apr_threadkey_t> -> IO <apr_status_t>
+# ccall apr_threadkey_private_delete, Ptr <apr_threadkey_t> -> Ptr <apr_status_t>
+
+# ccall apr_threadkey_data_get, Ptr (Ptr ()) -> Ptr CChar -> Ptr <apr_threadkey_t> -> IO <apr_status_t>
+# ccall apr_threadkey_data_set, Ptr () -> Ptr CChar -> FunPtr (Ptr () -> IO <apr_status_t>) -> Ptr <apr_threadkey_t> -> IO <apr_status_t>
+
+#endif
+
+#ccall apr_procattr_create , Ptr (Ptr <apr_procattr_t>) -> Ptr <apr_pool_t> -> IO <apr_status_t>
+#ccall apr_procattr_io_set , Ptr <apr_procattr_t> -> <apr_int32_t> -> <apr_int32_t> -> <apr_int32_t> -> IO <apr_status_t>
+#ccall apr_procattr_child_in_set , Ptr <apr_procattr_t> -> Ptr <apr_file_t> -> Ptr <apr_file_t> -> IO <apr_status_t>
+#ccall apr_procattr_child_out_set, Ptr <apr_procattr_t> -> Ptr <apr_file_t> -> Ptr <apr_file_t> -> IO <apr_status_t>
+#ccall apr_procattr_child_err_set, Ptr <apr_procattr_t> -> Ptr <apr_file_t> -> Ptr <apr_file_t> -> IO <apr_status_t>
+#ccall apr_procattr_dir_set , Ptr <apr_procattr_t> -> Ptr CChar -> IO <apr_status_t>
+#ccall apr_procattr_cmdtype_set , Ptr <apr_procattr_t> -> <apr_cmdtype_e> -> IO <apr_status_t>
+#ccall apr_procattr_detach_set , Ptr <apr_procattr_t> -> <apr_int32_t> -> IO <apr_status_t>
+
+#if APR_HAVE_STRUCT_RLIMIT
+-- FIXME: rlimit
+-- # ccall apr_procattr_limit_set , Ptr <apr_procattr_t> -> <apr_int32_t> -> Ptr <rlimit> -> IO <apr_status_t>
+#endif
+
+#ccall apr_procattr_child_errfn_set, Ptr <apr_procattr_t> -> <apr_child_errfn_t> -> IO <apr_status_t>
+#ccall apr_procattr_error_check_set, Ptr <apr_procattr_t> -> <apr_int32_t> -> IO <apr_status_t>
+#ccall apr_procattr_addrspace_set , Ptr <apr_procattr_t> -> <apr_int32_t> -> IO <apr_status_t>
+#ccall apr_procattr_user_set , Ptr <apr_procattr_t> -> Ptr CChar -> Ptr CChar -> IO <apr_status_t>
+#ccall apr_procattr_group_set , Ptr <apr_procattr_t> -> Ptr CChar -> Ptr <apr_status_t>
+
+#if APR_HAS_FORK
+# ccall apr_proc_fork, Ptr <apr_proc_t> -> Ptr <apr_pool_t> -> IO <apr_status_t>
+#endif
+
+#ccall apr_proc_create , Ptr <apr_proc_t> -> Ptr CChar -> Ptr (Ptr CChar) -> Ptr (Ptr CChar) -> Ptr <apr_procattr_t> -> Ptr <apr_pool_t> -> IO <apr_status_t>
+#ccall apr_proc_wait , Ptr <apr_proc_t> -> Ptr CInt -> Ptr <apr_exit_why_e> -> <apr_wait_how_e> -> IO <apr_status_t>
+#ccall apr_proc_wait_all_procs, Ptr <apr_proc_t> -> Ptr CInt -> Ptr <apr_exit_why_e> -> <apr_wait_how_e> -> Ptr <apr_pool_t> -> IO <apr_status_t>
+
+#num APR_PROC_DETACH_FOREGROUND
+#num APR_PROC_DETACH_DAEMONIZE
+
+#ccall apr_proc_detach , CInt -> IO <apr_status_t>
+#ccall apr_proc_other_child_register , Ptr <apr_proc_t> -> FunPtr (CInt -> Ptr () -> CInt -> IO ()) -> Ptr () -> Ptr <apr_file_t> -> Ptr <apr_pool_t> -> IO ()
+#ccall apr_proc_other_child_unregister , Ptr () -> IO ()
+#ccall apr_proc_other_child_alert , Ptr <apr_proc_t> -> CInt -> CInt -> IO <apr_status_t>
+#ccall apr_proc_other_child_refresh , Ptr <apr_other_child_rec_t> -> CInt -> IO ()
+#ccall apr_proc_other_child_refresh_all, CInt -> IO ()
+#ccall apr_proc_kill , Ptr <apr_proc_t> -> CInt -> IO <apr_status_t>
+#ccall apr_pool_note_subprocess , Ptr <apr_pool_t> -> Ptr <apr_pool_t> -> <apr_kill_conditions_e> -> IO ()
+
+#if APR_HAS_THREADS
+
+# if (APR_HAVE_SIGWAIT || APR_HAVE_SIGSUSPEND) && !defined(OS2)
+# ccall apr_setup_signal_thread, IO <apr_status_t>
+# ccall apr_signal_thread , FunPtr (CInt -> IO CInt) -> IO <apr_status_t>
+# endif
+
+# ccall apr_thread_pool_get, Ptr <apr_thread_t> -> IO (Ptr <apr_pool_t>)
+
+#endif