1246 cmd_argv[i++] = "update_all";
1247 if (do_fast_reboot)
1248 cmd_argv[i++] = "fastboot";
1249 cmd_argv[i] = NULL;
1250
1251 r = posix_spawn(&pid, cmd_argv[0], NULL, NULL, cmd_argv, NULL);
1252
1253 /* if posix_spawn fails we emit a warning and continue */
1254
1255 if (r != 0)
1256 (void) fprintf(stderr, gettext("%s: WARNING, unable to start "
1257 "boot archive update\n"), cmdname);
1258 else
1259 while (waitpid(pid, NULL, 0) == -1 && errno == EINTR)
1260 ;
1261 }
1262
1263 int
1264 main(int argc, char *argv[])
1265 {
1266 char *ttyn = ttyname(STDERR_FILENO);
1267
1268 int qflag = 0, needlog = 1, nosync = 0;
1269 int fast_reboot = 0;
1270 int prom_reboot = 0;
1271 uintptr_t mdep = NULL;
1272 int cmd, fcn, c, aval, r;
1273 const char *usage;
1274 const char *optstring;
1275 zoneid_t zoneid = getzoneid();
1276 int need_check_zones = 0;
1277 char bootargs_buf[BOOTARGS_MAX];
1278 char *bootargs_orig = NULL;
1279 char *bename = NULL;
1280
1281 const char * const resetting = "/etc/svc/volatile/resetting";
1282
1283 (void) setlocale(LC_ALL, "");
1284 (void) textdomain(TEXT_DOMAIN);
1285
1286 cmdname = basename(argv[0]);
1287
1319 case 'd':
1320 if (zoneid == GLOBAL_ZONEID)
1321 cmd = A_DUMP;
1322 else {
1323 (void) fprintf(stderr,
1324 gettext("%s: -d only valid from global"
1325 " zone\n"), cmdname);
1326 return (1);
1327 }
1328 break;
1329 case 'l':
1330 needlog = 0;
1331 break;
1332 case 'n':
1333 nosync = 1;
1334 break;
1335 case 'q':
1336 qflag = 1;
1337 break;
1338 case 'y':
1339 ttyn = NULL;
1340 break;
1341 case 'f':
1342 fast_reboot = 1;
1343 break;
1344 case 'p':
1345 prom_reboot = 1;
1346 break;
1347 #if defined(__i386)
1348 case 'e':
1349 bename = optarg;
1350 break;
1351 #endif
1352 default:
1353 /*
1354 * TRANSLATION_NOTE
1355 * Don't translate the words "halt" or "reboot"
1356 */
1357 (void) fprintf(stderr, usage, cmdname);
1358 return (1);
1359 }
1443 return (rc);
1444 else if (rc == EINVAL)
1445 goto fail;
1446 else if (rc != 0)
1447 fast_reboot = 0;
1448
1449 /*
1450 * For all the other errors, we continue on in case user
1451 * user want to force fast reboot, or fall back to regular
1452 * reboot.
1453 */
1454 if (strlen(bootargs_buf) != 0)
1455 mdep = (uintptr_t)bootargs_buf;
1456 }
1457
1458 #if 0 /* For debugging */
1459 if (mdep != NULL)
1460 (void) fprintf(stderr, "mdep = %s\n", (char *)mdep);
1461 #endif
1462
1463 if (fcn != AD_BOOT && ttyn != NULL &&
1464 strncmp(ttyn, "/dev/term/", strlen("/dev/term/")) == 0) {
1465 /*
1466 * TRANSLATION_NOTE
1467 * Don't translate ``halt -y''
1468 */
1469 (void) fprintf(stderr,
1470 gettext("%s: dangerous on a dialup;"), cmdname);
1471 (void) fprintf(stderr,
1472 gettext("use ``%s -y'' if you are really sure\n"), cmdname);
1473 goto fail;
1474 }
1475
1476 if (needlog) {
1477 char *user = getlogin();
1478 struct passwd *pw;
1479 char *tty;
1480
1481 openlog(cmdname, 0, LOG_AUTH);
1482 if (user == NULL && (pw = getpwuid(getuid())) != NULL)
1483 user = pw->pw_name;
1484 if (user == NULL)
1485 user = "root";
1486
1487 tty = ttyname(1);
1488
1489 if (tty == NULL)
1490 syslog(LOG_CRIT, "initiated by %s", user);
1491 else
1492 syslog(LOG_CRIT, "initiated by %s on %s", user, tty);
1493 }
1494
1495 /*
|
1246 cmd_argv[i++] = "update_all";
1247 if (do_fast_reboot)
1248 cmd_argv[i++] = "fastboot";
1249 cmd_argv[i] = NULL;
1250
1251 r = posix_spawn(&pid, cmd_argv[0], NULL, NULL, cmd_argv, NULL);
1252
1253 /* if posix_spawn fails we emit a warning and continue */
1254
1255 if (r != 0)
1256 (void) fprintf(stderr, gettext("%s: WARNING, unable to start "
1257 "boot archive update\n"), cmdname);
1258 else
1259 while (waitpid(pid, NULL, 0) == -1 && errno == EINTR)
1260 ;
1261 }
1262
1263 int
1264 main(int argc, char *argv[])
1265 {
1266 int qflag = 0, needlog = 1, nosync = 0;
1267 int fast_reboot = 0;
1268 int prom_reboot = 0;
1269 uintptr_t mdep = NULL;
1270 int cmd, fcn, c, aval, r;
1271 const char *usage;
1272 const char *optstring;
1273 zoneid_t zoneid = getzoneid();
1274 int need_check_zones = 0;
1275 char bootargs_buf[BOOTARGS_MAX];
1276 char *bootargs_orig = NULL;
1277 char *bename = NULL;
1278
1279 const char * const resetting = "/etc/svc/volatile/resetting";
1280
1281 (void) setlocale(LC_ALL, "");
1282 (void) textdomain(TEXT_DOMAIN);
1283
1284 cmdname = basename(argv[0]);
1285
1317 case 'd':
1318 if (zoneid == GLOBAL_ZONEID)
1319 cmd = A_DUMP;
1320 else {
1321 (void) fprintf(stderr,
1322 gettext("%s: -d only valid from global"
1323 " zone\n"), cmdname);
1324 return (1);
1325 }
1326 break;
1327 case 'l':
1328 needlog = 0;
1329 break;
1330 case 'n':
1331 nosync = 1;
1332 break;
1333 case 'q':
1334 qflag = 1;
1335 break;
1336 case 'y':
1337 /*
1338 * Option ignored for backwards compatibility.
1339 */
1340 break;
1341 case 'f':
1342 fast_reboot = 1;
1343 break;
1344 case 'p':
1345 prom_reboot = 1;
1346 break;
1347 #if defined(__i386)
1348 case 'e':
1349 bename = optarg;
1350 break;
1351 #endif
1352 default:
1353 /*
1354 * TRANSLATION_NOTE
1355 * Don't translate the words "halt" or "reboot"
1356 */
1357 (void) fprintf(stderr, usage, cmdname);
1358 return (1);
1359 }
1443 return (rc);
1444 else if (rc == EINVAL)
1445 goto fail;
1446 else if (rc != 0)
1447 fast_reboot = 0;
1448
1449 /*
1450 * For all the other errors, we continue on in case user
1451 * user want to force fast reboot, or fall back to regular
1452 * reboot.
1453 */
1454 if (strlen(bootargs_buf) != 0)
1455 mdep = (uintptr_t)bootargs_buf;
1456 }
1457
1458 #if 0 /* For debugging */
1459 if (mdep != NULL)
1460 (void) fprintf(stderr, "mdep = %s\n", (char *)mdep);
1461 #endif
1462
1463 if (needlog) {
1464 char *user = getlogin();
1465 struct passwd *pw;
1466 char *tty;
1467
1468 openlog(cmdname, 0, LOG_AUTH);
1469 if (user == NULL && (pw = getpwuid(getuid())) != NULL)
1470 user = pw->pw_name;
1471 if (user == NULL)
1472 user = "root";
1473
1474 tty = ttyname(1);
1475
1476 if (tty == NULL)
1477 syslog(LOG_CRIT, "initiated by %s", user);
1478 else
1479 syslog(LOG_CRIT, "initiated by %s on %s", user, tty);
1480 }
1481
1482 /*
|