blob: b25995491ec132adf5dd345e882eb1ed375cf443 [file] [log] [blame]
Willy Tarreaubaaee002006-06-26 02:48:02 +02001/*
2 include/types/global.h
3 Global variables.
4
5 Copyright (C) 2000-2006 Willy Tarreau - w@1wt.eu
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation, version 2.1
10 exclusively.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20*/
21
22#ifndef _TYPES_GLOBAL_H
23#define _TYPES_GLOBAL_H
24
25#include <netinet/in.h>
26
Willy Tarreaue3ba5f02006-06-29 18:54:54 +020027#include <common/config.h>
Willy Tarreaubaaee002006-06-26 02:48:02 +020028#include <types/task.h>
29
30/* modes of operation (global.mode) */
31#define MODE_DEBUG 1
32#define MODE_STATS 2
33#define MODE_LOG 4
34#define MODE_DAEMON 8
35#define MODE_QUIET 16
36#define MODE_CHECK 32
37#define MODE_VERBOSE 64
38#define MODE_STARTING 128
39#define MODE_FOREGROUND 256
40
Willy Tarreau77074d52006-11-12 23:57:19 +010041/* list of last checks to perform, depending on config options */
42#define LSTCHK_CAP_BIND 0x00000001 /* check that we can bind to any port */
43#define LSTCHK_CTTPROXY 0x00000002 /* check that tproxy is enabled */
44#define LSTCHK_NETADM 0x00000004 /* check that we have CAP_NET_ADMIN */
Willy Tarreau8f922fc2007-01-06 21:11:49 +010045#define LSTCHK_TCPSPLICE 0x00000008 /* check that linux tcp_splice is enabled */
Willy Tarreaubaaee002006-06-26 02:48:02 +020046
47/* FIXME : this will have to be redefined correctly */
48struct global {
Willy Tarreau77074d52006-11-12 23:57:19 +010049 int uid;
50 int gid;
51 int nbproc;
52 int maxconn;
53 int maxsock; /* max # of sockets */
54 int rlimit_nofile; /* default ulimit-n value : 0=unset */
55 int rlimit_memmax; /* default ulimit-d in megs value : 0=unset */
56 int mode;
57 int last_checks;
58 char *chroot;
59 char *pidfile;
60 int logfac1, logfac2;
61 int loglev1, loglev2;
62 struct sockaddr_in logsrv1, logsrv2;
Willy Tarreau1db37712007-06-03 17:16:49 +020063 struct {
64 int maxpollevents; /* max number of poll events at once */
65 } tune;
Willy Tarreaubaaee002006-06-26 02:48:02 +020066};
67
68extern struct global global;
69extern char *progname; /* program name */
70extern int pid; /* current process id */
71extern int actconn; /* # of active sessions */
72extern int listeners;
73extern char trash[BUFSIZE];
74extern const int zero;
75extern const int one;
76extern int stopping; /* non zero means stopping in progress */
77
78#endif /* _TYPES_GLOBAL_H */
79
80/*
81 * Local variables:
82 * c-indent-level: 8
83 * c-basic-offset: 8
84 * End:
85 */