]> gitweb @ CieloNegro.org - bindings-apr.git/blob - Bindings/APR/Thread/Proc.hsc
Bindings.APR.Portable
[bindings-apr.git] / Bindings / APR / Thread / Proc.hsc
1 #include <bindings.dsl.h>
2 #include <apr_thread_proc.h>
3
4 module Bindings.APR.Thread.Proc where
5 #strict_import
6 import Bindings.APR
7 import Bindings.APR.ErrNo
8 import Bindings.APR.File.Types
9 import Bindings.APR.Pools
10 import System.Posix.Types
11
12 #integral_t apr_cmdtype_e
13 #num APR_SHELLCMD
14 #num APR_PROGRAM
15 #num APR_PROGRAM_ENV
16 #num APR_PROGRAM_PATH
17 #num APR_SHELLCMD_ENV
18
19 #integral_t apr_wait_how_e
20 #num APR_WAIT
21 #num APR_NOWAIT
22
23 #integral_t apr_exit_why_e
24 #num APR_PROC_EXIT
25 #num APR_PROC_SIGNAL
26 #num APR_PROC_SIGNAL_CORE
27
28 #cinline APR_PROC_CHECK_EXIT     , Ptr <apr_exit_why_e> -> IO CInt
29 #cinline APR_PROC_CHECK_SIGNALED , Ptr <apr_exit_why_e> -> IO CInt
30 #cinline APR_PROC_CHECK_CORE_DUMP, Ptr <apr_exit_why_e> -> IO CInt
31
32 #num APR_NO_PIPE
33 #num APR_FULL_BLOCK
34 #num APR_FULL_NONBLOCK
35 #num APR_PARENT_BLOCK
36 #num APR_CHILD_BLOCK
37 #num APR_NO_FILE
38
39 #num APR_READ_BLOCK
40 #num APR_WRITE_BLOCK
41
42 #num APR_LIMIT_CPU
43 #num APR_LIMIT_MEM
44 #num APR_LIMIT_NPROC
45 #num APR_LIMIT_NOFILE
46
47 #num APR_OC_REASON_DEATH
48 #num APR_OC_REASON_UNWRITABLE
49 #num APR_OC_REASON_RESTART
50 #num APR_OC_REASON_UNREGISTER
51 #num APR_OC_REASON_LOST
52 #num APR_OC_REASON_RUNNING
53
54 #starttype struct apr_proc_t
55 #  field pid, CPid
56 #  field in , Ptr <apr_file_t>
57 #  field out, Ptr <apr_file_t>
58 #  field err, Ptr <apr_file_t>
59 #  if APR_HAS_PROC_INVOKED
60 #    field invoked, Ptr CCHar
61 #  endif
62 #stoptype
63
64 #callback apr_child_errfn_t, Ptr <apr_pool_t> -> <apr_status_t> -> Ptr CChar -> IO ()
65
66 #opaque_t apr_thread_t
67 #opaque_t apr_threadattr_t
68 #opaque_t apr_procattr_t
69 #opaque_t apr_thread_once_t
70 #opaque_t apr_threadkey_t
71 #opaque_t apr_other_child_rec_t
72
73 #callback apr_thread_start_t, Ptr <apr_thread_t> -> Ptr () -> IO (Ptr ())
74
75 #integral_t apr_kill_conditions_e
76 #num APR_KILL_NEVER
77 #num APR_KILL_ALWAYS
78 #num APR_KILL_AFTER_TIMEOUT
79 #num APR_JUST_WAIT
80 #num APR_KILL_ONLY_ONCE
81
82 #if APR_HAS_THREADS
83
84 #  ccall apr_threadattr_create       , Ptr (Ptr <apr_threadattr_t>) -> Ptr <apr_pool_t> -> IO <apr_status_t>
85 #  ccall apr_threadattr_detach_set   , Ptr <apr_threadattr_t> -> <apr_int32_t> -> IO <apr_status_t>
86 #  ccall apr_threadattr_detach_get   , Ptr <apr_threadattr_t> -> IO <apr_status_t>
87 #  ccall apr_threadattr_stacksize_set, Ptr <apr_threadattr_t> -> <apr_size_t> -> IO <apr_status_t>
88 #  ccall apr_threadattr_guardsize_set, Ptr <apr_threadattr_t> -> <apr_size_t> -> IO <apr_status_t>
89
90 #  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>
91 #  ccall apr_thread_exit     , Ptr <apr_thread_t> -> <apr_status_t> -> IO <apr_status_t>
92 #  ccall apr_thread_join     , Ptr <apr_status_t> -> Ptr <apr_thread_t> -> IO <apr_status_t>
93 #  ccall apr_thread_yield    , IO ()
94
95 #  ccall apr_thread_once_init, Ptr (Ptr <apr_thread_once_t>) -> Ptr <apr_pool_t> -> IO <apr_status_t>
96 #  ccall apr_thread_once     , Ptr <apr_thread_once_t> -> FunPtr (IO ()) -> IO <apr_status_t>
97
98 #  ccall apr_thread_detach   , Ptr <apr_thread_t> -> IO <apr_status_t>
99 #  ccall apr_thread_data_get , Ptr (Ptr ()) -> Ptr CChar -> Ptr <apr_thread_t> -> IO <apr_status_t>
100 #  ccall apr_thread_data_set , Ptr () -> Ptr CChar -> FunPtr (Ptr () -> IO <apr_status_t>) -> Ptr <apr_thread_t> -> IO <apr_status_t>
101
102 #  ccall apr_threadkey_private_create, Ptr (Ptr <apr_threadkey_t>) -> FunPtr (Ptr () -> IO ()) -> Ptr <apr_pool_t> -> IO <apr_status_t>
103 #  ccall apr_threadkey_private_get   , Ptr (Ptr ()) -> Ptr <apr_threadkey_t> -> IO <apr_status_t>
104 #  ccall apr_threadkey_private_set   , Ptr () -> Ptr <apr_threadkey_t> -> IO <apr_status_t>
105 #  ccall apr_threadkey_private_delete, Ptr <apr_threadkey_t> -> Ptr <apr_status_t>
106
107 #  ccall apr_threadkey_data_get, Ptr (Ptr ()) -> Ptr CChar -> Ptr <apr_threadkey_t> -> IO <apr_status_t>
108 #  ccall apr_threadkey_data_set, Ptr () -> Ptr CChar -> FunPtr (Ptr () -> IO <apr_status_t>) -> Ptr <apr_threadkey_t> -> IO <apr_status_t>
109
110 #endif
111
112 #ccall apr_procattr_create       , Ptr (Ptr <apr_procattr_t>) -> Ptr <apr_pool_t> -> IO <apr_status_t>
113 #ccall apr_procattr_io_set       , Ptr <apr_procattr_t> -> <apr_int32_t> -> <apr_int32_t> -> <apr_int32_t> -> IO <apr_status_t>
114 #ccall apr_procattr_child_in_set , Ptr <apr_procattr_t> -> Ptr <apr_file_t> -> Ptr <apr_file_t> -> IO <apr_status_t>
115 #ccall apr_procattr_child_out_set, Ptr <apr_procattr_t> -> Ptr <apr_file_t> -> Ptr <apr_file_t> -> IO <apr_status_t>
116 #ccall apr_procattr_child_err_set, Ptr <apr_procattr_t> -> Ptr <apr_file_t> -> Ptr <apr_file_t> -> IO <apr_status_t>
117 #ccall apr_procattr_dir_set      , Ptr <apr_procattr_t> -> Ptr CChar -> IO <apr_status_t>
118 #ccall apr_procattr_cmdtype_set  , Ptr <apr_procattr_t> -> <apr_cmdtype_e> -> IO <apr_status_t>
119 #ccall apr_procattr_detach_set   , Ptr <apr_procattr_t> -> <apr_int32_t> -> IO <apr_status_t>
120
121 #if APR_HAVE_STRUCT_RLIMIT
122 -- FIXME: rlimit
123 -- #  ccall apr_procattr_limit_set  , Ptr <apr_procattr_t> -> <apr_int32_t> -> Ptr <rlimit> -> IO <apr_status_t>
124 #endif
125
126 #ccall apr_procattr_child_errfn_set, Ptr <apr_procattr_t> -> <apr_child_errfn_t> -> IO <apr_status_t>
127 #ccall apr_procattr_error_check_set, Ptr <apr_procattr_t> -> <apr_int32_t> -> IO <apr_status_t>
128 #ccall apr_procattr_addrspace_set  , Ptr <apr_procattr_t> -> <apr_int32_t> -> IO <apr_status_t>
129 #ccall apr_procattr_user_set       , Ptr <apr_procattr_t> -> Ptr CChar -> Ptr CChar -> IO <apr_status_t>
130 #ccall apr_procattr_group_set      , Ptr <apr_procattr_t> -> Ptr CChar -> Ptr <apr_status_t>
131
132 #if APR_HAS_FORK
133 #  ccall apr_proc_fork, Ptr <apr_proc_t> -> Ptr <apr_pool_t> -> IO <apr_status_t>
134 #endif
135
136 #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>
137 #ccall apr_proc_wait          , Ptr <apr_proc_t> -> Ptr CInt -> Ptr <apr_exit_why_e> -> <apr_wait_how_e> -> IO <apr_status_t>
138 #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>
139
140 #num APR_PROC_DETACH_FOREGROUND
141 #num APR_PROC_DETACH_DAEMONIZE
142
143 #ccall apr_proc_detach                 , CInt -> IO <apr_status_t>
144 #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 ()
145 #ccall apr_proc_other_child_unregister , Ptr () -> IO ()
146 #ccall apr_proc_other_child_alert      , Ptr <apr_proc_t> -> CInt -> CInt -> IO <apr_status_t>
147 #ccall apr_proc_other_child_refresh    , Ptr <apr_other_child_rec_t> -> CInt -> IO ()
148 #ccall apr_proc_other_child_refresh_all, CInt -> IO ()
149 #ccall apr_proc_kill                   , Ptr <apr_proc_t> -> CInt -> IO <apr_status_t>
150 #ccall apr_pool_note_subprocess        , Ptr <apr_pool_t> -> Ptr <apr_pool_t> -> <apr_kill_conditions_e> -> IO ()
151
152 #if APR_HAS_THREADS
153
154 #  if (APR_HAVE_SIGWAIT || APR_HAVE_SIGSUSPEND) && !defined(OS2)
155 #    ccall apr_setup_signal_thread, IO <apr_status_t>
156 #    ccall apr_signal_thread      , FunPtr (CInt -> IO CInt) -> IO <apr_status_t>
157 #  endif
158
159 #  ccall apr_thread_pool_get, Ptr <apr_thread_t> -> IO (Ptr <apr_pool_t>)
160
161 #endif