~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to sql/mysqld.cc

Resolving conflicts for a few files regarding FALSE=>false

Show diffs side-by-side

added added

removed removed

Lines of Context:
528
528
#ifdef EXTRA_DEBUG
529
529
  int count=0;
530
530
#endif
531
 
  DBUG_ENTER("close_connections");
532
531
 
533
532
  /* Clear thread cache */
534
533
  kill_cached_threads++;
538
537
  (void) pthread_mutex_lock(&LOCK_manager);
539
538
  if (manager_thread_in_use)
540
539
  {
541
 
    DBUG_PRINT("quit", ("killing manager thread: 0x%lx",
542
 
                        (ulong)manager_thread));
543
540
   (void) pthread_cond_signal(&COND_manager);
544
541
  }
545
542
  (void) pthread_mutex_unlock(&LOCK_manager);
546
543
 
547
544
  /* kill connection thread */
548
 
  DBUG_PRINT("quit", ("waiting for select thread: 0x%lx",
549
 
                      (ulong) select_thread));
550
545
  (void) pthread_mutex_lock(&LOCK_thread_count);
551
546
 
552
547
  while (select_thread_in_use)
553
548
  {
554
549
    struct timespec abstime;
555
550
    int error;
556
 
    DBUG_PRINT("info",("Waiting for select thread"));
557
551
 
558
552
#ifndef DONT_USE_THR_ALARM
559
553
    if (pthread_kill(select_thread, thr_client_alarm))
577
571
 
578
572
 
579
573
  /* Abort listening to new connections */
580
 
  DBUG_PRINT("quit",("Closing sockets"));
581
574
  if (!opt_disable_networking )
582
575
  {
583
576
    if (ip_sock != INVALID_SOCKET)
601
594
  I_List_iterator<THD> it(threads);
602
595
  while ((tmp=it++))
603
596
  {
604
 
    DBUG_PRINT("quit",("Informing thread %ld that it's time to die",
605
 
                       tmp->thread_id));
606
597
    /* We skip slave threads & scheduler on this first loop through. */
607
598
    if (tmp->slave_thread)
608
599
      continue;
637
628
 
638
629
  for (;;)
639
630
  {
640
 
    DBUG_PRINT("quit",("Locking LOCK_thread_count"));
641
631
    (void) pthread_mutex_lock(&LOCK_thread_count); // For unlink from list
642
632
    if (!(tmp=threads.get()))
643
633
    {
644
 
      DBUG_PRINT("quit",("Unlocking LOCK_thread_count"));
645
634
      (void) pthread_mutex_unlock(&LOCK_thread_count);
646
635
      break;
647
636
    }
654
643
                           tmp->main_security_ctx.user : ""));
655
644
      close_connection(tmp,0,0);
656
645
    }
657
 
    DBUG_PRINT("quit",("Unlocking LOCK_thread_count"));
658
646
    (void) pthread_mutex_unlock(&LOCK_thread_count);
659
647
  }
660
648
  /* All threads has now been aborted */
661
 
  DBUG_PRINT("quit",("Waiting for threads to die (count=%u)",thread_count));
662
649
  (void) pthread_mutex_lock(&LOCK_thread_count);
663
650
  while (thread_count)
664
651
  {
665
652
    (void) pthread_cond_wait(&COND_thread_count,&LOCK_thread_count);
666
 
    DBUG_PRINT("quit",("One thread died (count=%u)",thread_count));
667
653
  }
668
654
  (void) pthread_mutex_unlock(&LOCK_thread_count);
669
655
 
670
 
  DBUG_PRINT("quit",("close_connections thread"));
671
 
  DBUG_VOID_RETURN;
 
656
  return;;
672
657
}
673
658
 
674
659
 
675
660
static void close_server_sock()
676
661
{
677
662
#ifdef HAVE_CLOSE_SERVER_SOCK
678
 
  DBUG_ENTER("close_server_sock");
679
663
  my_socket tmp_sock;
680
664
  tmp_sock=ip_sock;
681
665
  if (tmp_sock != INVALID_SOCKET)
682
666
  {
683
667
    ip_sock=INVALID_SOCKET;
684
 
    DBUG_PRINT("info",("calling shutdown on TCP/IP socket"));
685
668
    VOID(shutdown(tmp_sock, SHUT_RDWR));
686
669
  }
687
 
  DBUG_VOID_RETURN;
 
670
  return;;
688
671
#endif
689
672
}
690
673
 
691
674
 
692
675
void kill_mysql(void)
693
676
{
694
 
  DBUG_ENTER("kill_mysql");
695
677
 
696
678
#if defined(SIGNALS_DONT_BREAK_READ)
697
679
  abort_loop=1;                                 // Break connection loops
699
681
#endif
700
682
 
701
683
#if defined(HAVE_PTHREAD_KILL)
702
 
  if (pthread_kill(signal_thread, MYSQL_KILL_SIGNAL))
703
 
  {
704
 
    DBUG_PRINT("error",("Got error %d from pthread_kill",errno)); /* purecov: inspected */
705
 
  }
 
684
  pthread_kill(signal_thread, MYSQL_KILL_SIGNAL);
706
685
#elif !defined(SIGNALS_DONT_BREAK_READ)
707
686
  kill(current_pid, MYSQL_KILL_SIGNAL);
708
687
#endif
709
 
  DBUG_PRINT("quit",("After pthread_kill"));
710
688
  shutdown_in_progress=1;                       // Safety if kill didn't work
711
689
#ifdef SIGNALS_DONT_BREAK_READ
712
690
  if (!kill_in_progress)
718
696
      sql_print_error("Can't create thread to kill server");
719
697
  }
720
698
#endif
721
 
  DBUG_VOID_RETURN;
 
699
  return;;
722
700
}
723
701
 
724
702
/**
733
711
*/
734
712
 
735
713
static void *kill_server(void *sig_ptr)
736
 
#define RETURN_FROM_KILL_SERVER DBUG_RETURN(0)
 
714
#define RETURN_FROM_KILL_SERVER return(0)
737
715
{
738
 
  DBUG_ENTER("kill_server");
739
716
  int sig=(int) (long) sig_ptr;                 // This is passed a int
740
717
  // if there is a signal during the kill in progress, ignore the other
741
718
  if (kill_in_progress)                         // Safety
815
792
 
816
793
extern "C" void unireg_abort(int exit_code)
817
794
{
818
 
  DBUG_ENTER("unireg_abort");
819
795
 
820
796
  if (exit_code)
821
797
    sql_print_error("Aborting\n");
822
798
  else if (opt_help)
823
799
    usage();
824
800
  clean_up(!opt_help && (exit_code || !opt_bootstrap)); /* purecov: inspected */
825
 
  DBUG_PRINT("quit",("done with cleanup in unireg_abort"));
826
801
  mysqld_exit(exit_code);
827
802
}
828
803
 
838
813
 
839
814
void clean_up(bool print_message)
840
815
{
841
 
  DBUG_PRINT("exit",("clean_up"));
842
816
  if (cleanup_done++)
843
817
    return; /* purecov: inspected */
844
818
 
903
877
  finish_client_errs();
904
878
  my_free((uchar*) my_error_unregister(ER_ERROR_FIRST, ER_ERROR_LAST),
905
879
          MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR));
906
 
  DBUG_PRINT("quit", ("Error messages freed"));
907
880
  /* Tell main we are ready */
908
881
  logger.cleanup_end();
909
882
  (void) pthread_mutex_lock(&LOCK_thread_count);
910
 
  DBUG_PRINT("quit", ("got thread count lock"));
911
883
  ready_to_exit=1;
912
884
  /* do the broadcast inside the lock to ensure that my_end() is not called */
913
885
  (void) pthread_cond_broadcast(&COND_thread_count);
917
889
    The following lines may never be executed as the main thread may have
918
890
    killed us
919
891
  */
920
 
  DBUG_PRINT("quit", ("done with cleanup"));
921
892
} /* clean_up */
922
893
 
923
894
 
1070
1041
static void set_user(const char *user, struct passwd *user_info_arg)
1071
1042
{
1072
1043
  /* purecov: begin tested */
1073
 
  DBUG_ASSERT(user_info_arg != 0);
 
1044
  assert(user_info_arg != 0);
1074
1045
#ifdef HAVE_INITGROUPS
1075
1046
  /*
1076
1047
    We can get a SIGSEGV when calling initgroups() on some systems when NSS
1098
1069
 
1099
1070
static void set_effective_user(struct passwd *user_info_arg)
1100
1071
{
1101
 
  DBUG_ASSERT(user_info_arg != 0);
 
1072
  assert(user_info_arg != 0);
1102
1073
  if (setregid((gid_t)-1, user_info_arg->pw_gid) == -1)
1103
1074
  {
1104
1075
    sql_perror("setregid");
1132
1103
  uint  this_wait;
1133
1104
  uint  retry;
1134
1105
  char port_buf[NI_MAXSERV];
1135
 
  DBUG_ENTER("network_init");
1136
1106
 
1137
1107
  if (thread_scheduler.init())
1138
1108
    unireg_abort(1);                    /* purecov: inspected */
1144
1114
    struct addrinfo *ai;
1145
1115
    struct addrinfo hints;
1146
1116
    int error;
1147
 
    DBUG_PRINT("general",("IP Socket is %d",mysqld_port));
1148
1117
 
1149
1118
    bzero(&hints, sizeof (hints));
1150
1119
    hints.ai_flags= AI_PASSIVE;
1155
1124
    error= getaddrinfo(my_bind_addr_str, port_buf, &hints, &ai);
1156
1125
    if (error != 0)
1157
1126
    {
1158
 
      DBUG_PRINT("error",("Got error: %d from getaddrinfo()", error));
1159
1127
      sql_perror(ER(ER_IPSOCK_ERROR));          /* purecov: tested */
1160
1128
      unireg_abort(1);                          /* purecov: tested */
1161
1129
    }
1166
1134
 
1167
1135
    if (ip_sock == INVALID_SOCKET)
1168
1136
    {
1169
 
      DBUG_PRINT("error",("Got error: %d from socket()",socket_errno));
1170
1137
      sql_perror(ER(ER_IPSOCK_ERROR));          /* purecov: tested */
1171
1138
      unireg_abort(1);                          /* purecov: tested */
1172
1139
    }
1212
1179
    freeaddrinfo(ai);
1213
1180
    if (ret < 0)
1214
1181
    {
1215
 
      DBUG_PRINT("error",("Got error: %d from bind",socket_errno));
1216
1182
      sql_perror("Can't start server: Bind on TCP/IP port");
1217
1183
      sql_print_error("Do you already have another mysqld server running on port: %d ?",mysqld_port);
1218
1184
      unireg_abort(1);
1226
1192
    }
1227
1193
  }
1228
1194
 
1229
 
  DBUG_PRINT("info",("server started"));
1230
 
  DBUG_VOID_RETURN;
 
1195
  return;;
1231
1196
}
1232
1197
 
1233
1198
/**
1243
1208
void close_connection(THD *thd, uint errcode, bool lock)
1244
1209
{
1245
1210
  st_vio *vio;
1246
 
  DBUG_ENTER("close_connection");
1247
 
  DBUG_PRINT("enter",("fd: %s  error: '%s'",
1248
 
                      thd->net.vio ? vio_description(thd->net.vio) :
1249
 
                      "(not connected)",
1250
 
                      errcode ? ER(errcode) : ""));
1251
1211
  if (lock)
1252
1212
    (void) pthread_mutex_lock(&LOCK_thread_count);
1253
1213
  thd->killed= THD::KILL_CONNECTION;
1259
1219
  }
1260
1220
  if (lock)
1261
1221
    (void) pthread_mutex_unlock(&LOCK_thread_count);
1262
 
  DBUG_VOID_RETURN;
 
1222
  return;;
1263
1223
}
1264
1224
 
1265
1225
 
1268
1228
extern "C" sig_handler end_thread_signal(int sig __attribute__((unused)))
1269
1229
{
1270
1230
  THD *thd=current_thd;
1271
 
  DBUG_ENTER("end_thread_signal");
1272
1231
  if (thd && ! thd->bootstrap)
1273
1232
  {
1274
1233
    statistic_increment(killed_threads, &LOCK_status);
1275
1234
    thread_scheduler.end_thread(thd,0);         /* purecov: inspected */
1276
1235
  }
1277
 
  DBUG_VOID_RETURN;                             /* purecov: deadcode */
 
1236
  return;;                              /* purecov: deadcode */
1278
1237
}
1279
1238
 
1280
1239
 
1291
1250
 
1292
1251
void unlink_thd(THD *thd)
1293
1252
{
1294
 
  DBUG_ENTER("unlink_thd");
1295
 
  DBUG_PRINT("enter", ("thd: 0x%lx", (long) thd));
1296
1253
  thd->cleanup();
1297
1254
 
1298
1255
  pthread_mutex_lock(&LOCK_connection_count);
1302
1259
  (void) pthread_mutex_lock(&LOCK_thread_count);
1303
1260
  thread_count--;
1304
1261
  delete thd;
1305
 
  DBUG_VOID_RETURN;
 
1262
  return;;
1306
1263
}
1307
1264
 
1308
1265
 
1329
1286
      ! abort_loop && !kill_cached_threads)
1330
1287
  {
1331
1288
    /* Don't kill the thread, just put it in cache for reuse */
1332
 
    DBUG_PRINT("info", ("Adding thread to cache"));
1333
1289
    cached_thread_count++;
1334
1290
    while (!abort_loop && ! wake_thread && ! kill_cached_threads)
1335
1291
      (void) pthread_cond_wait(&COND_thread_cache, &LOCK_thread_count);
1379
1335
 
1380
1336
bool one_thread_per_connection_end(THD *thd, bool put_in_cache)
1381
1337
{
1382
 
  DBUG_ENTER("one_thread_per_connection_end");
1383
1338
  unlink_thd(thd);
1384
1339
  if (put_in_cache)
1385
1340
    put_in_cache= cache_thread();
1386
1341
  pthread_mutex_unlock(&LOCK_thread_count);
1387
1342
  if (put_in_cache)
1388
 
    DBUG_RETURN(0);                             // Thread is reused
 
1343
    return(0);                             // Thread is reused
1389
1344
 
1390
1345
  /* It's safe to broadcast outside a lock (COND... is not deleted here) */
1391
 
  DBUG_PRINT("signal", ("Broadcasting COND_thread_count"));
1392
1346
  my_thread_end();
1393
1347
  (void) pthread_cond_broadcast(&COND_thread_count);
1394
1348
 
1395
1349
  pthread_exit(0);
1396
 
  DBUG_RETURN(0);                               // Impossible
 
1350
  return(0);                               // Impossible
1397
1351
}
1398
1352
 
1399
1353
 
1421
1375
extern "C" sig_handler abort_thread(int sig __attribute__((unused)))
1422
1376
{
1423
1377
  THD *thd=current_thd;
1424
 
  DBUG_ENTER("abort_thread");
1425
1378
  if (thd)
1426
1379
    thd->killed= THD::KILL_CONNECTION;
1427
 
  DBUG_VOID_RETURN;
 
1380
  return;;
1428
1381
}
1429
1382
#endif
1430
1383
 
1584
1537
{
1585
1538
  sigset_t set;
1586
1539
  struct sigaction sa;
1587
 
  DBUG_ENTER("init_signals");
1588
1540
 
1589
1541
  my_sigset(THR_SERVER_ALARM,print_signal_warning); // Should never be called!
1590
1542
 
1647
1599
    sigaddset(&set,SIGINT);
1648
1600
  sigprocmask(SIG_SETMASK,&set,NULL);
1649
1601
  pthread_sigmask(SIG_SETMASK,&set,NULL);
1650
 
  DBUG_VOID_RETURN;
 
1602
  return;;
1651
1603
}
1652
1604
 
1653
1605
 
1655
1607
{
1656
1608
  int error;
1657
1609
  pthread_attr_t thr_attr;
1658
 
  DBUG_ENTER("start_signal_handler");
1659
1610
 
1660
1611
  (void) pthread_attr_init(&thr_attr);
1661
1612
  pthread_attr_setscope(&thr_attr, PTHREAD_SCOPE_SYSTEM);
1688
1639
  pthread_mutex_unlock(&LOCK_thread_count);
1689
1640
 
1690
1641
  (void) pthread_attr_destroy(&thr_attr);
1691
 
  DBUG_VOID_RETURN;
 
1642
  return;;
1692
1643
}
1693
1644
 
1694
1645
 
1699
1650
  sigset_t set;
1700
1651
  int sig;
1701
1652
  my_thread_init();                             // Init new thread
1702
 
  DBUG_ENTER("signal_hand");
1703
1653
  signal_thread_in_use= 1;
1704
1654
 
1705
1655
  /*
1761
1711
      while ((error=my_sigwait(&set,&sig)) == EINTR) ;
1762
1712
    if (cleanup_done)
1763
1713
    {
1764
 
      DBUG_PRINT("quit",("signal_handler: calling my_thread_end()"));
1765
1714
      my_thread_end();
1766
1715
      signal_thread_in_use= 0;
1767
1716
      pthread_exit(0);                          // Safety
1776
1725
      /* switch to the old log message processing */
1777
1726
      logger.set_handlers(LOG_FILE, opt_slow_log ? LOG_FILE:LOG_NONE,
1778
1727
                          opt_log ? LOG_FILE:LOG_NONE);
1779
 
      DBUG_PRINT("info",("Got signal: %d  abort_loop: %d",sig,abort_loop));
1780
1728
      if (!abort_loop)
1781
1729
      {
1782
1730
        abort_loop=1;                           // mark abort for threads
1854
1802
void my_message_sql(uint error, const char *str, myf MyFlags)
1855
1803
{
1856
1804
  THD *thd;
1857
 
  DBUG_ENTER("my_message_sql");
1858
 
  DBUG_PRINT("error", ("error: %u  message: '%s'", error, str));
1859
1805
  /*
1860
1806
    Put here following assertion when situation with EE_* error codes
1861
1807
    will be fixed
1862
 
    DBUG_ASSERT(error != 0);
1863
1808
  */
1864
1809
  if ((thd= current_thd))
1865
1810
  {
1881
1826
    */
1882
1827
    if (thd->handle_error(error, str,
1883
1828
                          MYSQL_ERROR::WARN_LEVEL_ERROR))
1884
 
      DBUG_VOID_RETURN;
 
1829
      return;;
1885
1830
 
1886
1831
    thd->is_slave_error=  1; // needed to catch query errors during replication
1887
1832
 
1890
1835
      (not query command (COM_QUERY))
1891
1836
    */
1892
1837
    if (thd->lex->current_select &&
1893
 
        thd->lex->current_select->no_error && !thd->is_fatal_error)
 
1838
        thd->lex->current_select->no_error && !thd->is_fatal_error)
1894
1839
    {
1895
 
      DBUG_PRINT("error",
1896
 
                 ("Error converted to warning: current_select: no_error %d  "
1897
 
                  "fatal_error: %d",
1898
 
                  (thd->lex->current_select ?
1899
 
                   thd->lex->current_select->no_error : 0),
1900
 
                  (int) thd->is_fatal_error));
 
1840
      /* DBUG_WAS_HERE */
1901
1841
    }
1902
1842
    else
1903
1843
    {
1924
1864
  }
1925
1865
  if (!thd || MyFlags & ME_NOREFRESH)
1926
1866
    sql_print_error("%s: %s",my_progname,str); /* purecov: inspected */
1927
 
  DBUG_VOID_RETURN;
 
1867
  return;;
1928
1868
}
1929
1869
 
1930
1870
 
2160
2100
  get_options(&defaults_argc, defaults_argv);
2161
2101
  set_server_version();
2162
2102
 
2163
 
  DBUG_PRINT("info",("%s  Ver %s for %s on %s\n",my_progname,
2164
 
                     server_version, SYSTEM_TYPE,MACHINE_TYPE));
2165
2103
 
2166
2104
  /* connections and databases needs lots of files */
2167
2105
  {
2202
2140
        table_cache_size= (ulong) min(max((files-10-max_connections)/2,
2203
2141
                                          TABLE_OPEN_CACHE_MIN),
2204
2142
                                      table_cache_size);
2205
 
        DBUG_PRINT("warning",
2206
 
                   ("Changed limits: max_open_files: %u  max_connections: %ld  table_cache: %ld",
2207
 
                    files, max_connections, table_cache_size));
2208
2143
        if (global_system_variables.log_warnings)
2209
2144
          sql_print_warning("Changed limits: max_open_files: %u  max_connections: %ld  table_cache: %ld",
2210
2145
                        files, max_connections, table_cache_size);
2339
2274
    insensitive names.  If this is not done the users MyISAM tables will
2340
2275
    get corrupted if accesses with names of different case.
2341
2276
  */
2342
 
  DBUG_PRINT("info", ("lower_case_table_names: %d", lower_case_table_names));
2343
2277
  lower_case_file_system= test_if_case_insensitive(mysql_real_data_home);
2344
2278
  if (!lower_case_table_names && lower_case_file_system == 1)
2345
2279
  {
2441
2375
 
2442
2376
static int init_server_components()
2443
2377
{
2444
 
  DBUG_ENTER("init_server_components");
2445
2378
  /*
2446
2379
    We need to call each of these following functions to ensure that
2447
2380
    all things are initialized so that unireg_abort() doesn't fail
2559
2492
      global_system_variables.binlog_format= BINLOG_FORMAT_MIXED;
2560
2493
    else
2561
2494
    { 
2562
 
      DBUG_ASSERT(global_system_variables.binlog_format != BINLOG_FORMAT_UNSPEC);
2563
 
  }
 
2495
      assert(global_system_variables.binlog_format != BINLOG_FORMAT_UNSPEC);
 
2496
    }
2564
2497
 
2565
2498
  /* Check that we have not let the format to unspecified at this point */
2566
 
  DBUG_ASSERT((uint)global_system_variables.binlog_format <=
 
2499
  assert((uint)global_system_variables.binlog_format <=
2567
2500
              array_elements(binlog_format_names)-1);
2568
2501
 
2569
2502
  if (opt_log_slave_updates && replicate_same_server_id)
2617
2550
 
2618
2551
  /* Allow storage engine to give real error messages */
2619
2552
  if (ha_init_errors())
2620
 
    DBUG_RETURN(1);
 
2553
    return(1);
2621
2554
 
2622
2555
  if (plugin_init(&defaults_argc, defaults_argv,
2623
2556
                  (opt_noacl ? PLUGIN_INIT_SKIP_PLUGIN_TABLE : 0) |
2700
2633
                        default_storage_engine_str);
2701
2634
        unireg_abort(1);
2702
2635
      }
2703
 
      DBUG_ASSERT(global_system_variables.table_plugin);
 
2636
      assert(global_system_variables.table_plugin);
2704
2637
    }
2705
2638
    else
2706
2639
    {
2765
2698
    locked_in_memory=0;
2766
2699
 
2767
2700
  init_update_queries();
2768
 
  DBUG_RETURN(0);
 
2701
  return(0);
2769
2702
}
2770
2703
 
2771
2704
 
2939
2872
 
2940
2873
  /* (void) pthread_attr_destroy(&connection_attrib); */
2941
2874
  
2942
 
  DBUG_PRINT("quit",("Exiting main thread"));
2943
2875
 
2944
2876
#ifdef EXTRA_DEBUG2
2945
2877
  sql_print_error("Before Lock_thread_count");
2946
2878
#endif
2947
2879
  (void) pthread_mutex_lock(&LOCK_thread_count);
2948
 
  DBUG_PRINT("quit", ("Got thread_count mutex"));
2949
2880
  select_thread_in_use=0;                       // For close_connections
2950
2881
  (void) pthread_mutex_unlock(&LOCK_thread_count);
2951
2882
  (void) pthread_cond_broadcast(&COND_thread_count);
2971
2902
 
2972
2903
static void bootstrap(FILE *file)
2973
2904
{
2974
 
  DBUG_ENTER("bootstrap");
 
2905
  
2975
2906
 
2976
2907
  THD *thd= new THD;
2977
2908
  thd->bootstrap=1;
2986
2917
  {
2987
2918
    sql_print_warning("Can't create thread to handle bootstrap");
2988
2919
    bootstrap_error=-1;
2989
 
    DBUG_VOID_RETURN;
 
2920
    return;;
2990
2921
  }
2991
2922
  /* Wait for thread to die */
2992
2923
  (void) pthread_mutex_lock(&LOCK_thread_count);
2993
2924
  while (thread_count)
2994
2925
  {
2995
2926
    (void) pthread_cond_wait(&COND_thread_count,&LOCK_thread_count);
2996
 
    DBUG_PRINT("quit",("One thread died (count=%u)",thread_count));
 
2927
    /* DBUG_WAS_HERE */
2997
2928
  }
2998
2929
  (void) pthread_mutex_unlock(&LOCK_thread_count);
2999
2930
 
3000
 
  DBUG_VOID_RETURN;
 
2931
  return;;
3001
2932
}
3002
2933
 
3003
2934
 
3004
2935
static bool read_init_file(char *file_name)
3005
2936
{
3006
2937
  FILE *file;
3007
 
  DBUG_ENTER("read_init_file");
3008
 
  DBUG_PRINT("enter",("name: %s",file_name));
 
2938
  
3009
2939
  if (!(file=my_fopen(file_name,O_RDONLY,MYF(MY_WME))))
3010
2940
    return(1);
3011
2941
  bootstrap(file);
3029
2959
 
3030
2960
static void create_new_thread(THD *thd)
3031
2961
{
3032
 
  DBUG_ENTER("create_new_thread");
3033
2962
 
3034
2963
  /*
3035
2964
    Don't allow too many connections. We roughly check here that we allow
3042
2971
  {
3043
2972
    pthread_mutex_unlock(&LOCK_connection_count);
3044
2973
 
3045
 
    DBUG_PRINT("error",("Too many connections"));
3046
2974
    close_connection(thd, ER_CON_COUNT_ERROR, 1);
3047
2975
    delete thd;
3048
 
    DBUG_VOID_RETURN;
 
2976
    return;;
3049
2977
  }
3050
2978
 
3051
2979
  ++connection_count;
3070
2998
 
3071
2999
  thread_scheduler.add_connection(thd);
3072
3000
 
3073
 
  DBUG_VOID_RETURN;
 
3001
  return;;
3074
3002
}
3075
3003
 
3076
3004
 
3111
3039
    ip_flags = fcntl(ip_sock, F_GETFL, 0);
3112
3040
#endif
3113
3041
  }
3114
 
  DBUG_PRINT("general",("Waiting for connections."));
3115
3042
  MAYBE_BROKEN_SYSCALL;
3116
3043
  while (!abort_loop)
3117
3044
  {
5312
5239
  const char *end,*i,*j;
5313
5240
  const char **array, *pos;
5314
5241
  ulong found,found_int,bit;
5315
 
  DBUG_ENTER("find_bit_type");
5316
 
  DBUG_PRINT("enter",("x: '%s'",x));
5317
5242
 
5318
5243
  found=0;
5319
5244
  found_end= 0;
5351
5276
skip: ;
5352
5277
    }
5353
5278
    if (found_count != 1)
5354
 
      DBUG_RETURN(~(ulong) 0);                          // No unique value
 
5279
      return(~(ulong) 0);                               // No unique value
5355
5280
    found|=found_int;
5356
5281
    pos=end+1;
5357
5282
  }
5358
5283
 
5359
 
  DBUG_PRINT("exit",("bit-field: %ld",(ulong) found));
5360
 
  DBUG_RETURN(found);
 
5284
  return(found);
5361
5285
} /* find_bit_type */
5362
5286
 
5363
5287
 
5380
5304
  File file;
5381
5305
  char buff[FN_REFLEN], buff2[FN_REFLEN];
5382
5306
  struct stat stat_info;
5383
 
  DBUG_ENTER("test_if_case_insensitive");
5384
5307
 
5385
5308
  fn_format(buff, glob_hostname, dir_name, ".lower-test",
5386
5309
            MY_UNPACK_FILENAME | MY_REPLACE_EXT | MY_REPLACE_DIR);
5390
5313
  if ((file= my_create(buff, 0666, O_RDWR, MYF(0))) < 0)
5391
5314
  {
5392
5315
    sql_print_warning("Can't create test file %s", buff);
5393
 
    DBUG_RETURN(-1);
 
5316
    return(-1);
5394
5317
  }
5395
5318
  my_close(file, MYF(0));
5396
5319
  if (!stat(buff2, &stat_info))
5397
5320
    result= 1;                                  // Can access file
5398
5321
  (void) my_delete(buff, MYF(MY_WME));
5399
 
  DBUG_PRINT("exit", ("result: %d", result));
5400
 
  DBUG_RETURN(result);
 
5322
  return(result);
5401
5323
}
5402
5324
 
5403
5325