Lines Matching refs:log_control

203 struct log_control {
211 static struct log_control log_control = {
468 for (lindex = 0; lindex < log_control.log_nentries; lindex++) {
469 switch (log_control.log_entries[lindex].log_type) {
472 klog_rotate(&log_control.log_entries[lindex]);
478 if (fprintf(log_control.log_entries[lindex].lfu_filep, "%s\n",
482 log_control.log_entries[lindex].lfu_fname);
485 fflush(log_control.log_entries[lindex].lfu_filep);
493 if (DEVICE_PRINT(log_control.log_entries[lindex].ldu_filep,
497 log_control.log_entries[lindex].ldu_devname);
510 log_pri |= log_control.log_entries[lindex].lsu_facility;
512 log_pri = log_control.log_entries[lindex].lsu_facility |
513 log_control.log_entries[lindex].lsu_severity;
543 * log_control - List of entries (log_nentries long) which contains
579 log_control.log_nentries = 0;
589 for (log_control.log_nentries = 0;
590 logging_specs[log_control.log_nentries];
591 log_control.log_nentries++);
596 log_control.log_entries = (struct log_entry *)
597 malloc(log_control.log_nentries * sizeof(struct log_entry));
598 if (log_control.log_entries) {
602 for (i=0; i<log_control.log_nentries; i++) {
603 log_control.log_entries[i].log_type = K_LOG_NONE;
604 log_control.log_entries[i].log_2free = logging_specs[i];
623 log_control.log_entries[i].lfu_fopen_mode =
627 log_control.log_entries[i].lfu_fopen_mode);
632 log_control.log_entries[i].lfu_filep = f;
633 log_control.log_entries[i].log_type = K_LOG_FILE;
634 log_control.log_entries[i].lfu_fname = &cp[5];
635 log_control.log_entries[i].lfu_rotate_period =
637 log_control.log_entries[i].lfu_rotate_versions =
639 log_control.log_entries[i].lfu_last_rotated =
665 log_control.log_entries[i].lfu_rotate_period =
677 log_control.log_entries[i].lfu_rotate_versions = vers;
694 log_control.log_entries[i].lsu_facility = LOG_AUTH;
695 log_control.log_entries[i].lsu_severity = LOG_ERR;
714 log_control.log_entries[i].lsu_severity = LOG_ERR;
718 log_control.log_entries[i].lsu_severity =
724 log_control.log_entries[i].lsu_severity =
730 log_control.log_entries[i].lsu_severity = LOG_CRIT;
735 log_control.log_entries[i].lsu_severity =
741 log_control.log_entries[i].lsu_severity =
747 log_control.log_entries[i].lsu_severity = LOG_INFO;
752 log_control.log_entries[i].lsu_severity =
764 log_control.log_entries[i].lsu_facility = LOG_AUTH;
767 log_control.log_entries[i].lsu_facility = LOG_KERN;
770 log_control.log_entries[i].lsu_facility = LOG_USER;
773 log_control.log_entries[i].lsu_facility = LOG_MAIL;
776 log_control.log_entries[i].lsu_facility = LOG_DAEMON;
779 log_control.log_entries[i].lsu_facility = LOG_LPR;
782 log_control.log_entries[i].lsu_facility = LOG_NEWS;
785 log_control.log_entries[i].lsu_facility = LOG_UUCP;
788 log_control.log_entries[i].lsu_facility = LOG_CRON;
791 log_control.log_entries[i].lsu_facility = LOG_LOCAL0;
794 log_control.log_entries[i].lsu_facility = LOG_LOCAL1;
797 log_control.log_entries[i].lsu_facility = LOG_LOCAL2;
800 log_control.log_entries[i].lsu_facility = LOG_LOCAL3;
803 log_control.log_entries[i].lsu_facility = LOG_LOCAL4;
806 log_control.log_entries[i].lsu_facility = LOG_LOCAL5;
809 log_control.log_entries[i].lsu_facility = LOG_LOCAL6;
812 log_control.log_entries[i].lsu_facility = LOG_LOCAL7;
819 log_control.log_entries[i].log_type = K_LOG_SYSLOG;
821 log_facility = log_control.log_entries[i].lsu_facility;
829 log_control.log_entries[i].lfu_filep =
831 if (log_control.log_entries[i].lfu_filep) {
832 log_control.log_entries[i].log_type = K_LOG_STDERR;
833 log_control.log_entries[i].lfu_fname =
841 log_control.log_entries[i].ldu_filep =
843 if (log_control.log_entries[i].ldu_filep) {
844 log_control.log_entries[i].log_type = K_LOG_CONSOLE;
845 log_control.log_entries[i].ldu_devname = "console";
856 log_control.log_entries[i].ldu_filep =
858 if (log_control.log_entries[i].ldu_filep) {
859 log_control.log_entries[i].log_type = K_LOG_DEVICE;
860 log_control.log_entries[i].ldu_devname = &cp[7];
867 if (log_control.log_entries[i].log_type == K_LOG_NONE) {
879 for (i=0; i<log_control.log_nentries; i++)
889 if (log_control.log_entries)
890 free(log_control.log_entries);
891 log_control.log_entries = &def_log_entry;
892 log_control.log_entries->log_type = K_LOG_SYSLOG;
893 log_control.log_entries->log_2free = (krb5_pointer) NULL;
894 log_facility = log_control.log_entries->lsu_facility = LOG_AUTH;
895 log_control.log_entries->lsu_severity = LOG_ERR;
897 log_control.log_nentries = 1;
899 if (log_control.log_nentries) {
900 log_control.log_whoami = (char *) malloc(strlen(whoami)+1);
901 if (log_control.log_whoami)
902 strcpy(log_control.log_whoami, whoami);
904 log_control.log_hostname = (char *) malloc(MAXHOSTNAMELEN + 1);
905 if (log_control.log_hostname) {
906 gethostname(log_control.log_hostname, MAXHOSTNAMELEN);
907 log_control.log_hostname[MAXHOSTNAMELEN] = '\0';
912 log_control.log_opened = 1;
918 return((log_control.log_nentries) ? 0 : ENOENT);
929 for (lindex = 0; lindex < log_control.log_nentries; lindex++) {
930 switch (log_control.log_entries[lindex].log_type) {
936 fclose(log_control.log_entries[lindex].lfu_filep);
943 DEVICE_CLOSE(log_control.log_entries[lindex].ldu_filep);
955 if (log_control.log_entries[lindex].log_2free)
956 free(log_control.log_entries[lindex].log_2free);
958 if (log_control.log_entries != &def_log_entry)
959 free(log_control.log_entries);
960 log_control.log_entries = (struct log_entry *) NULL;
961 log_control.log_nentries = 0;
962 if (log_control.log_whoami)
963 free(log_control.log_whoami);
964 log_control.log_whoami = (char *) NULL;
965 if (log_control.log_hostname)
966 free(log_control.log_hostname);
967 log_control.log_hostname = (char *) NULL;
969 if (log_control.log_opened)
1077 log_control.log_hostname, log_control.log_whoami, (long) getpid(),
1100 if (log_control.log_nentries == 0) {
1110 for (lindex = 0; lindex < log_control.log_nentries; lindex++) {
1111 switch (log_control.log_entries[lindex].log_type) {
1114 klog_rotate(&log_control.log_entries[lindex]);
1120 if (fprintf(log_control.log_entries[lindex].lfu_filep, "%s\n",
1124 log_control.log_whoami,
1125 log_control.log_entries[lindex].lfu_fname);
1128 fflush(log_control.log_entries[lindex].lfu_filep);
1136 if (DEVICE_PRINT(log_control.log_entries[lindex].ldu_filep,
1140 log_control.log_whoami,
1141 log_control.log_entries[lindex].ldu_devname);
1190 for (lindex = 0; lindex < log_control.log_nentries; lindex++) {
1191 if (log_control.log_entries[lindex].log_type == K_LOG_FILE) {
1192 fclose(log_control.log_entries[lindex].lfu_filep);
1197 f = fopen(log_control.log_entries[lindex].lfu_fname, "a+F");
1199 log_control.log_entries[lindex].lfu_filep = f;
1202 log_control.log_entries[lindex].lfu_fname,
1267 for (lindex = 0; lindex < log_control.log_nentries; lindex++) {
1268 if (lindex != 0 && log_control.log_entries[lindex].log_type != K_LOG_NONE)
1270 switch (log_control.log_entries[lindex].log_type) {
1272 fprintf(stderr, "FILE=%s", log_control.log_entries[lindex].lfu_fname);
1281 fprintf(stderr, "DEVICE=%s", log_control.log_entries[lindex].ldu_devname);
1285 severity2string(log_control.log_entries[lindex].lsu_severity),
1286 facility2string(log_control.log_entries[lindex].lsu_facility));
1304 struct log_entry *tmp_log_entries = log_control.log_entries;
1307 if (log_control.log_entries != &def_log_entry) {
1308 log_control.log_entries = realloc(log_control.log_entries,
1309 (log_control.log_nentries + 1) * sizeof(struct log_entry));
1310 if (log_control.log_entries == NULL) {
1311 log_control.log_entries = tmp_log_entries;
1315 log_control.log_entries = malloc(2 * sizeof(struct log_entry));
1316 if (log_control.log_entries == NULL) {
1317 log_control.log_entries = &def_log_entry;
1320 (void) memcpy(&log_control.log_entries[0], &def_log_entry,
1324 i = log_control.log_nentries;
1325 if (log_control.log_entries[i].lfu_filep =
1327 log_control.log_entries[i].log_type = K_LOG_STDERR;
1328 log_control.log_entries[i].log_2free = NULL;
1329 log_control.log_entries[i].lfu_fname = "standard error";
1330 log_control.log_nentries++;
1334 tmp_log_entries = log_control.log_entries;
1335 log_control.log_entries = realloc(log_control.log_entries,
1336 (log_control.log_nentries) * sizeof(struct log_entry));
1337 if (log_control.log_entries == NULL)
1338 log_control.log_entries = tmp_log_entries;
1351 struct log_entry *tmp_log_entries = log_control.log_entries;
1355 for (i = 0; i < log_control.log_nentries; i++) {
1356 if (log_control.log_entries[i].log_type == K_LOG_STDERR) {
1361 if ( i < log_control.log_nentries) {
1362 for (; i < log_control.log_nentries - 1; i++)
1363 log_control.log_entries[i] =
1364 log_control.log_entries[i + 1];
1366 if (log_control.log_nentries > 1) {
1367 log_control.log_entries =
1368 realloc(log_control.log_entries,
1369 (log_control.log_nentries + 1) *
1371 if (log_control.log_entries != NULL)
1372 log_control.log_nentries--;
1374 log_control.log_entries = tmp_log_entries;
1376 if (log_control.log_entries != NULL)
1377 free(log_control.log_entries);
1387 for (i = 0; i < log_control.log_nentries; i++) {
1388 if (log_control.log_entries[i].log_type == K_LOG_STDERR) {