|
Lines 1-6
Link Here
|
| 1 |
--- sql/mysqld.cc.orig Tue Dec 14 13:40:36 2004 |
1 |
--- sql/mysqld.cc.orig Wed May 24 22:59:52 2006 |
| 2 |
+++ sql/mysqld.cc Mon Jan 10 00:28:52 2005 |
2 |
+++ sql/mysqld.cc Thu Jul 27 02:18:31 2006 |
| 3 |
@@ -128,7 +128,7 @@ |
3 |
@@ -133,7 +133,7 @@ |
| 4 |
#endif /* __WIN__ */ |
4 |
#endif /* __WIN__ */ |
| 5 |
|
5 |
|
| 6 |
#ifdef HAVE_LIBWRAP |
6 |
#ifdef HAVE_LIBWRAP |
|
Lines 9-11
Link Here
|
| 9 |
#include <syslog.h> |
9 |
#include <syslog.h> |
| 10 |
#ifdef NEED_SYS_SYSLOG_H |
10 |
#ifdef NEED_SYS_SYSLOG_H |
| 11 |
#include <sys/syslog.h> |
11 |
#include <sys/syslog.h> |
|
|
12 |
@@ -151,6 +151,10 @@ |
| 13 |
#define zVOLSTATE_DEACTIVE 2 |
| 14 |
#define zVOLSTATE_MAINTENANCE 3 |
| 15 |
|
| 16 |
+#ifdef WITH_KQUEUE |
| 17 |
+#include <sys/event.h> |
| 18 |
+#endif |
| 19 |
+ |
| 20 |
#ifdef __NETWARE__ |
| 21 |
#include <nks/netware.h> |
| 22 |
#include <nks/vm.h> |
| 23 |
@@ -556,6 +560,10 @@ |
| 24 |
static unsigned long openssl_id_function(); |
| 25 |
#endif /* HAVE_OPENSSL */ |
| 26 |
|
| 27 |
+#ifdef WITH_KQUEUE |
| 28 |
+int kq; |
| 29 |
+struct kevent kev; |
| 30 |
+#endif |
| 31 |
|
| 32 |
/* Function declarations */ |
| 33 |
|
| 34 |
@@ -3664,16 +3672,38 @@ |
| 35 |
|
| 36 |
(void) my_pthread_getprio(pthread_self()); // For debugging |
| 37 |
|
| 38 |
- FD_ZERO(&clientFDs); |
| 39 |
+#ifdef WITH_KQUEUE |
| 40 |
+ if ((kq = kqueue()) <0) { |
| 41 |
+ sql_print_error("mysqld: Could not get kqueue"); |
| 42 |
+ } |
| 43 |
+#else |
| 44 |
+ FD_ZERO(&clientFDs); |
| 45 |
+#endif |
| 46 |
+ |
| 47 |
if (ip_sock != INVALID_SOCKET) |
| 48 |
{ |
| 49 |
- FD_SET(ip_sock,&clientFDs); |
| 50 |
+#ifdef WITH_KQUEUE |
| 51 |
+ EV_SET(&kev, ip_sock, EVFILT_READ, EV_ADD, 0, 0, NULL); |
| 52 |
+ if ((kevent(kq, &kev, 1, NULL, 0, NULL)) <0) |
| 53 |
+ sql_print_error("mysqld: ip_sock kevent registration error"); |
| 54 |
+#else |
| 55 |
+ FD_SET(ip_sock,&clientFDs); |
| 56 |
+#endif |
| 57 |
+ |
| 58 |
#ifdef HAVE_FCNTL |
| 59 |
ip_flags = fcntl(ip_sock, F_GETFL, 0); |
| 60 |
#endif |
| 61 |
} |
| 62 |
#ifdef HAVE_SYS_UN_H |
| 63 |
+#ifdef WITH_KQUEUE |
| 64 |
+ EV_SET(&kev, unix_sock, EVFILT_READ, EV_ADD, 0, 0, NULL); |
| 65 |
+ if ((kevent(kq, &kev, 1, NULL, 0, NULL)) <0) { |
| 66 |
+ sql_print_error("mysqld: unix_sock kevent registration error"); |
| 67 |
+ } |
| 68 |
+#else |
| 69 |
FD_SET(unix_sock,&clientFDs); |
| 70 |
+#endif /* WITH_KQUEUE */ |
| 71 |
+ |
| 72 |
#ifdef HAVE_FCNTL |
| 73 |
socket_flags=fcntl(unix_sock, F_GETFL, 0); |
| 74 |
#endif |
| 75 |
@@ -3688,7 +3718,11 @@ |
| 76 |
if (select(max_used_connection,(int*) &readFDs,0,0,0) < 0) |
| 77 |
continue; |
| 78 |
#else |
| 79 |
+#ifdef WITH_KQUEUE |
| 80 |
+ if (kevent(kq, NULL, 0, &kev, 1, 0) < 0) |
| 81 |
+#else |
| 82 |
if (select((int) max_used_connection,&readFDs,0,0,0) < 0) |
| 83 |
+#endif |
| 84 |
{ |
| 85 |
if (socket_errno != SOCKET_EINTR) |
| 86 |
{ |
| 87 |
@@ -3707,7 +3741,11 @@ |
| 88 |
|
| 89 |
/* Is this a new connection request ? */ |
| 90 |
#ifdef HAVE_SYS_UN_H |
| 91 |
+#ifdef WITH_KQUEUE |
| 92 |
+ if (kev.ident == unix_sock) |
| 93 |
+#else |
| 94 |
if (FD_ISSET(unix_sock,&readFDs)) |
| 95 |
+#endif /* WITH_KQUEUE */ |
| 96 |
{ |
| 97 |
sock = unix_sock; |
| 98 |
flags= socket_flags; |