mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-03-05 19:10:45 +00:00
REORG: include: move fd.h to haproxy/fd{,-t}.h
A few includes were missing in each file. A definition of struct polled_mask was moved to fd-t.h. The MAX_POLLERS macro was moved to defaults.h Stdio used to be silently inherited from whatever path but it's needed for list_pollers() which takes a FILE* and which can thus not be forward-declared.
This commit is contained in:
parent
fc8f6a8517
commit
0f6ffd652e
@ -347,4 +347,9 @@
|
||||
#define DEFAULT_PAT_LRU_SIZE 10000
|
||||
#endif
|
||||
|
||||
/* maximum number of pollers that may be registered */
|
||||
#ifndef MAX_POLLERS
|
||||
#define MAX_POLLERS 10
|
||||
#endif
|
||||
|
||||
#endif /* _HAPROXY_DEFAULTS_H */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* include/types/fd.h
|
||||
* include/haproxy/fd-t.h
|
||||
* File descriptors states - check src/fd.c for explanations.
|
||||
*
|
||||
* Copyright (C) 2000-2014 Willy Tarreau - w@1wt.eu
|
||||
@ -19,11 +19,10 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _TYPES_FD_H
|
||||
#define _TYPES_FD_H
|
||||
#ifndef _HAPROXY_FD_T_H
|
||||
#define _HAPROXY_FD_T_H
|
||||
|
||||
#include <haproxy/api-t.h>
|
||||
#include <import/ist.h>
|
||||
#include <haproxy/port_range-t.h>
|
||||
|
||||
/* Direction for each FD event update */
|
||||
@ -107,13 +106,13 @@ enum {
|
||||
struct fdlist_entry {
|
||||
int next;
|
||||
int prev;
|
||||
} __attribute__ ((aligned(8)));
|
||||
} ALIGNED(8);
|
||||
|
||||
/* head of the fd cache */
|
||||
struct fdlist {
|
||||
int first;
|
||||
int last;
|
||||
} __attribute__ ((aligned(8)));
|
||||
} ALIGNED(8);
|
||||
|
||||
/* info about one given fd */
|
||||
struct fdtab {
|
||||
@ -133,10 +132,16 @@ struct fdtab {
|
||||
/* only align on cache lines when using threads; 32-bit small archs
|
||||
* can put everything in 32-bytes when threads are disabled.
|
||||
*/
|
||||
__attribute__((aligned(64)))
|
||||
ALIGNED(64)
|
||||
#endif
|
||||
;
|
||||
|
||||
/* polled mask, one bit per thread and per direction for each FD */
|
||||
struct polled_mask {
|
||||
unsigned long poll_recv;
|
||||
unsigned long poll_send;
|
||||
};
|
||||
|
||||
/* less often used information */
|
||||
struct fdinfo {
|
||||
struct port_range *port_range; /* optional port range to bind to */
|
||||
@ -174,17 +179,7 @@ struct poller {
|
||||
int pref; /* try pollers with higher preference first */
|
||||
};
|
||||
|
||||
extern struct poller cur_poller; /* the current poller */
|
||||
extern int nbpollers;
|
||||
#define MAX_POLLERS 10
|
||||
extern struct poller pollers[MAX_POLLERS]; /* all registered pollers */
|
||||
|
||||
extern struct fdtab *fdtab; /* array of all the file descriptors */
|
||||
extern struct fdinfo *fdinfo; /* less-often used infos for file descriptors */
|
||||
extern int totalconn; /* total # of terminated sessions */
|
||||
extern int actconn; /* # of active sessions */
|
||||
|
||||
#endif /* _TYPES_FD_H */
|
||||
#endif /* _HAPROXY_FD_T_H */
|
||||
|
||||
/*
|
||||
* Local variables:
|
@ -1,8 +1,8 @@
|
||||
/*
|
||||
* include/proto/fd.h
|
||||
* File descriptors states.
|
||||
* include/haproxy/fd.h
|
||||
* File descriptors states - exported variables and functions
|
||||
*
|
||||
* Copyright (C) 2000-2014 Willy Tarreau - w@1wt.eu
|
||||
* Copyright (C) 2000-2020 Willy Tarreau - w@1wt.eu
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -19,29 +19,33 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _PROTO_FD_H
|
||||
#define _PROTO_FD_H
|
||||
#ifndef _HAPROXY_FD_H
|
||||
#define _HAPROXY_FD_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <import/ist.h>
|
||||
#include <haproxy/activity.h>
|
||||
#include <haproxy/api.h>
|
||||
#include <haproxy/fd-t.h>
|
||||
#include <haproxy/thread.h>
|
||||
#include <haproxy/ticks.h>
|
||||
#include <haproxy/time.h>
|
||||
#include <types/fd.h>
|
||||
#include <haproxy/activity.h>
|
||||
|
||||
/* public variables */
|
||||
|
||||
extern struct poller cur_poller; /* the current poller */
|
||||
extern int nbpollers;
|
||||
extern struct poller pollers[MAX_POLLERS]; /* all registered pollers */
|
||||
extern struct fdtab *fdtab; /* array of all the file descriptors */
|
||||
extern struct fdinfo *fdinfo; /* less-often used infos for file descriptors */
|
||||
extern int totalconn; /* total # of terminated sessions */
|
||||
extern int actconn; /* # of active sessions */
|
||||
|
||||
extern volatile struct fdlist update_list;
|
||||
|
||||
|
||||
extern struct polled_mask {
|
||||
unsigned long poll_recv;
|
||||
unsigned long poll_send;
|
||||
} *polled_mask;
|
||||
extern struct polled_mask *polled_mask;
|
||||
|
||||
extern THREAD_LOCAL int *fd_updt; // FD updates list
|
||||
extern THREAD_LOCAL int fd_nbupdt; // number of updates in the list
|
||||
@ -66,6 +70,7 @@ void fd_remove(int fd);
|
||||
*/
|
||||
int fd_takeover(int fd, void *expected_owner);
|
||||
|
||||
/* lock used by FD migration */
|
||||
#ifndef HA_HAVE_CAS_DW
|
||||
__decl_thread(extern HA_RWLOCK_T fd_mig_lock);
|
||||
#endif
|
||||
@ -497,7 +502,7 @@ static inline void wake_thread(int tid)
|
||||
}
|
||||
|
||||
|
||||
#endif /* _PROTO_FD_H */
|
||||
#endif /* _HAPROXY_FD_H */
|
||||
|
||||
/*
|
||||
* Local variables:
|
@ -27,7 +27,7 @@
|
||||
#include <haproxy/pool.h>
|
||||
#include <types/connection.h>
|
||||
#include <types/listener.h>
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
#include <proto/obj_type.h>
|
||||
#include <proto/session.h>
|
||||
#include <proto/task.h>
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <haproxy/pool.h>
|
||||
#include <types/action.h>
|
||||
#include <types/stream.h>
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
#include <haproxy/freq_ctr.h>
|
||||
#include <proto/obj_type.h>
|
||||
#include <proto/queue.h>
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include <types/global.h>
|
||||
#include <types/task.h>
|
||||
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
|
||||
/* Principle of the wait queue.
|
||||
*
|
||||
|
@ -52,7 +52,7 @@
|
||||
#include <proto/backend.h>
|
||||
#include <proto/checks.h>
|
||||
#include <proto/stats.h>
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
#include <proto/http_htx.h>
|
||||
#include <proto/log.h>
|
||||
#include <proto/mux_pt.h>
|
||||
|
@ -48,7 +48,7 @@
|
||||
#include <proto/cli.h>
|
||||
#include <proto/compression.h>
|
||||
#include <proto/stats.h>
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
#include <haproxy/freq_ctr.h>
|
||||
#include <proto/frontend.h>
|
||||
#include <proto/log.h>
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <haproxy/net_helper.h>
|
||||
|
||||
#include <proto/connection.h>
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
#include <proto/frontend.h>
|
||||
#include <proto/proto_tcp.h>
|
||||
#include <proto/stream_interface.h>
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <types/signal.h>
|
||||
|
||||
#include <proto/cli.h>
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
#include <proto/hlua.h>
|
||||
#include <proto/stream_interface.h>
|
||||
#include <proto/task.h>
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include <proto/cli.h>
|
||||
#include <proto/checks.h>
|
||||
#include <proto/dns.h>
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
#include <proto/http_ana.h>
|
||||
#include <proto/http_rules.h>
|
||||
#include <proto/log.h>
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <types/global.h>
|
||||
|
||||
#include <haproxy/activity.h>
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
#include <proto/signal.h>
|
||||
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <types/global.h>
|
||||
|
||||
#include <haproxy/activity.h>
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
#include <proto/log.h>
|
||||
#include <proto/signal.h>
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <types/global.h>
|
||||
|
||||
#include <haproxy/activity.h>
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
#include <proto/signal.h>
|
||||
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <types/global.h>
|
||||
|
||||
#include <haproxy/activity.h>
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
|
||||
|
||||
#ifndef POLLRDHUP
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <types/global.h>
|
||||
|
||||
#include <haproxy/activity.h>
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
|
||||
|
||||
/* private data */
|
||||
|
2
src/fd.c
2
src/fd.c
@ -91,7 +91,7 @@
|
||||
#include <haproxy/api.h>
|
||||
#include <types/global.h>
|
||||
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
#include <proto/log.h>
|
||||
#include <haproxy/port_range.h>
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include <proto/acl.h>
|
||||
#include <proto/arg.h>
|
||||
#include <proto/channel.h>
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
#include <proto/frontend.h>
|
||||
#include <proto/log.h>
|
||||
#include <proto/proto_tcp.h>
|
||||
|
@ -113,7 +113,7 @@
|
||||
#include <proto/channel.h>
|
||||
#include <proto/cli.h>
|
||||
#include <proto/connection.h>
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
#include <proto/filters.h>
|
||||
#include <proto/hlua.h>
|
||||
#include <proto/http_rules.h>
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#include <proto/acl.h>
|
||||
#include <proto/connection.h>
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
#include <haproxy/freq_ctr.h>
|
||||
#include <proto/log.h>
|
||||
#include <proto/listener.h>
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
#include <proto/applet.h>
|
||||
#include <proto/cli.h>
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
#include <proto/frontend.h>
|
||||
#include <proto/log.h>
|
||||
#include <proto/ring.h>
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <types/signal.h>
|
||||
|
||||
#include <proto/cli.h>
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
#include <proto/listener.h>
|
||||
#include <proto/log.h>
|
||||
#include <proto/mworker.h>
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include <proto/applet.h>
|
||||
#include <proto/channel.h>
|
||||
#include <proto/cli.h>
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
#include <proto/frontend.h>
|
||||
#include <proto/log.h>
|
||||
#include <proto/mux_pt.h>
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include <types/global.h>
|
||||
|
||||
#include <proto/connection.h>
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
#include <haproxy/freq_ctr.h>
|
||||
#include <proto/listener.h>
|
||||
#include <proto/log.h>
|
||||
|
@ -44,7 +44,7 @@
|
||||
#include <proto/arg.h>
|
||||
#include <proto/channel.h>
|
||||
#include <proto/connection.h>
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
#include <proto/http_rules.h>
|
||||
#include <proto/listener.h>
|
||||
#include <proto/log.h>
|
||||
|
@ -11,10 +11,10 @@
|
||||
*/
|
||||
|
||||
#include <types/global.h>
|
||||
#include <types/fd.h>
|
||||
#include <haproxy/fd-t.h>
|
||||
#include <types/proto_udp.h>
|
||||
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
|
||||
/* datagram handler callback */
|
||||
void dgram_fd_handler(int fd)
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include <types/global.h>
|
||||
|
||||
#include <proto/connection.h>
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
#include <proto/listener.h>
|
||||
#include <proto/log.h>
|
||||
#include <haproxy/protocol.h>
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include <proto/applet.h>
|
||||
#include <proto/cli.h>
|
||||
#include <proto/backend.h>
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
#include <proto/filters.h>
|
||||
#include <proto/listener.h>
|
||||
#include <proto/log.h>
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include <haproxy/time.h>
|
||||
|
||||
#include <proto/connection.h>
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
#include <haproxy/freq_ctr.h>
|
||||
#include <proto/log.h>
|
||||
#include <proto/pipe.h>
|
||||
|
@ -68,7 +68,7 @@
|
||||
#include <proto/channel.h>
|
||||
#include <proto/connection.h>
|
||||
#include <proto/cli.h>
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
#include <haproxy/freq_ctr.h>
|
||||
#include <proto/frontend.h>
|
||||
#include <proto/http_rules.h>
|
||||
|
@ -51,7 +51,7 @@
|
||||
#include <proto/compression.h>
|
||||
#include <proto/dns.h>
|
||||
#include <proto/stats.h>
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
#include <haproxy/freq_ctr.h>
|
||||
#include <proto/frontend.h>
|
||||
#include <proto/http_htx.h>
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include <proto/connection.h>
|
||||
#include <proto/dns.h>
|
||||
#include <proto/stats.h>
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
#include <proto/filters.h>
|
||||
#include <haproxy/freq_ctr.h>
|
||||
#include <proto/frontend.h>
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <import/eb32sctree.h>
|
||||
#include <import/eb32tree.h>
|
||||
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
#include <haproxy/freq_ctr.h>
|
||||
#include <proto/proxy.h>
|
||||
#include <proto/stream.h>
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <haproxy/thread.h>
|
||||
#include <haproxy/tools.h>
|
||||
#include <types/global.h>
|
||||
#include <proto/fd.h>
|
||||
#include <haproxy/fd.h>
|
||||
|
||||
struct thread_info ha_thread_info[MAX_THREADS] = { };
|
||||
THREAD_LOCAL struct thread_info *ti = &ha_thread_info[0];
|
||||
|
Loading…
Reference in New Issue
Block a user