]> git.pld-linux.org Git - packages/mysql.git/blob - mysql-bugfix48929.patch
remove id expansion
[packages/mysql.git] / mysql-bugfix48929.patch
1 # name       : bugfix48929.patch
2 # introduced : 11 or before
3 # maintainer : Oleg
4 #
5 #!!! notice !!!
6 # Any small change to this file in the main branch
7 # should be done or reviewed by the maintainer!
8 --- a/configure.in
9 +++ b/configure.in
10 @@ -815,7 +815,7 @@
11  AC_HEADER_STDC
12  AC_HEADER_SYS_WAIT
13  AC_CHECK_HEADERS(fcntl.h fenv.h float.h floatingpoint.h fpu_control.h \
14 - ieeefp.h limits.h memory.h pwd.h select.h \
15 + ieeefp.h limits.h memory.h pwd.h select.h poll.h \
16   stdlib.h stddef.h \
17   strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h \
18   sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \
19 --- a/sql/mysqld.cc
20 +++ b/sql/mysqld.cc
21 @@ -56,6 +56,10 @@
22  #include "sp_rcontext.h"
23  #include "sp_cache.h"
24  
25 +#ifdef HAVE_POLL_H
26 +#include <poll.h>
27 +#endif
28 +
29  #define mysqld_charset &my_charset_latin1
30  
31  #ifdef HAVE_purify
32 @@ -5137,31 +5141,58 @@
33  #ifndef EMBEDDED_LIBRARY
34  pthread_handler_t handle_connections_sockets(void *arg __attribute__((unused)))
35  {
36 -  my_socket sock,new_sock;
37 +  my_socket UNINIT_VAR(sock),new_sock;
38    uint error_count=0;
39 -  uint max_used_connection= (uint) (max(ip_sock,unix_sock)+1);
40 -  fd_set readFDs,clientFDs;
41    THD *thd;
42    struct sockaddr_in cAddr;
43 -  int ip_flags=0,socket_flags=0,flags;
44 +#if !defined(HAVE_POLL)
45 +  int ip_flags= 0;
46 +#endif
47 +#if defined(HAVE_SYS_UN_H) && !defined(HAVE_POLL)
48 +  int socket_flags= 0;
49 +#endif
50 +  int UNINIT_VAR(flags),retval;
51    st_vio *vio_tmp;
52 +#ifdef HAVE_POLL
53 +  int socket_count= 0;
54 +  struct pollfd fds[2]; // for ip_sock and unix_sock
55 +#else
56 +  fd_set readFDs,clientFDs;
57 +  uint max_used_connection= (uint) (max(ip_sock,unix_sock)+1);
58 +#endif
59 +
60    DBUG_ENTER("handle_connections_sockets");
61  
62    LINT_INIT(new_sock);
63  
64    (void) my_pthread_getprio(pthread_self());           // For debugging
65  
66 +#ifndef HAVE_POLL
67    FD_ZERO(&clientFDs);
68 +#endif
69 +
70    if (ip_sock != INVALID_SOCKET)
71    {
72 +#ifdef HAVE_POLL
73 +    fds[socket_count].fd= ip_sock;
74 +    fds[socket_count].events= POLLIN;
75 +    socket_count++;
76 +#else
77      FD_SET(ip_sock,&clientFDs);
78 -#ifdef HAVE_FCNTL
79 +#endif
80 +#if !defined (HAVE_POLL) && defined(HAVE_FCNTL)
81      ip_flags = fcntl(ip_sock, F_GETFL, 0);
82  #endif
83    }
84  #ifdef HAVE_SYS_UN_H
85 +#ifdef HAVE_POLL
86 +  fds[socket_count].fd= unix_sock;
87 +  fds[socket_count].events= POLLIN;
88 +  socket_count++;
89 +#else
90    FD_SET(unix_sock,&clientFDs);
91 -#ifdef HAVE_FCNTL
92 +#endif
93 +#if defined(HAVE_FCNTL) && defined(HAVE_SYS_UN_H) && !defined(HAVE_POLL)
94    socket_flags=fcntl(unix_sock, F_GETFL, 0);
95  #endif
96  #endif
97 @@ -5170,12 +5201,15 @@
98    MAYBE_BROKEN_SYSCALL;
99    while (!abort_loop)
100    {
101 -    readFDs=clientFDs;
102 -#ifdef HPUX10
103 -    if (select(max_used_connection,(int*) &readFDs,0,0,0) < 0)
104 -      continue;
105 +#ifdef HAVE_POLL
106 +    retval= poll(fds, socket_count, -1);
107  #else
108 -    if (select((int) max_used_connection,&readFDs,0,0,0) < 0)
109 +    readFDs=clientFDs;
110 +
111 +    retval= select((int) max_used_connection,&readFDs,0,0,0);
112 +#endif
113 +
114 +    if (retval < 0)
115      {
116        if (socket_errno != SOCKET_EINTR)
117        {
118 @@ -5185,7 +5219,7 @@
119        MAYBE_BROKEN_SYSCALL
120        continue;
121      }
122 -#endif /* HPUX10 */
123 +
124      if (abort_loop)
125      {
126        MAYBE_BROKEN_SYSCALL;
127 @@ -5193,6 +5227,21 @@
128      }
129  
130      /* Is this a new connection request ? */
131 +#ifdef HAVE_POLL
132 +    for (int i= 0; i < socket_count; ++i) 
133 +    {
134 +      if (fds[i].revents & POLLIN)
135 +      {
136 +        sock= fds[i].fd;
137 +#ifdef HAVE_FCNTL
138 +        flags= fcntl(sock, F_GETFL, 0);
139 +#else
140 +        flags= 0;
141 +#endif // HAVE_FCNTL
142 +        break;
143 +      }
144 +    }
145 +#else  // HAVE_POLL
146  #ifdef HAVE_SYS_UN_H
147      if (FD_ISSET(unix_sock,&readFDs))
148      {
149 @@ -5200,11 +5249,12 @@
150        flags= socket_flags;
151      }
152      else
153 -#endif
154 +#endif // HAVE_SYS_UN_H
155      {
156        sock = ip_sock;
157        flags= ip_flags;
158      }
159 +#endif // HAVE_POOL
160  
161  #if !defined(NO_FCNTL_NONBLOCK)
162      if (!(test_flags & TEST_BLOCKING))
This page took 0.042784 seconds and 3 git commands to generate.