~alinuxninja/nginx-edge/trunk

« back to all changes in this revision

Viewing changes to debian/modules/ngx_pagespeed/psol/include/third_party/httpd/src/os/unix/unixd.h

  • Committer: Vivian
  • Date: 2015-12-04 18:20:11 UTC
  • Revision ID: git-v1:a36f2bc32e884f7473b3a47040e5411306144d7d
* Do not extract psol.tar.gz

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
/**
18
 
 * @file  unixd.h
19
 
 * @brief common stuff that unix MPMs will want 
20
 
 *
21
 
 * @addtogroup APACHE_OS_UNIX
22
 
 * @{
23
 
 */
24
 
 
25
 
#ifndef UNIXD_H
26
 
#define UNIXD_H
27
 
 
28
 
#include "httpd.h"
29
 
#include "http_config.h"
30
 
#include "ap_listen.h"
31
 
#ifdef HAVE_SYS_TIME_H
32
 
#include <sys/time.h>
33
 
#endif
34
 
#ifdef HAVE_SYS_RESOURCE_H
35
 
#include <sys/resource.h>
36
 
#endif
37
 
#include "apr_hooks.h"
38
 
#include "apr_thread_proc.h"
39
 
#include "apr_proc_mutex.h"
40
 
#include "apr_global_mutex.h"
41
 
 
42
 
#include <pwd.h>
43
 
#include <grp.h>
44
 
#ifdef APR_HAVE_SYS_TYPES_H
45
 
#include <sys/types.h>
46
 
#endif
47
 
#ifdef HAVE_SYS_IPC_H
48
 
#include <sys/ipc.h>
49
 
#endif
50
 
 
51
 
typedef struct {
52
 
    uid_t uid;
53
 
    gid_t gid;
54
 
    int userdir;
55
 
} ap_unix_identity_t;
56
 
 
57
 
AP_DECLARE_HOOK(ap_unix_identity_t *, get_suexec_identity,(const request_rec *r))
58
 
 
59
 
 
60
 
/* Default user name and group name. These may be specified as numbers by
61
 
 * placing a # before a number */
62
 
 
63
 
#ifndef DEFAULT_USER
64
 
#define DEFAULT_USER "#-1"
65
 
#endif
66
 
#ifndef DEFAULT_GROUP
67
 
#define DEFAULT_GROUP "#-1"
68
 
#endif
69
 
 
70
 
typedef struct {
71
 
    const char *user_name;
72
 
    uid_t user_id;
73
 
    gid_t group_id;
74
 
    int suexec_enabled;
75
 
    const char *chroot_dir;
76
 
} unixd_config_rec;
77
 
AP_DECLARE_DATA extern unixd_config_rec unixd_config;
78
 
 
79
 
AP_DECLARE(int) unixd_setup_child(void);
80
 
AP_DECLARE(void) unixd_pre_config(apr_pool_t *ptemp);
81
 
AP_DECLARE(const char *) unixd_set_user(cmd_parms *cmd, void *dummy, 
82
 
                                        const char *arg);
83
 
AP_DECLARE(const char *) unixd_set_group(cmd_parms *cmd, void *dummy, 
84
 
                                         const char *arg);
85
 
AP_DECLARE(const char *) unixd_set_chroot_dir(cmd_parms *cmd, void *dummy, 
86
 
                                              const char *arg);
87
 
                                         
88
 
#if defined(RLIMIT_CPU) || defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_NPROC) || defined(RLIMIT_AS)
89
 
AP_DECLARE(void) unixd_set_rlimit(cmd_parms *cmd, struct rlimit **plimit,
90
 
                           const char *arg, const char * arg2, int type);
91
 
#endif
92
 
 
93
 
/**
94
 
 * One of the functions to set mutex permissions should be called in
95
 
 * the parent process on platforms that switch identity when the 
96
 
 * server is started as root.
97
 
 * If the child init logic is performed before switching identity
98
 
 * (e.g., MPM setup for an accept mutex), it should only be called
99
 
 * for SysV semaphores.  Otherwise, it is safe to call it for all
100
 
 * mutex types.
101
 
 */
102
 
AP_DECLARE(apr_status_t) unixd_set_proc_mutex_perms(apr_proc_mutex_t *pmutex);
103
 
AP_DECLARE(apr_status_t) unixd_set_global_mutex_perms(apr_global_mutex_t *gmutex);
104
 
AP_DECLARE(apr_status_t) unixd_accept(void **accepted, ap_listen_rec *lr, apr_pool_t *ptrans);
105
 
 
106
 
#ifdef HAVE_KILLPG
107
 
#define unixd_killpg(x, y)      (killpg ((x), (y)))
108
 
#define ap_os_killpg(x, y)      (killpg ((x), (y)))
109
 
#else /* HAVE_KILLPG */
110
 
#define unixd_killpg(x, y)      (kill (-(x), (y)))
111
 
#define ap_os_killpg(x, y)      (kill (-(x), (y)))
112
 
#endif /* HAVE_KILLPG */
113
 
 
114
 
#define UNIX_DAEMON_COMMANDS    \
115
 
AP_INIT_TAKE1("User", unixd_set_user, NULL, RSRC_CONF, \
116
 
  "Effective user id for this server"), \
117
 
AP_INIT_TAKE1("Group", unixd_set_group, NULL, RSRC_CONF, \
118
 
  "Effective group id for this server"), \
119
 
AP_INIT_TAKE1("ChrootDir", unixd_set_chroot_dir, NULL, RSRC_CONF, \
120
 
    "The directory to chroot(2) into")
121
 
 
122
 
#endif
123
 
/** @} */