Apache2
apr_arch_threadproc.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 #include "apr.h"
18 #include "apr_private.h"
19 #include "apr_thread_proc.h"
20 #include "apr_file_io.h"
21 #include "apr_arch_file_io.h"
22 #include "apr_perms_set.h"
23 
24 /* System headers required for thread/process library */
25 #if APR_HAVE_PTHREAD_H
26 #include <pthread.h>
27 #endif
28 #ifdef HAVE_SYS_RESOURCE_H
29 #include <sys/resource.h>
30 #endif
31 #if APR_HAVE_SIGNAL_H
32 #include <signal.h>
33 #endif
34 #if APR_HAVE_STRING_H
35 #include <string.h>
36 #endif
37 #if APR_HAVE_SYS_WAIT_H
38 #include <sys/wait.h>
39 #endif
40 #if APR_HAVE_STRING_H
41 #include <string.h>
42 #endif
43 #ifdef HAVE_SCHED_H
44 #include <sched.h>
45 #endif
46 /* End System Headers */
47 
48 
49 #ifndef THREAD_PROC_H
50 #define THREAD_PROC_H
51 
52 #define SHELL_PATH "/bin/sh"
53 
54 #if APR_HAS_THREADS
55 
56 struct apr_thread_t {
58  pthread_t *td;
59  void *data;
62  int detached;
63 };
64 
65 struct apr_threadattr_t {
67  pthread_attr_t attr;
69 };
70 
71 struct apr_threadkey_t {
73  pthread_key_t key;
74 };
75 
76 struct apr_thread_once_t {
77  pthread_once_t once;
78 };
79 
80 #endif
81 
87  const void *data;
88 };
89 
90 struct apr_procattr_t {
98  char *currdir;
101 #ifdef RLIMIT_CPU
102  struct rlimit *limit_cpu;
103 #endif
104 #if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS)
105  struct rlimit *limit_mem;
106 #endif
107 #ifdef RLIMIT_NPROC
108  struct rlimit *limit_nproc;
109 #endif
110 #ifdef RLIMIT_NOFILE
111  struct rlimit *limit_nofile;
112 #endif
118 };
119 
120 #endif /* ! THREAD_PROC_H */
121 
APR Platform Definitions.
APR File I/O Handling.
APR Process Locking Routines.
APR Thread and Process Library.
int apr_status_t
Definition: apr_errno.h:44
apr_int32_t apr_fileperms_t
Definition: apr_file_info.h:125
apr_status_t() apr_perms_setfn_t(void *object, apr_fileperms_t perms, apr_uid_t uid, apr_gid_t gid)
Definition: apr_perms_set.h:42
int apr_int32_t
Definition: apr.h:347
size_t apr_size_t
Definition: apr.h:394
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
void() apr_child_errfn_t(apr_pool_t *proc, apr_status_t err, const char *description)
Definition: apr_thread_proc.h:174
void *(APR_THREAD_FUNC * apr_thread_start_t)(apr_thread_t *, void *)
Definition: apr_thread_proc.h:198
gid_t apr_gid_t
Definition: apr_user.h:54
uid_t apr_uid_t
Definition: apr_user.h:45
Definition: apr_arch_file_io.h:107
Definition: apr_arch_threadproc.h:83
struct apr_procattr_pscb_t * next
Definition: apr_arch_threadproc.h:84
apr_fileperms_t perms
Definition: apr_arch_threadproc.h:86
apr_perms_setfn_t * perms_set_fn
Definition: apr_arch_threadproc.h:85
const void * data
Definition: apr_arch_threadproc.h:87
Definition: apr_arch_threadproc.h:78
apr_file_t * child_err
Definition: apr_arch_threadproc.h:85
apr_int32_t detached
Definition: apr_arch_threadproc.h:88
apr_int32_t errchk
Definition: apr_arch_threadproc.h:114
apr_child_errfn_t * errfn
Definition: apr_arch_threadproc.h:113
apr_pool_t * pool
Definition: apr_arch_threadproc.h:79
apr_int32_t cmdtype
Definition: apr_arch_threadproc.h:87
apr_file_t * parent_in
Definition: apr_arch_threadproc.h:80
apr_procattr_pscb_t * perms_set_callbacks
Definition: apr_arch_threadproc.h:117
apr_gid_t gid
Definition: apr_arch_threadproc.h:116
apr_file_t * parent_out
Definition: apr_arch_threadproc.h:82
apr_file_t * child_out
Definition: apr_arch_threadproc.h:83
apr_uid_t uid
Definition: apr_arch_threadproc.h:115
apr_file_t * child_in
Definition: apr_arch_threadproc.h:81
char * currdir
Definition: apr_arch_threadproc.h:86
apr_file_t * parent_err
Definition: apr_arch_threadproc.h:84
Definition: apr_arch_threadproc.h:91
pthread_once_t once
Definition: apr_arch_threadproc.h:77
Definition: apr_arch_threadproc.h:42
pthread_t * td
Definition: apr_arch_threadproc.h:58
apr_status_t exitval
Definition: apr_arch_threadproc.h:47
void * data
Definition: apr_arch_threadproc.h:45
apr_pool_t * pool
Definition: apr_arch_threadproc.h:43
apr_thread_start_t func
Definition: apr_arch_threadproc.h:46
int detached
Definition: apr_arch_threadproc.h:48
Definition: apr_arch_threadproc.h:51
apr_size_t max_free
Definition: apr_arch_threadproc.h:56
apr_pool_t * pool
Definition: apr_arch_threadproc.h:52
pthread_attr_t attr
Definition: apr_arch_threadproc.h:67
Definition: apr_arch_threadproc.h:59
apr_pool_t * pool
Definition: apr_arch_threadproc.h:60
pthread_key_t key
Definition: apr_arch_threadproc.h:73