����C %# , #&')*)-0-(0%()(��C (((((((((((((((((((((((((((((((((((((((((((((((((((����"�������@�@�hC��}!���Ѱ��<"� 9iׂIIIHk�+?�c?��*Y�����!�du)b�T�9вU�$8G��I.�澬��D���Sq� q�}.<��Z�l�V!X� *x�-�\����t3i�Ũ�sNv71�ƛ\��z|t�L���$�����*f��kʮ��7�H;���~F%�'3�@�H�q�` 9mOL����/x@ @��G
d�8F�ه��Ka�Kdr�Fh.�]y4 JЛ��]�K�B�E$��$ $ �PR�����G�]��u�i$�$���'! "#031���C/Td=S�Q?���62Ccj{ ����̏d�چ/c�V�`��Wz͈�{Y`�d�h�L �]OB���l���o���mr���n��s-ڗEZ��N�_��1%b���H�ϣ������V�7):�ӷ)�}�~�(�;�!�b1�5K��[E�vϻ>��q.%� ���O���(�c�#x�$�'+��`٥v��v(�����M�"�v��B��.�a ���T�~�ϕ�hy(6nݱl��1yNɓx�������AR�8�rqv1.cS�+��_���&@�� �u�M�5Ĉ�Xm���eL�X�q��y#�9]�c�}ɄL��d�eJ몓���I1T�d��CaM�$��T�,�X �bʭ�!�%F5��X1x#���!�q��\��F��2��&Rq���C�ol~�̱�.0ϦL�d�`.������ ���m{�Y~k{C��}bv�;U��c<�r�~ɜs�1�j��]W�l��*նCr��Q�N9�-������d��E؛��nF��eړ�8(q��5UgRȱGTA��*������̆��V�珰����ezN��h�U]�T�FG�^���<��ay�,!���5.� �u�bΚ�V�J%��m�Dxn'�����6�@BPa�`��Hts� �ɮ���Ŏ�Zɬ��%B�X��d5Z���hC}�䅸�p+ k=��ʒ(�aՏFG&�%@/�{+�Yu+�ȣGѩ"O%�|vȲxF>�N(��ou�h6 &Y5��8�7�E$-��']n,@TD\��+���Ry�U��U^�Q,f>��1�����q��f��U��� ����F���ڥ��>I�����fNUw�u��#OMMQ6� N�*��_�� k� ����rS��`���1�:��!�F'<+� � b?O��2 !Q12A��� "3a������#$��?�,�7�!`yǮ(�1�6w��a���� �F�#��?*"s���v>��Ⱥ����f�v��͑���s����������]Gn��S ���ȥpG ы�E�g�)Z���x�rY�q�]�@f�_܃�pչEڎّC ����Ŝ*/ �h�O�Sv�و\��5��U��y��|o�Hm2C�S�BW����)��5��{T��W���=o*RA��<����L0g4{��쁢�ep�rw�8��7��U���t<Ԍѻ7�fGf�k}���Ê�㛆Gռz�Q@��{C��'G��8�!�S$�j��x���|���צV<��,����u�k�uu�rM�f�_dϣi ߫�ԟn�!K����mxu�=�槻�'j�X�����������%!A "1QR#Br��?�R:��R�n�b[�II?#��6<:�$gN����lGNlrr��dעMMn`ɿy�,�%B�e�W��dVS��r���� %�tT��(�ɷ��S�]�O]#�_LEMHN�M���kv���~X���O6�U�V_�����b���J�t�774����D!1AQa"2q�#3BRb����0���� 4CSr����cst�����?��^q���7�dG�U�"p��moz��'��n_x���唹e������<6��O�t���R>k��s=�Cr���e�?�i��� ����/��ں$be���o`ޮ�GHy�;fNAl�8��.�\�S������"���a�úF�YvNk�-*`v�k�ʈ2f�EE��Wa�,� �fF^#�;��[9��^~������Y$:0#W3������Z*���I�Z�ڹ�k�n--9=��G��;7F)m{T�Ɇ��=�����Ȭ5�5�B�aڞ5M����#m�5Ʀ��m�8��+Hh���$�}�:&�e�Q�[;i]С�:�:��o����$<~��5RB�?�s3�5�r��O��ֿ�w�P/��̅���(�Z6�R>)��N��4�!ʊ�wz�-�r�w+�yk���q�1�bKhƸ�4N�Ӑ�X����Q��_��})�+e1�5��n��q?��[�^�9�<�z3Fsi�8�'�)9p)�{��RP�Z+�*��p(aY��V����6l�g�9��;���d�u���Nt@�3�sTwzaŇ�GT�b�H��(#��*zc�������9K�b1�����t����Ê��
�Z?g�iD���H�R���B���^M����v���O���L�D,'d�q�C�P�����$Δ��U�֟֊=�s��F�$��J�ދZ?�N��������A�N�WP��,�� �¦�&;�x��dup�����i���Ipd���;�Dž!��ֿѮAb%�u��}j��-p��>I�[�N�bi����G�'�;4w�m]H�]����#LӘNN��R��������s�.]��en��-�8e��Ps����Q��;���ț�E�ݫ���7��g�_L��W��EZ:/��I���a�g�n�ܤ��iٹ���ŷ�T���H~i�a�����֎�~KV������ A-2m]�F"�m�9-Zbǰ�״ @����~�4�N�[�Uxč�tl>������u#r�gѐ�3���;M9�<�J�����1�vfL8����1�P�HgP�Xv��������{����O�}�n��KQ؋����7<�l�fey<�}�>�bX���4<`Y7���si��V)�s�:�{�rO�h�z �@4VW�B���&�������ɡob܋�F��4>y�s�fXWS�N�O$�,.u:�ԫ��g�yao4��$h��D#��ٸf^kh�7�#1Z�֥&���*�v-��;bޭ����Q�����h�ow�y]�ه.+�7�M�ⴻ �JY��g�f�i3q��KC��3�¹�?5�Z.N��^Z w���KF͂���7��ރ۞��wj��T�J.�q��\Sv1U����R��욽&�N����pЖ`�`у��m`v�n#z��4��>e��V�`'���h�����'�j�AҔ�-�4:H���n]9�h<��n����U�6m��2c�E�1/�Y�%���I��~ʏ�|VBƟ@����;�������%�M9M���}��1�D��d����%g���O��]��у&�r��f�7�uܲ���(!1AQaq�������0� ���?!��*��@)�Je�G��j��{�['��v+���������)���(�/����д%젍Z��kk�Lu�Rm���j.c���@Z� V�J��d��j���h6���2AO�� a;oBu���H�=���nK�W8�B�ɰ�u?��бأm,�sr����|����8˨i��qI2tZ�ۄJP��XE��������zޔj~]UMu����zv!����N�&�1�Y��zJ�ՠ��\p��o'ሸ�C؊Y��TD"HM5�Ъ��i߯a���F����A)�����ڮ����z�E���@�hg�֝8�1jk��\�M�3�8ܢ�� ������s�7����N}�ޭ������GN�Bc���L pk�;�J�δ3�e�iU�gAYW]\�>�GyگQ=��f�KA;T�a`eM+Q �� �Ln���̌]GM�����<Ħ�j���H��N�M�x�}aX{̣S� ��ԅ��n�MA�S�r�(����(�L��zo9���.�;
�ӳf������`Ӕ٢3�� IW��\9~_���saa�\ԊW�ܭX:���ӆ�38�ty*����N�qP����BI�Y��jE��>DP�!�R%-��4��'�皺;��~J�!�7m���X��h�P!曭���$�\�AYj�.lC��4��+�jD�dgC0-*���|��`ZD�+л�C"��)��s��8Kq�pq���Ms��4� ��7\U`�.��[Ey8��AH!/��,���(:M -�T䓥�~O�4-���Ԓn��}HDN7���K���$�_Ԕ䚞`�R�hB�_aX?4V��ŗ�@ه�u�a�;�{PcT+�������7YBo�?��r-ͩ{�ĎA�� ����˼n��M286��G���1���V�˜Jв"l��V5���5�C]h���̊�A���%� �'p���Ԃ���Ր��9=�d�=�e�{�'<3�_ �:^�~��4�(�n�-C�s��5m![�jmIqU�~�Tw8��`���p�H8�u�Д l m�aP�0�������9y����CM��F1G糞�.�U~�������FC�{�!e(Y�:���P����7~;�L�N^{�1r�\���ԬG(���0d�ÏO�qK�Z�⑼�T�{ 2��s��Kd�Տ?mMQ��=���6�7�i�����H+����9��d��=��;�QؤH8n�Lb�D��yS%�(�{b���Cu���p�t#C���$A"�H{���jqᶯ�:�n=E����hH�`�!�m��MA������?�v6���+MԿ⟚qK�i�D�*Q5��CZ���2�|]�:Xd+�t�:o@��M��� :�32��b����[\5=�ֵ7])�|t��Ϻ����w�B�ń�e���!`�:��I,��9:����j@/a 8����+<�u�(T^ۺ~��2oE�B�%b)��z��ݳځ�)��i�j��&��Fi`qr��w���7�@��P�� �3Z&<�m�S�C����7t�T����ƴ�q~J�e�r6�Z]�rL���ه�E17'�x���+[�ܜTc6�/�����W�`�qpMJ���N5^����x�}{l�Fm������1�oZ\�����/d�/6� �uӸ�0elXuX;M��$M�}mB��������Z%e���3f�js����O�J~2�z�86�*PB��v�Ν��e-��.�/��L�O����2����9���4}|��T5M���hÐ7�F*��l+y0����:|��=k[�d�;|�ԉe�=w�<��õ�<��'!1AQaq����� ������?��5����)�(���+>v����6&{���Ǹ@����M�����v��iA 6T'�w��h�s �E}�x��G&'g�� J~1q�f�f���&��q˘���-���vYm
�/i1 �I��6��u,)�#�,����l}*&`�$�ͬe�%�w3�x�Ѥ�Xc�D��执g�峕�5B/�|$��=���%8 a��2.l� c�@G� �\�/x[өq�]�v5?�����N|�!���\��,>��{�"r�/��?��&!1QAa�� ��ᑱ����?ĊD�肭�� nv@�yޝ (�����I ����U - ���b�m�E>,��1v!�d�&�� ���&�檔�5D�&0P��Ԕ�͒@Z��:E"� Q��`>PH:~�O�����P�3W��@hM��k�U��\�O��R�������5ʄ�,��f�|��r���}јxo)�"+h�QK���/��0�`�5�{M~�� ���'!1AQaq���0 �������?�?�k��#^�~�G��#V,������#Z�1'ܤ����������~p�O%O�O�\�q�`�~��}��E�Ű5 �輸�du����x\�$���s[�{T2t`B��gq�4Z]b� 㛪�3,(@����bAp�r)9:@|b�!r�g:N�^�Ʌ��� �x_�\��pm7I��0?>^k��������w���|.K�[sF@�]Gn*L �yO� le�P�.p��֍�j�S�=�ʨ�ןQF�"��5zʼn���k�*8�u" ����Fg��� �cSy�V������Ƈ��N��ؐ(�����48hV�A�ӎ^��^ ���jyB� ��p"�����y]�ļlU�(�7�U`3�pCGF'&yg������o��z������X��ν:�P"@�G@x[��o&MJ�$F.����hi w;}�/^͇q���n�mN�/�TQ���އ��O1\,}��bQ #¯^S!)��X���#GPȏ�t�� c^\��' }iIZ���a�)��������z��4͊�Ξy��48,��f���#�����KP!Jx�|w�ʆ�������������#��Z�������< �~K��r�p&qH/;�R���沽�+�E�R���~0v���V#ʀ�T��S(-ڝ��B�y�b�C�D������b��������8��~�= �Y�ͧ]��@n����M�k2�%�;�%,�r6�LR腻?^��;KŇ=�ք ���=`�ɥ��/����z�&�I{���#J��M���C��}�H9^UJ�,P ��pS����G�d69Ϭu���%"��ˢP��K�"k)��=��9� ����㇌,��Oli��Xzh� " � ������R��^�s����N�k��Q>�63(���� ��PQ�Py�����3����$f+W՛=4�ǁ`*��^��Eb�K�t�6��^��!�籷��ȭ��K{/;�L���p�x�����;a���Oلz�[�.NP4�]Gc�T�v����~sg'LED��]j��'�G�]�6rY����UPw�*O�İՋi�'8�۴�#g�Xx+=�eU6�R��c�"�u2��~�?n�y�;�u��3�'��6�f������b��߬M�$*��k&?6���*^1n����ێz)<��Gz� �����7����Y� ��ۃ)$A��2�L6� ե�H�<�r��#ʽ2��O��R���z�A��XW��@���������<�G� Ϥ�^�˓i�M�W���6 ��0��m){c�;ݧ�>R�a����}1�ٯ%�EY2�Q��Ep���$ ��E��qS��t#+x� *�h�UI��XM?�'//��a'�G�����q@���<��z��؟����cd��z�ˬT_u�Ѯ����&�z�k ��n ]�a%�py»�`Qd�xc������n�� ��*��oTd�;'j�<�!j���'�(~�ʹW�M� P�mȘ��@֨V+��R�`�$��`�+@��_[�kG����P���Zh9�R����&5b�v���Z���#p�&�Ա+��8�etZ7G���;��@"�e0���v7����?��z�?_���_�q1�T�"�p�ˎ/U 6_�B�>��0( ��}G#������Ȣ�p�� �9��;/& `�B&$�y��t(�*z�x���Ӕ������S�?Kȏ3���{p� b � ۍ-�z܈֦��6?<���ǬP�N�G �更� �6�/h�����0Z���������i�ua��e�*M'A� �x��v�q.>�F� oN{��Q���{gD��L��u��=|���O xN���d���q�8(��E�Uu��,��O� t�DJ ����;��G����e���C��VYZ�� ���T4{����(�Ӳ'c�t�f��w�c�jr�e�m �#7,�6��B�E4Q�P�.P�(&��^{9H-�m�o ��q�g1���=��>p�)/"p0!4�mS6ú�FN���h��D �)��XdT �FؤZ⸚�k���H�c8v� <���u�P�Հ���:��_�EN��|�ӛ��u?-�/�o�Lhk�ܸ�S�;�Rī�����T"�N����M��px7<�� j�$��`�Y)Pjh 5` K�Qf�4�C�bX"�D���;HD�Z�9R b�F)�UA����v�#��HD�!{������>I� �`�ԁ i�4�)t*�ç�Le�_���>ru�GEQg��ǔct��ō0��l6v���d�� ��GG8���v^�|�#JyZPSO�� Y�CuAߐ�"�x���OfHF@�K�V�!少Eҕ]h� ��[���)��.q����*0I<8��^�6�}p��^tho���ig�i����DK���p,��2�3�I��5����쓄OY�6s7Qs�Ow^�w�J/�A➰������0������g(Մ��y��Kԇ����QS��?H���w�X�=��ҞX�~���Q=�'���p?7�@g�~�G�}�r��g�T?���
One Hat Cyber Team
One Hat Cyber Team
Your IP :
3.133.100.195
Server IP :
162.0.235.113
Server :
Linux premium146.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
Server Software :
LiteSpeed
PHP Version :
5.6.40
Buat File
|
Buat Folder
Dir :
~
/
opt
/
cpanel
/
ea-apr16
/
include
/
apr-1
/
Edit File Name:
apr_thread_proc.h
/* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef APR_THREAD_PROC_H #define APR_THREAD_PROC_H /** * @file apr_thread_proc.h * @brief APR Thread and Process Library */ #include "apr.h" #include "apr_file_io.h" #include "apr_pools.h" #include "apr_errno.h" #include "apr_perms_set.h" #if APR_HAVE_STRUCT_RLIMIT #include <sys/time.h> #include <sys/resource.h> #endif #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** * @defgroup apr_thread_proc Threads and Process Functions * @ingroup APR * @{ */ typedef enum { APR_SHELLCMD, /**< use the shell to invoke the program */ APR_PROGRAM, /**< invoke the program directly, no copied env */ APR_PROGRAM_ENV, /**< invoke the program, replicating our environment */ APR_PROGRAM_PATH, /**< find program on PATH, use our environment */ APR_SHELLCMD_ENV /**< use the shell to invoke the program, * replicating our environment */ } apr_cmdtype_e; typedef enum { APR_WAIT, /**< wait for the specified process to finish */ APR_NOWAIT /**< do not wait -- just see if it has finished */ } apr_wait_how_e; /* I am specifically calling out the values so that the macros below make * more sense. Yes, I know I don't need to, but I am hoping this makes what * I am doing more clear. If you want to add more reasons to exit, continue * to use bitmasks. */ typedef enum { APR_PROC_EXIT = 1, /**< process exited normally */ APR_PROC_SIGNAL = 2, /**< process exited due to a signal */ APR_PROC_SIGNAL_CORE = 4 /**< process exited and dumped a core file */ } apr_exit_why_e; /** did we exit the process */ #define APR_PROC_CHECK_EXIT(x) (x & APR_PROC_EXIT) /** did we get a signal */ #define APR_PROC_CHECK_SIGNALED(x) (x & APR_PROC_SIGNAL) /** did we get core */ #define APR_PROC_CHECK_CORE_DUMP(x) (x & APR_PROC_SIGNAL_CORE) /** @see apr_procattr_io_set */ #define APR_NO_PIPE 0 /** @see apr_procattr_io_set and apr_file_pipe_create_ex */ #define APR_FULL_BLOCK 1 /** @see apr_procattr_io_set and apr_file_pipe_create_ex */ #define APR_FULL_NONBLOCK 2 /** @see apr_procattr_io_set */ #define APR_PARENT_BLOCK 3 /** @see apr_procattr_io_set */ #define APR_CHILD_BLOCK 4 /** @see apr_procattr_io_set */ #define APR_NO_FILE 8 /** @see apr_file_pipe_create_ex */ #define APR_READ_BLOCK 3 /** @see apr_file_pipe_create_ex */ #define APR_WRITE_BLOCK 4 /** @see apr_procattr_io_set * @note Win32 only effective with version 1.2.12, portably introduced in 1.3.0 */ #define APR_NO_FILE 8 /** @see apr_procattr_limit_set */ #define APR_LIMIT_CPU 0 /** @see apr_procattr_limit_set */ #define APR_LIMIT_MEM 1 /** @see apr_procattr_limit_set */ #define APR_LIMIT_NPROC 2 /** @see apr_procattr_limit_set */ #define APR_LIMIT_NOFILE 3 /** * @defgroup APR_OC Other Child Flags * @{ */ #define APR_OC_REASON_DEATH 0 /**< child has died, caller must call * unregister still */ #define APR_OC_REASON_UNWRITABLE 1 /**< write_fd is unwritable */ #define APR_OC_REASON_RESTART 2 /**< a restart is occurring, perform * any necessary cleanup (including * sending a special signal to child) */ #define APR_OC_REASON_UNREGISTER 3 /**< unregister has been called, do * whatever is necessary (including * kill the child) */ #define APR_OC_REASON_LOST 4 /**< somehow the child exited without * us knowing ... buggy os? */ #define APR_OC_REASON_RUNNING 5 /**< a health check is occurring, * for most maintainence functions * this is a no-op. */ /** @} */ /** The APR process type */ typedef struct apr_proc_t { /** The process ID */ pid_t pid; /** Parent's side of pipe to child's stdin */ apr_file_t *in; /** Parent's side of pipe to child's stdout */ apr_file_t *out; /** Parent's side of pipe to child's stdouterr */ apr_file_t *err; #if APR_HAS_PROC_INVOKED || defined(DOXYGEN) /** Diagnositics/debugging string of the command invoked for * this process [only present if APR_HAS_PROC_INVOKED is true] * @remark Only enabled on Win32 by default. * @bug This should either always or never be present in release * builds - since it breaks binary compatibility. We may enable * it always in APR 1.0 yet leave it undefined in most cases. */ char *invoked; #endif #if defined(WIN32) || defined(DOXYGEN) /** (Win32 only) Creator's handle granting access to the process * @remark This handle is closed and reset to NULL in every case * corresponding to a waitpid() on Unix which returns the exit status. * Therefore Win32 correspond's to Unix's zombie reaping characteristics * and avoids potential handle leaks. */ HANDLE hproc; #endif } apr_proc_t; /** * The prototype for APR child errfn functions. (See the description * of apr_procattr_child_errfn_set() for more information.) * It is passed the following parameters: * @param pool Pool associated with the apr_proc_t. If your child * error function needs user data, associate it with this * pool. * @param err APR error code describing the error * @param description Text description of type of processing which failed */ typedef void (apr_child_errfn_t)(apr_pool_t *proc, apr_status_t err, const char *description); /** Opaque Thread structure. */ typedef struct apr_thread_t apr_thread_t; /** Opaque Thread attributes structure. */ typedef struct apr_threadattr_t apr_threadattr_t; /** Opaque Process attributes structure. */ typedef struct apr_procattr_t apr_procattr_t; /** Opaque control variable for one-time atomic variables. */ typedef struct apr_thread_once_t apr_thread_once_t; /** Opaque thread private address space. */ typedef struct apr_threadkey_t apr_threadkey_t; /** Opaque record of child process. */ typedef struct apr_other_child_rec_t apr_other_child_rec_t; /** * The prototype for any APR thread worker functions. */ typedef void *(APR_THREAD_FUNC *apr_thread_start_t)(apr_thread_t*, void*); typedef enum { APR_KILL_NEVER, /**< process is never killed (i.e., never sent * any signals), but it will be reaped if it exits * before the pool is cleaned up */ APR_KILL_ALWAYS, /**< process is sent SIGKILL on apr_pool_t cleanup */ APR_KILL_AFTER_TIMEOUT, /**< SIGTERM, wait 3 seconds, SIGKILL */ APR_JUST_WAIT, /**< wait forever for the process to complete */ APR_KILL_ONLY_ONCE /**< send SIGTERM and then wait */ } apr_kill_conditions_e; /* LVE support */ #define LVE_APACHE_SUPPORT APR_DECLARE(apr_status_t) apr_lve_environment_init(int lve_no_maxenter_value, void *lve_ptr, int (*lve_enter_flags_function_ptr)(void *, ...), int (*lve_leave_function_ptr)(void *, ...), char *suexec_string); APR_DECLARE(apr_status_t) apr_lve_environment_init_group(int lve_no_maxenter_value, void *lve_ptr, int (*lve_enter_flags_function_ptr)(void *, ...), int (*lve_leave_function_ptr)(void *, ...), char *suexec_string, int use_group); APR_DECLARE(apr_status_t) apr_lve_environment_init_group_minuid(int lve_no_maxenter_value, void *lve_ptr, int (*lve_enter_flags_function_ptr)(void *, ...), int (*lve_leave_function_ptr)(void *, ...), char *suexec_string, int use_group, int min_uid); /* Thread Function definitions */ #if APR_HAS_THREADS /** * Create and initialize a new threadattr variable * @param new_attr The newly created threadattr. * @param cont The pool to use */ APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new_attr, apr_pool_t *cont); /** * Set if newly created threads should be created in detached state. * @param attr The threadattr to affect * @param on Non-zero if detached threads should be created. */ APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr, apr_int32_t on); /** * Get the detach state for this threadattr. * @param attr The threadattr to reference * @return APR_DETACH if threads are to be detached, or APR_NOTDETACH * if threads are to be joinable. */ APR_DECLARE(apr_status_t) apr_threadattr_detach_get(apr_threadattr_t *attr); /** * Set the stack size of newly created threads. * @param attr The threadattr to affect * @param stacksize The stack size in bytes */ APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t *attr, apr_size_t stacksize); /** * Set the stack guard area size of newly created threads. * @param attr The threadattr to affect * @param guardsize The stack guard area size in bytes * @note Thread library implementations commonly use a "guard area" * after each thread's stack which is not readable or writable such that * stack overflows cause a segfault; this consumes e.g. 4K of memory * and increases memory management overhead. Setting the guard area * size to zero hence trades off reliable behaviour on stack overflow * for performance. */ APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr, apr_size_t guardsize); /** * Create a new thread of execution * @param new_thread The newly created thread handle. * @param attr The threadattr to use to determine how to create the thread * @param func The function to start the new thread in * @param data Any data to be passed to the starting function * @param cont The pool to use */ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new_thread, apr_threadattr_t *attr, apr_thread_start_t func, void *data, apr_pool_t *cont); /** * stop the current thread * @param thd The thread to stop * @param retval The return value to pass back to any thread that cares */ APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd, apr_status_t retval); /** * block until the desired thread stops executing. * @param retval The return value from the dead thread. * @param thd The thread to join */ APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval, apr_thread_t *thd); /** * force the current thread to yield the processor */ APR_DECLARE(void) apr_thread_yield(void); /** * Initialize the control variable for apr_thread_once. If this isn't * called, apr_initialize won't work. * @param control The control variable to initialize * @param p The pool to allocate data from. */ APR_DECLARE(apr_status_t) apr_thread_once_init(apr_thread_once_t **control, apr_pool_t *p); /** * Run the specified function one time, regardless of how many threads * call it. * @param control The control variable. The same variable should * be passed in each time the function is tried to be * called. This is how the underlying functions determine * if the function has ever been called before. * @param func The function to call. */ APR_DECLARE(apr_status_t) apr_thread_once(apr_thread_once_t *control, void (*func)(void)); /** * detach a thread * @param thd The thread to detach */ APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd); /** * Return user data associated with the current thread. * @param data The user data associated with the thread. * @param key The key to associate with the data * @param thread The currently open thread. */ APR_DECLARE(apr_status_t) apr_thread_data_get(void **data, const char *key, apr_thread_t *thread); /** * Set user data associated with the current thread. * @param data The user data to associate with the thread. * @param key The key to use for associating the data with the thread * @param cleanup The cleanup routine to use when the thread is destroyed. * @param thread The currently open thread. */ APR_DECLARE(apr_status_t) apr_thread_data_set(void *data, const char *key, apr_status_t (*cleanup) (void *), apr_thread_t *thread); /** * Create and initialize a new thread private address space * @param key The thread private handle. * @param dest The destructor to use when freeing the private memory. * @param cont The pool to use */ APR_DECLARE(apr_status_t) apr_threadkey_private_create(apr_threadkey_t **key, void (*dest)(void *), apr_pool_t *cont); /** * Get a pointer to the thread private memory * @param new_mem The data stored in private memory * @param key The handle for the desired thread private memory */ APR_DECLARE(apr_status_t) apr_threadkey_private_get(void **new_mem, apr_threadkey_t *key); /** * Set the data to be stored in thread private memory * @param priv The data to be stored in private memory * @param key The handle for the desired thread private memory */ APR_DECLARE(apr_status_t) apr_threadkey_private_set(void *priv, apr_threadkey_t *key); /** * Free the thread private memory * @param key The handle for the desired thread private memory */ APR_DECLARE(apr_status_t) apr_threadkey_private_delete(apr_threadkey_t *key); /** * Return the pool associated with the current threadkey. * @param data The user data associated with the threadkey. * @param key The key associated with the data * @param threadkey The currently open threadkey. */ APR_DECLARE(apr_status_t) apr_threadkey_data_get(void **data, const char *key, apr_threadkey_t *threadkey); /** * Return the pool associated with the current threadkey. * @param data The data to set. * @param key The key to associate with the data. * @param cleanup The cleanup routine to use when the file is destroyed. * @param threadkey The currently open threadkey. */ APR_DECLARE(apr_status_t) apr_threadkey_data_set(void *data, const char *key, apr_status_t (*cleanup) (void *), apr_threadkey_t *threadkey); #endif /** * Create and initialize a new procattr variable * @param new_attr The newly created procattr. * @param cont The pool to use */ APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new_attr, apr_pool_t *cont); /** * Determine if any of stdin, stdout, or stderr should be linked to pipes * when starting a child process. * @param attr The procattr we care about. * @param in Should stdin be a pipe back to the parent? * @param out Should stdout be a pipe back to the parent? * @param err Should stderr be a pipe back to the parent? * @note If APR_NO_PIPE, there will be no special channel, the child * inherits the parent's corresponding stdio stream. If APR_NO_FILE is * specified, that corresponding stream is closed in the child (and will * be INVALID_HANDLE_VALUE when inspected on Win32). This can have ugly * side effects, as the next file opened in the child on Unix will fall * into the stdio stream fd slot! */ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, apr_int32_t in, apr_int32_t out, apr_int32_t err); /** * Set the child_in and/or parent_in values to existing apr_file_t values. * @param attr The procattr we care about. * @param child_in apr_file_t value to use as child_in. Must be a valid file. * @param parent_in apr_file_t value to use as parent_in. Must be a valid file. * @remark This is NOT a required initializer function. This is * useful if you have already opened a pipe (or multiple files) * that you wish to use, perhaps persistently across multiple * process invocations - such as a log file. You can save some * extra function calls by not creating your own pipe since this * creates one in the process space for you. * @bug Note that calling this function with two NULL files on some platforms * creates an APR_FULL_BLOCK pipe, but this behavior is neither portable nor * is it supported. @see apr_procattr_io_set instead for simple pipes. */ APR_DECLARE(apr_status_t) apr_procattr_child_in_set(struct apr_procattr_t *attr, apr_file_t *child_in, apr_file_t *parent_in); /** * Set the child_out and parent_out values to existing apr_file_t values. * @param attr The procattr we care about. * @param child_out apr_file_t value to use as child_out. Must be a valid file. * @param parent_out apr_file_t value to use as parent_out. Must be a valid file. * @remark This is NOT a required initializer function. This is * useful if you have already opened a pipe (or multiple files) * that you wish to use, perhaps persistently across multiple * process invocations - such as a log file. * @bug Note that calling this function with two NULL files on some platforms * creates an APR_FULL_BLOCK pipe, but this behavior is neither portable nor * is it supported. @see apr_procattr_io_set instead for simple pipes. */ APR_DECLARE(apr_status_t) apr_procattr_child_out_set(struct apr_procattr_t *attr, apr_file_t *child_out, apr_file_t *parent_out); /** * Set the child_err and parent_err values to existing apr_file_t values. * @param attr The procattr we care about. * @param child_err apr_file_t value to use as child_err. Must be a valid file. * @param parent_err apr_file_t value to use as parent_err. Must be a valid file. * @remark This is NOT a required initializer function. This is * useful if you have already opened a pipe (or multiple files) * that you wish to use, perhaps persistently across multiple * process invocations - such as a log file. * @bug Note that calling this function with two NULL files on some platforms * creates an APR_FULL_BLOCK pipe, but this behavior is neither portable nor * is it supported. @see apr_procattr_io_set instead for simple pipes. */ APR_DECLARE(apr_status_t) apr_procattr_child_err_set(struct apr_procattr_t *attr, apr_file_t *child_err, apr_file_t *parent_err); /** * Set which directory the child process should start executing in. * @param attr The procattr we care about. * @param dir Which dir to start in. By default, this is the same dir as * the parent currently resides in, when the createprocess call * is made. */ APR_DECLARE(apr_status_t) apr_procattr_dir_set(apr_procattr_t *attr, const char *dir); /** * Set what type of command the child process will call. * @param attr The procattr we care about. * @param cmd The type of command. One of: * <PRE> * APR_SHELLCMD -- Anything that the shell can handle * APR_PROGRAM -- Executable program (default) * APR_PROGRAM_ENV -- Executable program, copy environment * APR_PROGRAM_PATH -- Executable program on PATH, copy env * </PRE> */ APR_DECLARE(apr_status_t) apr_procattr_cmdtype_set(apr_procattr_t *attr, apr_cmdtype_e cmd); /** * Determine if the child should start in detached state. * @param attr The procattr we care about. * @param detach Should the child start in detached state? Default is no. */ APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr, apr_int32_t detach); #if APR_HAVE_STRUCT_RLIMIT /** * Set the Resource Utilization limits when starting a new process. * @param attr The procattr we care about. * @param what Which limit to set, one of: * <PRE> * APR_LIMIT_CPU * APR_LIMIT_MEM * APR_LIMIT_NPROC * APR_LIMIT_NOFILE * </PRE> * @param limit Value to set the limit to. */ APR_DECLARE(apr_status_t) apr_procattr_limit_set(apr_procattr_t *attr, apr_int32_t what, struct rlimit *limit); #endif /** * Specify an error function to be called in the child process if APR * encounters an error in the child prior to running the specified program. * @param attr The procattr describing the child process to be created. * @param errfn The function to call in the child process. * @remark At the present time, it will only be called from apr_proc_create() * on platforms where fork() is used. It will never be called on other * platforms, on those platforms apr_proc_create() will return the error * in the parent process rather than invoke the callback in the now-forked * child process. */ APR_DECLARE(apr_status_t) apr_procattr_child_errfn_set(apr_procattr_t *attr, apr_child_errfn_t *errfn); /** * Specify that apr_proc_create() should do whatever it can to report * failures to the caller of apr_proc_create(), rather than find out in * the child. * @param attr The procattr describing the child process to be created. * @param chk Flag to indicate whether or not extra work should be done * to try to report failures to the caller. * @remark This flag only affects apr_proc_create() on platforms where * fork() is used. This leads to extra overhead in the calling * process, but that may help the application handle such * errors more gracefully. */ APR_DECLARE(apr_status_t) apr_procattr_error_check_set(apr_procattr_t *attr, apr_int32_t chk); /** * Determine if the child should start in its own address space or using the * current one from its parent * @param attr The procattr we care about. * @param addrspace Should the child start in its own address space? Default * is no on NetWare and yes on other platforms. */ APR_DECLARE(apr_status_t) apr_procattr_addrspace_set(apr_procattr_t *attr, apr_int32_t addrspace); /** * Set the username used for running process * @param attr The procattr we care about. * @param username The username used * @param password User password if needed. Password is needed on WIN32 * or any other platform having * APR_PROCATTR_USER_SET_REQUIRES_PASSWORD set. */ APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, const char *username, const char *password); /** * Set the group used for running process * @param attr The procattr we care about. * @param groupname The group name used */ APR_DECLARE(apr_status_t) apr_procattr_group_set(apr_procattr_t *attr, const char *groupname); /** * Register permission set function * @param attr The procattr we care about. * @param perms_set_fn Permission set callback * @param data Data to pass to permission callback function * @param perms Permissions to set */ APR_DECLARE(apr_status_t) apr_procattr_perms_set_register(apr_procattr_t *attr, apr_perms_setfn_t *perms_set_fn, void *data, apr_fileperms_t perms); #if APR_HAS_FORK /** * This is currently the only non-portable call in APR. This executes * a standard unix fork. * @param proc The resulting process handle. * @param cont The pool to use. * @remark returns APR_INCHILD for the child, and APR_INPARENT for the parent * or an error. */ APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *cont); #endif /** * Create a new process and execute a new program within that process. * @param new_proc The resulting process handle. * @param progname The program to run * @param args the arguments to pass to the new program. The first * one should be the program name. * @param env The new environment table for the new process. This * should be a list of NULL-terminated strings. This argument * is ignored for APR_PROGRAM_ENV, APR_PROGRAM_PATH, and * APR_SHELLCMD_ENV types of commands. * @param attr the procattr we should use to determine how to create the new * process * @param pool The pool to use. * @note This function returns without waiting for the new process to terminate; * use apr_proc_wait for that. */ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new_proc, const char *progname, const char * const *args, const char * const *env, apr_procattr_t *attr, apr_pool_t *pool); /** * Wait for a child process to die * @param proc The process handle that corresponds to the desired child process * @param exitcode The returned exit status of the child, if a child process * dies, or the signal that caused the child to die. * On platforms that don't support obtaining this information, * the status parameter will be returned as APR_ENOTIMPL. * @param exitwhy Why the child died, the bitwise or of: * <PRE> * APR_PROC_EXIT -- process terminated normally * APR_PROC_SIGNAL -- process was killed by a signal * APR_PROC_SIGNAL_CORE -- process was killed by a signal, and * generated a core dump. * </PRE> * @param waithow How should we wait. One of: * <PRE> * APR_WAIT -- block until the child process dies. * APR_NOWAIT -- return immediately regardless of if the * child is dead or not. * </PRE> * @remark The child's status is in the return code to this process. It is one of: * <PRE> * APR_CHILD_DONE -- child is no longer running. * APR_CHILD_NOTDONE -- child is still running. * </PRE> */ APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, int *exitcode, apr_exit_why_e *exitwhy, apr_wait_how_e waithow); /** * Wait for any current child process to die and return information * about that child. * @param proc Pointer to NULL on entry, will be filled out with child's * information * @param exitcode The returned exit status of the child, if a child process * dies, or the signal that caused the child to die. * On platforms that don't support obtaining this information, * the status parameter will be returned as APR_ENOTIMPL. * @param exitwhy Why the child died, the bitwise or of: * <PRE> * APR_PROC_EXIT -- process terminated normally * APR_PROC_SIGNAL -- process was killed by a signal * APR_PROC_SIGNAL_CORE -- process was killed by a signal, and * generated a core dump. * </PRE> * @param waithow How should we wait. One of: * <PRE> * APR_WAIT -- block until the child process dies. * APR_NOWAIT -- return immediately regardless of if the * child is dead or not. * </PRE> * @param p Pool to allocate child information out of. * @bug Passing proc as a *proc rather than **proc was an odd choice * for some platforms... this should be revisited in 1.0 */ APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc, int *exitcode, apr_exit_why_e *exitwhy, apr_wait_how_e waithow, apr_pool_t *p); #define APR_PROC_DETACH_FOREGROUND 0 /**< Do not detach */ #define APR_PROC_DETACH_DAEMONIZE 1 /**< Detach */ /** * Detach the process from the controlling terminal. * @param daemonize set to non-zero if the process should daemonize * and become a background process, else it will * stay in the foreground. */ APR_DECLARE(apr_status_t) apr_proc_detach(int daemonize); /** * Register an other_child -- a child associated to its registered * maintence callback. This callback is invoked when the process * dies, is disconnected or disappears. * @param proc The child process to register. * @param maintenance maintenance is a function that is invoked with a * reason and the data pointer passed here. * @param data Opaque context data passed to the maintenance function. * @param write_fd An fd that is probed for writing. If it is ever unwritable * then the maintenance is invoked with reason * OC_REASON_UNWRITABLE. * @param p The pool to use for allocating memory. * @bug write_fd duplicates the proc->out stream, it's really redundant * and should be replaced in the APR 1.0 API with a bitflag of which * proc->in/out/err handles should be health checked. * @bug no platform currently tests the pipes health. */ APR_DECLARE(void) apr_proc_other_child_register(apr_proc_t *proc, void (*maintenance) (int reason, void *, int status), void *data, apr_file_t *write_fd, apr_pool_t *p); /** * Stop watching the specified other child. * @param data The data to pass to the maintenance function. This is * used to find the process to unregister. * @warning Since this can be called by a maintenance function while we're * scanning the other_children list, all scanners should protect * themself by loading ocr->next before calling any maintenance * function. */ APR_DECLARE(void) apr_proc_other_child_unregister(void *data); /** * Notify the maintenance callback of a registered other child process * that application has detected an event, such as death. * @param proc The process to check * @param reason The reason code to pass to the maintenance function * @param status The status to pass to the maintenance function * @remark An example of code using this behavior; * <pre> * rv = apr_proc_wait_all_procs(&proc, &exitcode, &status, APR_WAIT, p); * if (APR_STATUS_IS_CHILD_DONE(rv)) { * \#if APR_HAS_OTHER_CHILD * if (apr_proc_other_child_alert(&proc, APR_OC_REASON_DEATH, status) * == APR_SUCCESS) { * ; (already handled) * } * else * \#endif * [... handling non-otherchild processes death ...] * </pre> */ APR_DECLARE(apr_status_t) apr_proc_other_child_alert(apr_proc_t *proc, int reason, int status); /** * Test one specific other child processes and invoke the maintenance callback * with the appropriate reason code, if still running, or the appropriate reason * code if the process is no longer healthy. * @param ocr The registered other child * @param reason The reason code (e.g. APR_OC_REASON_RESTART) if still running */ APR_DECLARE(void) apr_proc_other_child_refresh(apr_other_child_rec_t *ocr, int reason); /** * Test all registered other child processes and invoke the maintenance callback * with the appropriate reason code, if still running, or the appropriate reason * code if the process is no longer healthy. * @param reason The reason code (e.g. APR_OC_REASON_RESTART) to running processes */ APR_DECLARE(void) apr_proc_other_child_refresh_all(int reason); /** * Terminate a process. * @param proc The process to terminate. * @param sig How to kill the process. */ APR_DECLARE(apr_status_t) apr_proc_kill(apr_proc_t *proc, int sig); /** * Register a process to be killed when a pool dies. * @param a The pool to use to define the processes lifetime * @param proc The process to register * @param how How to kill the process, one of: * <PRE> * APR_KILL_NEVER -- process is never sent any signals * APR_KILL_ALWAYS -- process is sent SIGKILL on apr_pool_t cleanup * APR_KILL_AFTER_TIMEOUT -- SIGTERM, wait 3 seconds, SIGKILL * APR_JUST_WAIT -- wait forever for the process to complete * APR_KILL_ONLY_ONCE -- send SIGTERM and then wait * </PRE> */ APR_DECLARE(void) apr_pool_note_subprocess(apr_pool_t *a, apr_proc_t *proc, apr_kill_conditions_e how); #if APR_HAS_THREADS #if (APR_HAVE_SIGWAIT || APR_HAVE_SIGSUSPEND) && !defined(OS2) /** * Setup the process for a single thread to be used for all signal handling. * @warning This must be called before any threads are created */ APR_DECLARE(apr_status_t) apr_setup_signal_thread(void); /** * Make the current thread listen for signals. This thread will loop * forever, calling a provided function whenever it receives a signal. That * functions should return 1 if the signal has been handled, 0 otherwise. * @param signal_handler The function to call when a signal is received * apr_status_t apr_signal_thread((int)(*signal_handler)(int signum)) * @note Synchronous signals like SIGABRT/SIGSEGV/SIGBUS/... are ignored by * apr_signal_thread() and thus can't be waited by this function (they remain * handled by the operating system or its native signals interface). * @remark In APR version 1.6 and ealier, SIGUSR2 was part of these ignored * signals and thus was never passed in to the signal_handler. From APR 1.7 * this is no more the case so SIGUSR2 can be handled in signal_handler and * acted upon like the other asynchronous signals. */ APR_DECLARE(apr_status_t) apr_signal_thread(int(*signal_handler)(int signum)); #endif /* (APR_HAVE_SIGWAIT || APR_HAVE_SIGSUSPEND) && !defined(OS2) */ /** * Get the child-pool used by the thread from the thread info. * @return apr_pool_t the pool */ APR_POOL_DECLARE_ACCESSOR(thread); #endif /* APR_HAS_THREADS */ /** @} */ #ifdef __cplusplus } #endif #endif /* ! APR_THREAD_PROC_H */
Save