Removed the passing of epoll fd and isolated epoll functionality to

a signle file

Addition of show epoll debug CLI command
This commit is contained in:
Mark Riddoch
2013-06-19 16:29:52 +02:00
parent c2b24884fd
commit 0fc2f9dda3
20 changed files with 412 additions and 280 deletions

View File

@ -65,15 +65,15 @@ struct dcb;
* @see load_module
*/
typedef struct gw_protocol {
int (*read)(struct dcb *, int);
int (*read)(struct dcb *);
int (*write)(struct dcb *, GWBUF *);
int (*write_ready)(struct dcb *, int);
int (*error)(struct dcb *, int);
int (*hangup)(struct dcb *, int);
int (*accept)(struct dcb *, int);
int (*connect)(struct server *, struct session *, int);
int (*close)(struct dcb *, int);
int (*listen)(struct dcb *, int, char *);
int (*write_ready)(struct dcb *);
int (*error)(struct dcb *);
int (*hangup)(struct dcb *);
int (*accept)(struct dcb *);
int (*connect)(struct server *, struct session *);
int (*close)(struct dcb *);
int (*listen)(struct dcb *, char *);
} GWPROTOCOL;
/**
@ -131,7 +131,7 @@ extern DCB *connect_dcb(struct server *, struct session *, const char *);
extern int dcb_read(DCB *, GWBUF **); /* Generic read routine */
extern int dcb_write(DCB *, GWBUF *); /* Generic write routine */
extern int dcb_drain_writeq(DCB *); /* Generic write routine */
extern void dcb_close(DCB *, int); /* Generic close functionality */
extern void dcb_close(DCB *); /* Generic close functionality */
extern void printAllDCBs(); /* Debug to print all DCB in the system */
extern void printDCB(DCB *); /* Debug print routine */
extern void dprintAllDCBs(DCB *); /* Debug to print all DCB in the system */

View File

@ -51,10 +51,10 @@
#include "dcb.h"
int do_read_dcb(DCB *dcb);
int handle_event_errors(DCB *dcb, int event);
int handle_event_errors_backend(DCB *dcb, int event);
int handle_event_errors(DCB *dcb);
int handle_event_errors_backend(DCB *dcb);
void MySQLListener(int epfd, char *config_bind);
int MySQLAccept(DCB *listener, int efd);
int MySQLAccept(DCB *listener);
int gw_mysql_do_authentication(DCB *dcb, GWBUF *);
void gw_mysql_close(MySQLProtocol **ptr);
char *gw_strend(register const char *s);
@ -62,5 +62,5 @@ int do_read_dcb(DCB *dcb);
int do_read_10(DCB *dcb, uint8_t *buffer);
MySQLProtocol * gw_mysql_init(MySQLProtocol *ptr);
int MySQLWrite(DCB *dcb, GWBUF *queue);
int gw_write_backend_event(DCB *dcb, int epfd);
int gw_read_backend_event(DCB *dcb, int epfd);
int gw_write_backend_event(DCB *dcb);
int gw_read_backend_event(DCB *dcb);

40
include/poll.h Normal file
View File

@ -0,0 +1,40 @@
#ifndef _POLL_H
#define _POLL_H
/*
* This file is distributed as part of the SkySQL Gateway. It is free
* software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation,
* version 2.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2013
*/
#include <dcb.h>
/**
* @file poll.h The poll related functionality
*
* @verbatim
* Revision History
*
* Date Who Description
* 19/06/13 Mark Riddoch Initial implementation
*
* @endverbatim
*/
#define MAX_EVENTS 1000
extern void poll_init();
extern int poll_add_dcb(DCB *);
extern int poll_remove_dcb(DCB *);
extern void poll();
extern void dprintPollStats(DCB *);
#endif

View File

@ -95,7 +95,7 @@ extern SERVICE *service_alloc(char *, char *);
extern int service_free(SERVICE *);
extern int serviceAddProtocol(SERVICE *, char *, unsigned short);
extern void serviceAddBackend(SERVICE *, SERVER *);
extern int serviceStart(SERVICE *, int);
extern int serviceStart(SERVICE *);
extern void printService(SERVICE *);
extern void printAllServices();
extern void dprintAllServices(DCB *);