blob: 38b194c2d7b124b1e7adfef33784227e3e477a42 [file] [log] [blame]
Willy Tarreaubaaee002006-06-26 02:48:02 +02001/*
2 include/types/global.h
3 Global variables.
4
Willy Tarreau92fb9832007-10-16 17:34:28 +02005 Copyright (C) 2000-2007 Willy Tarreau - w@1wt.eu
Willy Tarreaubaaee002006-06-26 02:48:02 +02006
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>
Robert Tsai81ae1952007-12-05 10:47:29 +010028#include <types/log.h>
Willy Tarreau92fb9832007-10-16 17:34:28 +020029#include <types/protocols.h>
Willy Tarreaubaaee002006-06-26 02:48:02 +020030#include <types/task.h>
31
32/* modes of operation (global.mode) */
Willy Tarreaufbee7132007-10-18 13:53:22 +020033#define MODE_DEBUG 0x01
34#define MODE_DAEMON 0x02
35#define MODE_QUIET 0x04
36#define MODE_CHECK 0x08
37#define MODE_VERBOSE 0x10
38#define MODE_STARTING 0x20
39#define MODE_FOREGROUND 0x40
Willy Tarreaubaaee002006-06-26 02:48:02 +020040
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;
Krzysztof Oledzkib304dc72007-10-14 23:40:01 +020058 int spread_checks;
Willy Tarreau77074d52006-11-12 23:57:19 +010059 char *chroot;
60 char *pidfile;
61 int logfac1, logfac2;
62 int loglev1, loglev2;
Robert Tsai81ae1952007-12-05 10:47:29 +010063 struct logsrv logsrv1, logsrv2;
Willy Tarreau1db37712007-06-03 17:16:49 +020064 struct {
65 int maxpollevents; /* max number of poll events at once */
Willy Tarreaua0250ba2008-01-06 11:22:57 +010066 int maxaccept; /* max number of consecutive accept() */
Willy Tarreau1db37712007-06-03 17:16:49 +020067 } tune;
Willy Tarreau92fb9832007-10-16 17:34:28 +020068 struct listener stats_sock; /* unix socket listener for statistics */
Willy Tarreau0c303ee2008-07-07 00:09:58 +020069 int stats_timeout; /* in ticks */
Willy Tarreaubaaee002006-06-26 02:48:02 +020070};
71
72extern struct global global;
73extern char *progname; /* program name */
74extern int pid; /* current process id */
Willy Tarreaudcd47712007-11-04 23:35:08 +010075extern int relative_pid; /* process id starting at 1 */
Willy Tarreaubaaee002006-06-26 02:48:02 +020076extern int actconn; /* # of active sessions */
77extern int listeners;
78extern char trash[BUFSIZE];
79extern const int zero;
80extern const int one;
Alexandre Cassen87ea5482007-10-11 20:48:58 +020081extern const struct linger nolinger;
Willy Tarreaubaaee002006-06-26 02:48:02 +020082extern int stopping; /* non zero means stopping in progress */
83
84#endif /* _TYPES_GLOBAL_H */
85
86/*
87 * Local variables:
88 * c-indent-level: 8
89 * c-basic-offset: 8
90 * End:
91 */