1191 {
1192         zfd_mode_t *mode = (zfd_mode_t *)modearg;
1193         int gzctlfd = -1;
1194         int gzoutfd = -1;
1195         int stdinfd = -1;
1196         int stdoutfd = -1;
1197         sigset_t blockset;
1198         int gzerrfd = -1;
1199         int stderrfd = -1;
1200         int flags;
1201         int len;
1202         char ibuf[BUFSIZ + 1];
1203 
1204         if (!shutting_down && mode->zmode_gzlogging)
1205                 open_logfile();
1206 
1207         /*
1208          * This thread should receive SIGHUP so that it can close the log
1209          * file, and reopen it, during log rotation.
1210          */
1211         sigset(SIGHUP, hup_handler);
1212         (void) sigfillset(&blockset);
1213         (void) sigdelset(&blockset, SIGHUP);
1214         (void) thr_sigsetmask(SIG_BLOCK, &blockset, NULL);
1215 
1216         if (!shutting_down) {
1217                 if (pipe(eventstream) != 0) {
1218                         zerror(zlogp, B_TRUE, "failed to open logger control "
1219                             "pipe");
1220                         return;
1221                 }
1222         }
1223 
1224         while (!shutting_down) {
1225                 if (init_server_sock(zlogp, &gzctlfd, "ctl") == -1) {
1226                         zerror(zlogp, B_FALSE,
1227                             "server setup: control socket init failed");
1228                         goto death;
1229                 }
1230                 if (init_server_sock(zlogp, &gzoutfd, "out") == -1) {
1231                         zerror(zlogp, B_FALSE,
 
1367                                 mode->zmode_n_stddevs = 3;
1368                                 mode->zmode_n_addl_devs = 0;
1369                         }
1370 
1371                 } else if (strcmp(LOG_MAXSZ, attr.zone_attr_name) == 0) {
1372                         char *p;
1373                         long lval;
1374 
1375                         p = attr.zone_attr_value;
1376                         lval = strtol(p, &p, 10);
1377                         if (*p == '\0')
1378                                 log_rot_sz = (size_t)lval;
1379                 }
1380         }
1381         (void) zonecfg_endattrent(handle);
1382 
1383 done:
1384         zonecfg_fini_handle(handle);
1385 }
1386 
1387 void
1388 create_log_thread(zlog_t *logp, zoneid_t id)
1389 {
1390         int res;
1391 
1392         shutting_down = 0;
1393         zlogp = logp;
1394 
1395         get_mode_logmax(&mode);
1396         if (mode.zmode_n_stddevs == 0)
1397                 return;
1398 
1399         if (init_zfd_devs(zlogp, &mode) == -1) {
1400                 zerror(zlogp, B_FALSE,
1401                     "zfd setup: device initialization failed");
1402                 return;
1403         }
1404 
1405         res = thr_create(NULL, 0, (void * (*)(void *))srvr, (void *)&mode, 0,
1406             &logger_tid);
 
 | 
 
 
1191 {
1192         zfd_mode_t *mode = (zfd_mode_t *)modearg;
1193         int gzctlfd = -1;
1194         int gzoutfd = -1;
1195         int stdinfd = -1;
1196         int stdoutfd = -1;
1197         sigset_t blockset;
1198         int gzerrfd = -1;
1199         int stderrfd = -1;
1200         int flags;
1201         int len;
1202         char ibuf[BUFSIZ + 1];
1203 
1204         if (!shutting_down && mode->zmode_gzlogging)
1205                 open_logfile();
1206 
1207         /*
1208          * This thread should receive SIGHUP so that it can close the log
1209          * file, and reopen it, during log rotation.
1210          */
1211         (void) sigset(SIGHUP, hup_handler);
1212         (void) sigfillset(&blockset);
1213         (void) sigdelset(&blockset, SIGHUP);
1214         (void) thr_sigsetmask(SIG_BLOCK, &blockset, NULL);
1215 
1216         if (!shutting_down) {
1217                 if (pipe(eventstream) != 0) {
1218                         zerror(zlogp, B_TRUE, "failed to open logger control "
1219                             "pipe");
1220                         return;
1221                 }
1222         }
1223 
1224         while (!shutting_down) {
1225                 if (init_server_sock(zlogp, &gzctlfd, "ctl") == -1) {
1226                         zerror(zlogp, B_FALSE,
1227                             "server setup: control socket init failed");
1228                         goto death;
1229                 }
1230                 if (init_server_sock(zlogp, &gzoutfd, "out") == -1) {
1231                         zerror(zlogp, B_FALSE,
 
1367                                 mode->zmode_n_stddevs = 3;
1368                                 mode->zmode_n_addl_devs = 0;
1369                         }
1370 
1371                 } else if (strcmp(LOG_MAXSZ, attr.zone_attr_name) == 0) {
1372                         char *p;
1373                         long lval;
1374 
1375                         p = attr.zone_attr_value;
1376                         lval = strtol(p, &p, 10);
1377                         if (*p == '\0')
1378                                 log_rot_sz = (size_t)lval;
1379                 }
1380         }
1381         (void) zonecfg_endattrent(handle);
1382 
1383 done:
1384         zonecfg_fini_handle(handle);
1385 }
1386 
1387 /* ARGSUSED -- "id" might be used in the future. */
1388 void
1389 create_log_thread(zlog_t *logp, zoneid_t id)
1390 {
1391         int res;
1392 
1393         shutting_down = 0;
1394         zlogp = logp;
1395 
1396         get_mode_logmax(&mode);
1397         if (mode.zmode_n_stddevs == 0)
1398                 return;
1399 
1400         if (init_zfd_devs(zlogp, &mode) == -1) {
1401                 zerror(zlogp, B_FALSE,
1402                     "zfd setup: device initialization failed");
1403                 return;
1404         }
1405 
1406         res = thr_create(NULL, 0, (void * (*)(void *))srvr, (void *)&mode, 0,
1407             &logger_tid);
 
 |