blob: 40c6c997ab6b59e05f80ee9a29b1f2bbea7c12b6 [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 Tarreaubaaee002006-06-26 02:48:02 +020045
46/* FIXME : this will have to be redefined correctly */
47struct global {
Willy Tarreau77074d52006-11-12 23:57:19 +010048 int uid;
49 int gid;
50 int nbproc;
51 int maxconn;
52 int maxsock; /* max # of sockets */
53 int rlimit_nofile; /* default ulimit-n value : 0=unset */
54 int rlimit_memmax; /* default ulimit-d in megs value : 0=unset */
55 int mode;
56 int last_checks;
57 char *chroot;
58 char *pidfile;
59 int logfac1, logfac2;
60 int loglev1, loglev2;
61 struct sockaddr_in logsrv1, logsrv2;
Willy Tarreaubaaee002006-06-26 02:48:02 +020062};
63
64extern struct global global;
65extern char *progname; /* program name */
66extern int pid; /* current process id */
67extern int actconn; /* # of active sessions */
68extern int listeners;
69extern char trash[BUFSIZE];
70extern const int zero;
71extern const int one;
72extern int stopping; /* non zero means stopping in progress */
73
74#endif /* _TYPES_GLOBAL_H */
75
76/*
77 * Local variables:
78 * c-indent-level: 8
79 * c-basic-offset: 8
80 * End:
81 */