Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 1 | /* |
| 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 Tarreau | e3ba5f0 | 2006-06-29 18:54:54 +0200 | [diff] [blame] | 27 | #include <common/config.h> |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 28 | #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 Tarreau | 77074d5 | 2006-11-12 23:57:19 +0100 | [diff] [blame] | 41 | /* 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 Tarreau | 8f922fc | 2007-01-06 21:11:49 +0100 | [diff] [blame] | 45 | #define LSTCHK_TCPSPLICE 0x00000008 /* check that linux tcp_splice is enabled */ |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 46 | |
| 47 | /* FIXME : this will have to be redefined correctly */ |
| 48 | struct global { |
Willy Tarreau | 77074d5 | 2006-11-12 23:57:19 +0100 | [diff] [blame] | 49 | 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 Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 63 | }; |
| 64 | |
| 65 | extern struct global global; |
| 66 | extern char *progname; /* program name */ |
| 67 | extern int pid; /* current process id */ |
| 68 | extern int actconn; /* # of active sessions */ |
| 69 | extern int listeners; |
| 70 | extern char trash[BUFSIZE]; |
| 71 | extern const int zero; |
| 72 | extern const int one; |
| 73 | extern int stopping; /* non zero means stopping in progress */ |
| 74 | |
| 75 | #endif /* _TYPES_GLOBAL_H */ |
| 76 | |
| 77 | /* |
| 78 | * Local variables: |
| 79 | * c-indent-level: 8 |
| 80 | * c-basic-offset: 8 |
| 81 | * End: |
| 82 | */ |