apr_arch_threadproc.h revision 251875
190792Sgshapiro/* Licensed to the Apache Software Foundation (ASF) under one or more
2261363Sgshapiro * contributor license agreements.  See the NOTICE file distributed with
390792Sgshapiro * this work for additional information regarding copyright ownership.
490792Sgshapiro * The ASF licenses this file to You under the Apache License, Version 2.0
590792Sgshapiro * (the "License"); you may not use this file except in compliance with
690792Sgshapiro * the License.  You may obtain a copy of the License at
790792Sgshapiro *
890792Sgshapiro *     http://www.apache.org/licenses/LICENSE-2.0
990792Sgshapiro *
1090792Sgshapiro * Unless required by applicable law or agreed to in writing, software
1190792Sgshapiro * distributed under the License is distributed on an "AS IS" BASIS,
12266692Sgshapiro * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1390792Sgshapiro * See the License for the specific language governing permissions and
1490792Sgshapiro * limitations under the License.
1590792Sgshapiro */
1690792Sgshapiro
1790792Sgshapiro#include "apr.h"
1890792Sgshapiro#include "apr_private.h"
1990792Sgshapiro#include "apr_thread_proc.h"
2090792Sgshapiro#include "apr_file_io.h"
2190792Sgshapiro#include "apr_arch_file_io.h"
2290792Sgshapiro
2390792Sgshapiro/* System headers required for thread/process library */
2490792Sgshapiro#if APR_HAVE_PTHREAD_H
2590792Sgshapiro#include <pthread.h>
2690792Sgshapiro#endif
2790792Sgshapiro#ifdef HAVE_SYS_RESOURCE_H
2890792Sgshapiro#include <sys/resource.h>
2990792Sgshapiro#endif
3090792Sgshapiro#if APR_HAVE_SIGNAL_H
3190792Sgshapiro#include <signal.h>
3290792Sgshapiro#endif
3390792Sgshapiro#if APR_HAVE_STRING_H
3490792Sgshapiro#include <string.h>
3590792Sgshapiro#endif
3690792Sgshapiro#if APR_HAVE_SYS_WAIT_H
3790792Sgshapiro#include <sys/wait.h>
3890792Sgshapiro#endif
3990792Sgshapiro#if APR_HAVE_STRING_H
4090792Sgshapiro#include <string.h>
4190792Sgshapiro#endif
4290792Sgshapiro#if HAVE_SCHED_H
4390792Sgshapiro#include <sched.h>
4490792Sgshapiro#endif
4590792Sgshapiro/* End System Headers */
4690792Sgshapiro
4790792Sgshapiro
4890792Sgshapiro#ifndef THREAD_PROC_H
4990792Sgshapiro#define THREAD_PROC_H
5090792Sgshapiro
5190792Sgshapiro#define SHELL_PATH "/bin/sh"
5290792Sgshapiro
5390792Sgshapiro#if APR_HAS_THREADS
5490792Sgshapiro
5590792Sgshapirostruct apr_thread_t {
5690792Sgshapiro    apr_pool_t *pool;
5790792Sgshapiro    pthread_t *td;
5890792Sgshapiro    void *data;
5990792Sgshapiro    apr_thread_start_t func;
6090792Sgshapiro    apr_status_t exitval;
6190792Sgshapiro};
6290792Sgshapiro
6390792Sgshapirostruct apr_threadattr_t {
6490792Sgshapiro    apr_pool_t *pool;
6590792Sgshapiro    pthread_attr_t attr;
6690792Sgshapiro};
6790792Sgshapiro
6890792Sgshapirostruct apr_threadkey_t {
6990792Sgshapiro    apr_pool_t *pool;
7090792Sgshapiro    pthread_key_t key;
7190792Sgshapiro};
7290792Sgshapiro
7390792Sgshapirostruct apr_thread_once_t {
7490792Sgshapiro    pthread_once_t once;
7590792Sgshapiro};
7690792Sgshapiro
7790792Sgshapiro#endif
7890792Sgshapiro
7990792Sgshapirostruct apr_procattr_t {
8090792Sgshapiro    apr_pool_t *pool;
8190792Sgshapiro    apr_file_t *parent_in;
8290792Sgshapiro    apr_file_t *child_in;
8390792Sgshapiro    apr_file_t *parent_out;
8490792Sgshapiro    apr_file_t *child_out;
8590792Sgshapiro    apr_file_t *parent_err;
8690792Sgshapiro    apr_file_t *child_err;
8790792Sgshapiro    char *currdir;
8890792Sgshapiro    apr_int32_t cmdtype;
8990792Sgshapiro    apr_int32_t detached;
9090792Sgshapiro#ifdef RLIMIT_CPU
9190792Sgshapiro    struct rlimit *limit_cpu;
9290792Sgshapiro#endif
9390792Sgshapiro#if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS)
9490792Sgshapiro    struct rlimit *limit_mem;
9590792Sgshapiro#endif
9690792Sgshapiro#ifdef RLIMIT_NPROC
9790792Sgshapiro    struct rlimit *limit_nproc;
9890792Sgshapiro#endif
9990792Sgshapiro#ifdef RLIMIT_NOFILE
10090792Sgshapiro    struct rlimit *limit_nofile;
10190792Sgshapiro#endif
10290792Sgshapiro    apr_child_errfn_t *errfn;
10390792Sgshapiro    apr_int32_t errchk;
10490792Sgshapiro    apr_uid_t   uid;
10590792Sgshapiro    apr_gid_t   gid;
10690792Sgshapiro};
10790792Sgshapiro
10890792Sgshapiro#endif  /* ! THREAD_PROC_H */
10990792Sgshapiro
11090792Sgshapiro