Print this page


Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/zoneadmd/zcons.c
          +++ new/usr/src/cmd/zoneadmd/zcons.c
↓ open down ↓ 318 lines elided ↑ open up ↑
 319  319          di_fini(root);
 320  320          return (0);
 321  321  }
 322  322  
 323  323  /*
 324  324   * init_console_dev() drives the device-tree configuration of the zone
 325  325   * console device.  The general strategy is to use the libdevice (devctl)
 326  326   * interfaces to instantiate a new zone console node.  We do a lot of
 327  327   * sanity checking, and are careful to reuse a console if one exists.
 328  328   *
 329      - * Once the device is in the device tree, we kick devfsadm via di_devlink_init()
      329 + * Once the device is in the device tree, we kick devfsadm via di_init_devs()
 330  330   * to ensure that the appropriate symlinks (to the master and slave console
 331  331   * devices) are placed in /dev in the global zone.
 332  332   */
 333  333  static int
 334  334  init_console_dev(zlog_t *zlogp)
 335  335  {
 336  336          char conspath[MAXPATHLEN];
 337  337          devctl_hdl_t bus_hdl = NULL;
 338  338          devctl_hdl_t dev_hdl = NULL;
 339  339          devctl_ddef_t ddef_hdl = NULL;
↓ open down ↓ 73 lines elided ↑ open up ↑
 413  413           * which will cause the master to retain a reference to the slave.
 414  414           * This prevents ttymon from blowing through the slave's STREAMS anchor.
 415  415           *
 416  416           * In very rare cases the open returns ENOENT if devfs doesn't have
 417  417           * everything setup yet due to heavy zone startup load. Wait for
 418  418           * 1 sec. and retry a few times. Even if we can't setup the zone's
 419  419           * console, we still go ahead and boot the zone.
 420  420           */
 421  421          (void) snprintf(conspath, sizeof (conspath), "/dev/zcons/%s/%s",
 422  422              zone_name, ZCONS_MASTER_NAME);
 423      -        for (i = 0; i < ZCONS_RETRY; i++) {
 424      -                masterfd = open(conspath, O_RDWR | O_NOCTTY);
 425      -                if (masterfd >= 0 || errno != ENOENT)
 426      -                        break;
 427      -                (void) sleep(1);
 428      -        }
 429      -        if (masterfd == -1) {
      423 +        if ((masterfd = open(conspath, O_RDWR | O_NOCTTY)) == -1) {
 430  424                  zerror(zlogp, B_TRUE, "ERROR: could not open master side of "
 431  425                      "zone console for %s to acquire slave handle", zone_name);
 432  426                  master_zcons_failed = B_TRUE;
 433  427          }
 434      -
 435  428          (void) snprintf(conspath, sizeof (conspath), "/dev/zcons/%s/%s",
 436  429              zone_name, ZCONS_SLAVE_NAME);
 437  430          for (i = 0; i < ZCONS_RETRY; i++) {
 438  431                  slavefd = open(conspath, O_RDWR | O_NOCTTY);
 439  432                  if (slavefd >= 0 || errno != ENOENT)
 440  433                          break;
 441  434                  (void) sleep(1);
 442  435          }
 443  436          if (slavefd == -1)
 444  437                  zerror(zlogp, B_TRUE, "ERROR: could not open slave side of zone"
↓ open down ↓ 605 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX