Apache HTTPD
apr_thread_proc.h
Go to the documentation of this file.
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_THREAD_PROC_H
18#define APR_THREAD_PROC_H
19
25#include "apr.h"
26#include "apr_file_io.h"
27#include "apr_pools.h"
28#include "apr_errno.h"
29#include "apr_perms_set.h"
30
31#if APR_HAVE_STRUCT_RLIMIT
32#include <sys/time.h>
33#include <sys/resource.h>
34#endif
35
36#ifdef __cplusplus
37extern "C" {
38#endif /* __cplusplus */
39
55
60
61/* I am specifically calling out the values so that the macros below make
62 * more sense. Yes, I know I don't need to, but I am hoping this makes what
63 * I am doing more clear. If you want to add more reasons to exit, continue
64 * to use bitmasks.
65 */
71
73#define APR_PROC_CHECK_EXIT(x) (x & APR_PROC_EXIT)
75#define APR_PROC_CHECK_SIGNALED(x) (x & APR_PROC_SIGNAL)
77#define APR_PROC_CHECK_CORE_DUMP(x) (x & APR_PROC_SIGNAL_CORE)
78
80#define APR_NO_PIPE 0
82#define APR_FULL_BLOCK 1
84#define APR_FULL_NONBLOCK 2
86#define APR_PARENT_BLOCK 3
88#define APR_CHILD_BLOCK 4
90#define APR_NO_FILE 8
91
93#define APR_READ_BLOCK 3
95#define APR_WRITE_BLOCK 4
96
100#define APR_NO_FILE 8
101
103#define APR_LIMIT_CPU 0
105#define APR_LIMIT_MEM 1
107#define APR_LIMIT_NPROC 2
109#define APR_LIMIT_NOFILE 3
110
115#define APR_OC_REASON_DEATH 0
117#define APR_OC_REASON_UNWRITABLE 1
118#define APR_OC_REASON_RESTART 2
122#define APR_OC_REASON_UNREGISTER 3
125#define APR_OC_REASON_LOST 4
127#define APR_OC_REASON_RUNNING 5
134typedef struct apr_proc_t {
143#if APR_HAS_PROC_INVOKED || defined(DOXYGEN)
151 char *invoked;
152#endif
153#if defined(WIN32) || defined(DOXYGEN)
161#endif
163
175 const char *description);
176
179
182
185
188
191
194
199
209
210/* Thread Function definitions */
211
212#if APR_HAS_THREADS
213
221
229
237
244 apr_size_t stacksize);
245
258
270 void *data, apr_pool_t *cont);
271
279
286 apr_thread_t *thd);
287
291APR_DECLARE(void) apr_thread_yield(void);
292
300 apr_pool_t *p);
301
312 void (*func)(void));
313
319
327 apr_thread_t *thread);
328
337 apr_status_t (*cleanup) (void *),
338 apr_thread_t *thread);
339
347 void (*dest)(void *),
349
357
365
371
380
389 apr_status_t (*cleanup) (void *),
391
392#endif
393
401
419
438
455
472
481 const char *dir);
482
496
504
505#if APR_HAVE_STRUCT_RLIMIT
520 struct rlimit *limit);
521#endif
522
536
551
561
571 const char *username,
572 const char *password);
573
580 const char *groupname);
581
582
592 void *data,
594
595#if APR_HAS_FORK
605#endif
606
624 const char *progname,
625 const char * const *args,
626 const char * const *env,
629
659
687 int *exitcode,
691
692#define APR_PROC_DETACH_FOREGROUND 0
693#define APR_PROC_DETACH_DAEMONIZE 1
702
721 void (*maintenance) (int reason,
722 void *,
723 int status),
725 apr_pool_t *p);
726
737
760 int status);
761
770 int reason);
771
779
786
802
803#if APR_HAS_THREADS
804
805#if (APR_HAVE_SIGWAIT || APR_HAVE_SIGSUSPEND) && !defined(OS2)
806
812
828
829#endif /* (APR_HAVE_SIGWAIT || APR_HAVE_SIGSUSPEND) && !defined(OS2) */
830
836
837#endif /* APR_HAS_THREADS */
838
841#ifdef __cplusplus
842}
843#endif
844
845#endif /* ! APR_THREAD_PROC_H */
846
APR Error Codes.
APR File I/O Handling.
APR Process Locking Routines.
APR memory allocation.
void apr_thread_yield()
Definition thread.c:161
apr_bucket apr_bucket_brigade * a
apr_size_t size
int apr_status_t
Definition apr_errno.h:44
apr_int32_t apr_fileperms_t
const char * key
void const char apr_status_t(* cleanup)(void *))
apr_int32_t apr_int32_t on
apr_status_t() apr_perms_setfn_t(void *object, apr_fileperms_t perms, apr_uid_t uid, apr_gid_t gid)
apr_interval_time_t apr_pollcb_cb_t func
Definition apr_poll.h:422
#define APR_POOL_DECLARE_ACCESSOR(type)
Definition apr_pools.h:81
apr_proc_t * proc
void *(APR_THREAD_FUNC * apr_thread_start_t)(apr_thread_t *, void *)
const char const char * password
int apr_exit_why_e apr_wait_how_e apr_pool_t * p
apr_int32_t apr_int32_t apr_int32_t err
apr_file_t apr_file_t * parent_out
apr_perms_setfn_t * perms_set_fn
const char const char *const const char *const apr_procattr_t * attr
void() apr_child_errfn_t(apr_pool_t *proc, apr_status_t err, const char *description)
void(*) void apr_file_t write_fd)
apr_int32_t in
apr_child_errfn_t * errfn
apr_int32_t apr_int32_t out
apr_kill_conditions_e
const char * groupname
const char const char *const const char *const apr_procattr_t apr_pool_t * pool
apr_int32_t addrspace
apr_wait_how_e
int sig
apr_proc_t apr_kill_conditions_e how
int apr_exit_why_e * exitwhy
apr_cmdtype_e cmd
apr_int32_t chk
apr_file_t apr_file_t * parent_in
apr_pool_t * cont
apr_file_t * child_err
const char const char *const * args
const char * username
int reason
apr_exit_why_e
int apr_exit_why_e apr_wait_how_e waithow
const char * dir
const char * progname
apr_cmdtype_e
apr_int32_t detach
void(* maintenance)(int reason, void *, int status)
int * exitcode
int int status
apr_perms_setfn_t void * data
apr_file_t * child_out
apr_file_t apr_file_t * parent_err
const char const char *const const char *const * env
APR_DECLARE(void) apr_proc_other_child_register(apr_proc_t *proc
Definition apr_pools.h:646
apr_file_t * child_in
apr_perms_setfn_t void apr_fileperms_t perms
@ APR_KILL_AFTER_TIMEOUT
@ APR_KILL_ONLY_ONCE
@ APR_KILL_NEVER
@ APR_JUST_WAIT
@ APR_KILL_ALWAYS
@ APR_NOWAIT
@ APR_WAIT
@ APR_PROC_SIGNAL_CORE
@ APR_PROC_SIGNAL
@ APR_PROC_EXIT
@ APR_SHELLCMD
@ APR_PROGRAM_ENV
@ APR_PROGRAM_PATH
@ APR_PROGRAM
@ APR_SHELLCMD_ENV
apr_status_t apr_proc_detach(int daemonize)
Definition procsup.c:19
apr_status_t apr_thread_exit(apr_thread_t *thd, apr_status_t retval)
Definition thread.c:157
apr_status_t apr_thread_join(apr_status_t *retval, apr_thread_t *thd)
Definition thread.c:166
apr_status_t apr_threadattr_detach_set(apr_threadattr_t *attr, apr_int32_t on)
Definition thread.c:41
apr_status_t apr_thread_data_set(void *data, const char *key, apr_status_t(*cleanup)(void *), apr_thread_t *thread)
Definition thread.c:198
apr_status_t apr_thread_data_get(void **data, const char *key, apr_thread_t *thread)
Definition thread.c:186
apr_status_t apr_threadattr_create(apr_threadattr_t **new, apr_pool_t *pool)
Definition thread.c:24
apr_status_t apr_thread_detach(apr_thread_t *thd)
Definition thread.c:181
apr_status_t apr_threadattr_detach_get(apr_threadattr_t *attr)
Definition thread.c:47
apr_status_t apr_thread_create(apr_thread_t **new, apr_threadattr_t *attr, apr_thread_start_t func, void *data, apr_pool_t *pool)
Definition thread.c:73
apr_status_t apr_threadkey_data_set(void *data, const char *key, apr_status_t(*cleanup)(void *), apr_threadkey_t *threadkey)
Definition threadpriv.c:75
apr_status_t apr_threadkey_private_delete(apr_threadkey_t *key)
Definition threadpriv.c:61
apr_status_t apr_threadkey_private_create(apr_threadkey_t **key, void(*dest)(void *), apr_pool_t *pool)
Definition threadpriv.c:20
apr_status_t apr_threadkey_private_set(void *priv, apr_threadkey_t *key)
Definition threadpriv.c:50
apr_status_t apr_threadkey_private_get(void **new, apr_threadkey_t *key)
Definition threadpriv.c:38
apr_status_t apr_threadkey_data_get(void **data, const char *key, apr_threadkey_t *threadkey)
Definition threadpriv.c:70
apr_file_t * in
apr_file_t * out
apr_file_t * err
typedef HANDLE(WINAPI *apr_winapi_fpt_CreateToolhelp32Snapshot)(DWORD dwFlags