~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/drizzled.cc

  • Committer: Brian Aker
  • Date: 2009-11-13 18:25:26 UTC
  • mfrom: (971.7.11 eday-dev)
  • Revision ID: brian@gaz-20091113182526-evaib6rmmndruddq
MergeĀ Eric

Show diffs side-by-side

added added

removed removed

Lines of Context:
253
253
static bool calling_initgroups= false; /**< Used in SIGSEGV handler. */
254
254
#endif
255
255
 
256
 
/*
257
 
  This needs to be a uint32_t and not a in_port_t because the config system
258
 
  requires a 4-byte integer.
259
 
*/
260
 
uint32_t drizzled_tcp_port;
261
256
uint32_t drizzled_bind_timeout;
262
257
std::bitset<12> test_flags;
263
258
uint32_t dropping_tables, ha_open_options;
605
600
}
606
601
 
607
602
 
608
 
/**
609
 
 * Setup default port value from (in order or precedence):
610
 
 * - Command line option
611
 
 * - DRIZZLE_TCP_PORT environment variable
612
 
 * - Compile options
613
 
 * - Lookup in /etc/services
614
 
 * - Default value
615
 
 */
616
 
static void set_default_port()
617
 
{
618
 
  struct servent *serv_ptr;
619
 
  char *env;
620
 
 
621
 
  if (drizzled_tcp_port == 0)
622
 
  {
623
 
    drizzled_tcp_port= DRIZZLE_TCP_PORT;
624
 
 
625
 
    if (DRIZZLE_TCP_PORT_DEFAULT == 0)
626
 
    {
627
 
      if ((serv_ptr= getservbyname("drizzle", "tcp")))
628
 
        drizzled_tcp_port= ntohs((u_short) serv_ptr->s_port);
629
 
    }
630
 
 
631
 
    if ((env = getenv("DRIZZLE_TCP_PORT")))
632
 
      drizzled_tcp_port= (uint32_t) atoi(env);
633
 
 
634
 
    assert(drizzled_tcp_port != 0);
635
 
  }
636
 
}
637
 
 
638
603
/* Change to run as another user if started with --user */
639
604
 
640
605
static struct passwd *check_user(const char *user)
1633
1598
  if (init_server_components(plugins))
1634
1599
    unireg_abort(1);
1635
1600
 
1636
 
  set_default_port();
1637
 
 
1638
1601
  if (plugin::Listen::setup())
1639
1602
    unireg_abort(1);
1640
1603
 
1861
1824
   N_("Pid file used by safe_mysqld."),
1862
1825
   (char**) &pidfile_name_ptr, (char**) &pidfile_name_ptr, 0, GET_STR,
1863
1826
   REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1864
 
  {"port", 'P',
1865
 
   N_("Port number to use for connection or 0 for default to, in "
1866
 
      "order of preference, drizzle.cnf, $DRIZZLE_TCP_PORT, "
1867
 
      "built-in default (" STRINGIFY_ARG(DRIZZLE_TCP_PORT) ")."),
1868
 
   (char**) &drizzled_tcp_port,
1869
 
   (char**) &drizzled_tcp_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1870
1827
  {"port-open-timeout", OPT_PORT_OPEN_TIMEOUT,
1871
1828
   N_("Maximum time in seconds to wait for the port to become free. "
1872
1829
      "(Default: no wait)"),