From: PHO Date: Sat, 21 Aug 2010 04:47:28 +0000 (+0900) Subject: Bindings.APR.Portable X-Git-Tag: RELEASE-0.1~15 X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;h=c3100272dedde8dcb76594ad7b3c0559707ec638;p=bindings-apr.git Bindings.APR.Portable --- diff --git a/Bindings/APR/Portable.hsc b/Bindings/APR/Portable.hsc new file mode 100644 index 0000000..288b49f --- /dev/null +++ b/Bindings/APR/Portable.hsc @@ -0,0 +1,96 @@ +#include +#include + +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 +-- FIXME +-- # field local , Ptr +-- # field remote , Ptr +# 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 +# field proc_mutex, Ptr +# if APR_HAS_THREADS +# field thread_mutex, Ptr +# endif +# stoptype + +# ccall apr_os_global_mutex_get, Ptr -> Ptr -> IO +#endif + +#ccall apr_os_file_get , Ptr -> Ptr -> IO +#ccall apr_os_dir_get , Ptr (Ptr ) -> Ptr -> IO +#ccall apr_os_sock_get , Ptr -> Ptr -> IO +#ccall apr_os_proc_mutex_get, Ptr -> Ptr -> IO +#ccall apr_os_exp_time_get , Ptr (Ptr ) -> Ptr -> Ptr +#ccall apr_os_imp_time_get , Ptr (Ptr ) -> Ptr -> Ptr +#ccall apr_os_shm_get , Ptr -> Ptr -> IO + +#if APR_HAS_THREADS +# ccall apr_os_thread_get , Ptr (Ptr ) -> Ptr -> IO +# ccall apr_os_threadkey_get , Ptr -> Ptr -> IO +# ccall apr_os_thread_put , Ptr (Ptr ) -> Ptr -> Ptr -> IO +# ccall apr_os_threadkey_put , Ptr (Ptr ) -> Ptr -> Ptr -> IO +-- FIXME: apr_os_thread_t +-- # ccall apr_os_thread_current, IO +#endif + +#ccall apr_os_file_put , Ptr (Ptr ) -> Ptr -> -> Ptr -> IO +#ccall apr_os_pipe_put , Ptr (Ptr ) -> Ptr -> Ptr -> IO +#ccall apr_os_pipe_put_ex , Ptr (Ptr ) -> Ptr -> CInt -> Ptr -> IO +#ccall apr_os_dir_put , Ptr (Ptr ) -> Ptr -> Ptr -> IO +#ccall apr_os_sock_put , Ptr (Ptr ) -> Ptr -> Ptr -> IO +#ccall apr_os_sock_make , Ptr (Ptr ) -> Ptr -> Ptr -> IO +#ccall apr_os_proc_mutex_put, Ptr (Ptr ) -> Ptr -> Ptr -> IO +#ccall apr_os_imp_time_put , Ptr -> Ptr (Ptr ) -> Ptr -> IO +#ccall apr_os_exp_time_put , Ptr -> Ptr (Ptr ) -> Ptr -> IO +#ccall apr_os_shm_put , Ptr (Ptr ) -> Ptr -> Ptr -> IO + +#if APR_HAS_DSO +# ccall apr_os_dso_handle_put, Ptr (Ptr ) -> Ptr -> Ptr -> IO +# ccall apr_os_dso_handle_get, Ptr (Ptr ) -> Ptr -> IO +# if APR_HAS_OS_UUID +# ccall apr_os_uuid_get , Ptr CUChar -> IO +# endif +#endif + +#ccall apr_os_default_encoding, Ptr -> IO (Ptr CChar) +#ccall apr_os_locale_encoding , Ptr -> IO (Ptr CChar) diff --git a/Bindings/APR/Shm.hsc b/Bindings/APR/Shm.hsc new file mode 100644 index 0000000..cfd54c0 --- /dev/null +++ b/Bindings/APR/Shm.hsc @@ -0,0 +1,20 @@ +#include +#include + +module Bindings.APR.Shm where +#strict_import +import Bindings.APR +import Bindings.APR.ErrNo +import Bindings.APR.Pools + +#opaque_t apr_shm_t + +#ccall apr_shm_create , Ptr (Ptr ) -> -> Ptr CChar -> Ptr -> IO +#ccall apr_shm_remove , Ptr CChar -> Ptr -> IO +#ccall apr_shm_destroy , Ptr -> IO +#ccall apr_shm_attach , Ptr (Ptr ) -> Ptr CChar -> Ptr -> IO +#ccall apr_shm_detach , Ptr -> IO +#ccall apr_shm_baseaddr_get, Ptr -> IO (Ptr ()) +#ccall apr_shm_size_get , Ptr -> IO + +#ccall apr_shm_pool_get , Ptr -> IO (Ptr ) diff --git a/Bindings/APR/Thread/Proc.hsc b/Bindings/APR/Thread/Proc.hsc new file mode 100644 index 0000000..557c8fe --- /dev/null +++ b/Bindings/APR/Thread/Proc.hsc @@ -0,0 +1,161 @@ +#include +#include + +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 -> IO CInt +#cinline APR_PROC_CHECK_SIGNALED , Ptr -> IO CInt +#cinline APR_PROC_CHECK_CORE_DUMP, Ptr -> 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 +# field out, Ptr +# field err, Ptr +# if APR_HAS_PROC_INVOKED +# field invoked, Ptr CCHar +# endif +#stoptype + +#callback apr_child_errfn_t, Ptr -> -> 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 -> 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 ) -> Ptr -> IO +# ccall apr_threadattr_detach_set , Ptr -> -> IO +# ccall apr_threadattr_detach_get , Ptr -> IO +# ccall apr_threadattr_stacksize_set, Ptr -> -> IO +# ccall apr_threadattr_guardsize_set, Ptr -> -> IO + +# ccall apr_thread_create , Ptr (Ptr ) -> Ptr -> -> Ptr () -> Ptr -> IO +# ccall apr_thread_exit , Ptr -> -> IO +# ccall apr_thread_join , Ptr -> Ptr -> IO +# ccall apr_thread_yield , IO () + +# ccall apr_thread_once_init, Ptr (Ptr ) -> Ptr -> IO +# ccall apr_thread_once , Ptr -> FunPtr (IO ()) -> IO + +# ccall apr_thread_detach , Ptr -> IO +# ccall apr_thread_data_get , Ptr (Ptr ()) -> Ptr CChar -> Ptr -> IO +# ccall apr_thread_data_set , Ptr () -> Ptr CChar -> FunPtr (Ptr () -> IO ) -> Ptr -> IO + +# ccall apr_threadkey_private_create, Ptr (Ptr ) -> FunPtr (Ptr () -> IO ()) -> Ptr -> IO +# ccall apr_threadkey_private_get , Ptr (Ptr ()) -> Ptr -> IO +# ccall apr_threadkey_private_set , Ptr () -> Ptr -> IO +# ccall apr_threadkey_private_delete, Ptr -> Ptr + +# ccall apr_threadkey_data_get, Ptr (Ptr ()) -> Ptr CChar -> Ptr -> IO +# ccall apr_threadkey_data_set, Ptr () -> Ptr CChar -> FunPtr (Ptr () -> IO ) -> Ptr -> IO + +#endif + +#ccall apr_procattr_create , Ptr (Ptr ) -> Ptr -> IO +#ccall apr_procattr_io_set , Ptr -> -> -> -> IO +#ccall apr_procattr_child_in_set , Ptr -> Ptr -> Ptr -> IO +#ccall apr_procattr_child_out_set, Ptr -> Ptr -> Ptr -> IO +#ccall apr_procattr_child_err_set, Ptr -> Ptr -> Ptr -> IO +#ccall apr_procattr_dir_set , Ptr -> Ptr CChar -> IO +#ccall apr_procattr_cmdtype_set , Ptr -> -> IO +#ccall apr_procattr_detach_set , Ptr -> -> IO + +#if APR_HAVE_STRUCT_RLIMIT +-- FIXME: rlimit +-- # ccall apr_procattr_limit_set , Ptr -> -> Ptr -> IO +#endif + +#ccall apr_procattr_child_errfn_set, Ptr -> -> IO +#ccall apr_procattr_error_check_set, Ptr -> -> IO +#ccall apr_procattr_addrspace_set , Ptr -> -> IO +#ccall apr_procattr_user_set , Ptr -> Ptr CChar -> Ptr CChar -> IO +#ccall apr_procattr_group_set , Ptr -> Ptr CChar -> Ptr + +#if APR_HAS_FORK +# ccall apr_proc_fork, Ptr -> Ptr -> IO +#endif + +#ccall apr_proc_create , Ptr -> Ptr CChar -> Ptr (Ptr CChar) -> Ptr (Ptr CChar) -> Ptr -> Ptr -> IO +#ccall apr_proc_wait , Ptr -> Ptr CInt -> Ptr -> -> IO +#ccall apr_proc_wait_all_procs, Ptr -> Ptr CInt -> Ptr -> -> Ptr -> IO + +#num APR_PROC_DETACH_FOREGROUND +#num APR_PROC_DETACH_DAEMONIZE + +#ccall apr_proc_detach , CInt -> IO +#ccall apr_proc_other_child_register , Ptr -> FunPtr (CInt -> Ptr () -> CInt -> IO ()) -> Ptr () -> Ptr -> Ptr -> IO () +#ccall apr_proc_other_child_unregister , Ptr () -> IO () +#ccall apr_proc_other_child_alert , Ptr -> CInt -> CInt -> IO +#ccall apr_proc_other_child_refresh , Ptr -> CInt -> IO () +#ccall apr_proc_other_child_refresh_all, CInt -> IO () +#ccall apr_proc_kill , Ptr -> CInt -> IO +#ccall apr_pool_note_subprocess , Ptr -> Ptr -> -> IO () + +#if APR_HAS_THREADS + +# if (APR_HAVE_SIGWAIT || APR_HAVE_SIGSUSPEND) && !defined(OS2) +# ccall apr_setup_signal_thread, IO +# ccall apr_signal_thread , FunPtr (CInt -> IO CInt) -> IO +# endif + +# ccall apr_thread_pool_get, Ptr -> IO (Ptr ) + +#endif diff --git a/bindings-apr.cabal b/bindings-apr.cabal index 440045f..1e573ce 100644 --- a/bindings-apr.cabal +++ b/bindings-apr.cabal @@ -49,9 +49,12 @@ Library Bindings.APR.Network.IO Bindings.APR.Poll Bindings.APR.Pools + Bindings.APR.Portable Bindings.APR.Proc.Mutex + Bindings.APR.Shm Bindings.APR.Tables Bindings.APR.Thread.Mutex + Bindings.APR.Thread.Proc Bindings.APR.Thread.RWLock Bindings.APR.Time Bindings.APR.User @@ -65,6 +68,7 @@ Library cbits/helper_apr_lib.c cbits/helper_apr_mmap.c cbits/helper_apr_time.c + cbits/helper_apr_thread_proc.c cbits/helper_apr_user.c Extensions: diff --git a/cbits/helper_apr_thread_proc.c b/cbits/helper_apr_thread_proc.c new file mode 100644 index 0000000..e1cd851 --- /dev/null +++ b/cbits/helper_apr_thread_proc.c @@ -0,0 +1,6 @@ +#include +#include + +BC_INLINE1(APR_PROC_CHECK_EXIT , apr_exit_why_e, int) +BC_INLINE1(APR_PROC_CHECK_SIGNALED , apr_exit_why_e, int) +BC_INLINE1(APR_PROC_CHECK_CORE_DUMP, apr_exit_why_e, int)