Lines Matching refs:log_control
203 struct log_control {
211 static struct log_control log_control = {
467 for (lindex = 0; lindex < log_control.log_nentries; lindex++) {
468 switch (log_control.log_entries[lindex].log_type) {
471 klog_rotate(&log_control.log_entries[lindex]);
477 if (fprintf(log_control.log_entries[lindex].lfu_filep, "%s\n",
481 log_control.log_entries[lindex].lfu_fname);
484 fflush(log_control.log_entries[lindex].lfu_filep);
492 if (DEVICE_PRINT(log_control.log_entries[lindex].ldu_filep,
496 log_control.log_entries[lindex].ldu_devname);
509 log_pri |= log_control.log_entries[lindex].lsu_facility;
511 log_pri = log_control.log_entries[lindex].lsu_facility |
512 log_control.log_entries[lindex].lsu_severity;
542 * log_control - List of entries (log_nentries long) which contains
578 log_control.log_nentries = 0;
588 for (log_control.log_nentries = 0;
589 logging_specs[log_control.log_nentries];
590 log_control.log_nentries++);
595 log_control.log_entries = (struct log_entry *)
596 malloc(log_control.log_nentries * sizeof(struct log_entry));
597 if (log_control.log_entries) {
601 for (i=0; i<log_control.log_nentries; i++) {
602 log_control.log_entries[i].log_type = K_LOG_NONE;
603 log_control.log_entries[i].log_2free = logging_specs[i];
622 log_control.log_entries[i].lfu_fopen_mode =
626 log_control.log_entries[i].lfu_fopen_mode);
631 log_control.log_entries[i].lfu_filep = f;
632 log_control.log_entries[i].log_type = K_LOG_FILE;
633 log_control.log_entries[i].lfu_fname = &cp[5];
634 log_control.log_entries[i].lfu_rotate_period =
636 log_control.log_entries[i].lfu_rotate_versions =
638 log_control.log_entries[i].lfu_last_rotated =
664 log_control.log_entries[i].lfu_rotate_period =
676 log_control.log_entries[i].lfu_rotate_versions = vers;
693 log_control.log_entries[i].lsu_facility = LOG_AUTH;
694 log_control.log_entries[i].lsu_severity = LOG_ERR;
713 log_control.log_entries[i].lsu_severity = LOG_ERR;
717 log_control.log_entries[i].lsu_severity =
723 log_control.log_entries[i].lsu_severity =
729 log_control.log_entries[i].lsu_severity = LOG_CRIT;
734 log_control.log_entries[i].lsu_severity =
740 log_control.log_entries[i].lsu_severity =
746 log_control.log_entries[i].lsu_severity = LOG_INFO;
751 log_control.log_entries[i].lsu_severity =
763 log_control.log_entries[i].lsu_facility = LOG_AUTH;
766 log_control.log_entries[i].lsu_facility = LOG_KERN;
769 log_control.log_entries[i].lsu_facility = LOG_USER;
772 log_control.log_entries[i].lsu_facility = LOG_MAIL;
775 log_control.log_entries[i].lsu_facility = LOG_DAEMON;
778 log_control.log_entries[i].lsu_facility = LOG_LPR;
781 log_control.log_entries[i].lsu_facility = LOG_NEWS;
784 log_control.log_entries[i].lsu_facility = LOG_UUCP;
787 log_control.log_entries[i].lsu_facility = LOG_CRON;
790 log_control.log_entries[i].lsu_facility = LOG_AUDIT;
793 log_control.log_entries[i].lsu_facility = LOG_LOCAL0;
796 log_control.log_entries[i].lsu_facility = LOG_LOCAL1;
799 log_control.log_entries[i].lsu_facility = LOG_LOCAL2;
802 log_control.log_entries[i].lsu_facility = LOG_LOCAL3;
805 log_control.log_entries[i].lsu_facility = LOG_LOCAL4;
808 log_control.log_entries[i].lsu_facility = LOG_LOCAL5;
811 log_control.log_entries[i].lsu_facility = LOG_LOCAL6;
814 log_control.log_entries[i].lsu_facility = LOG_LOCAL7;
821 log_control.log_entries[i].log_type = K_LOG_SYSLOG;
823 log_facility = log_control.log_entries[i].lsu_facility;
831 log_control.log_entries[i].lfu_filep =
833 if (log_control.log_entries[i].lfu_filep) {
834 log_control.log_entries[i].log_type = K_LOG_STDERR;
835 log_control.log_entries[i].lfu_fname =
843 log_control.log_entries[i].ldu_filep =
845 if (log_control.log_entries[i].ldu_filep) {
846 log_control.log_entries[i].log_type = K_LOG_CONSOLE;
847 log_control.log_entries[i].ldu_devname = "console";
858 log_control.log_entries[i].ldu_filep =
860 if (log_control.log_entries[i].ldu_filep) {
861 log_control.log_entries[i].log_type = K_LOG_DEVICE;
862 log_control.log_entries[i].ldu_devname = &cp[7];
869 if (log_control.log_entries[i].log_type == K_LOG_NONE) {
881 for (i=0; i<log_control.log_nentries; i++)
891 if (log_control.log_entries)
892 free(log_control.log_entries);
893 log_control.log_entries = &def_log_entry;
894 log_control.log_entries->log_type = K_LOG_SYSLOG;
895 log_control.log_entries->log_2free = (krb5_pointer) NULL;
896 log_facility = log_control.log_entries->lsu_facility = LOG_AUTH;
897 log_control.log_entries->lsu_severity = LOG_ERR;
899 log_control.log_nentries = 1;
901 if (log_control.log_nentries) {
902 log_control.log_whoami = (char *) malloc(strlen(whoami)+1);
903 if (log_control.log_whoami)
904 strcpy(log_control.log_whoami, whoami);
906 log_control.log_hostname = (char *) malloc(MAXHOSTNAMELEN + 1);
907 if (log_control.log_hostname) {
908 gethostname(log_control.log_hostname, MAXHOSTNAMELEN);
909 log_control.log_hostname[MAXHOSTNAMELEN] = '\0';
914 log_control.log_opened = 1;
920 return((log_control.log_nentries) ? 0 : ENOENT);
931 for (lindex = 0; lindex < log_control.log_nentries; lindex++) {
932 switch (log_control.log_entries[lindex].log_type) {
938 fclose(log_control.log_entries[lindex].lfu_filep);
945 DEVICE_CLOSE(log_control.log_entries[lindex].ldu_filep);
957 if (log_control.log_entries[lindex].log_2free)
958 free(log_control.log_entries[lindex].log_2free);
960 if (log_control.log_entries != &def_log_entry)
961 free(log_control.log_entries);
962 log_control.log_entries = (struct log_entry *) NULL;
963 log_control.log_nentries = 0;
964 if (log_control.log_whoami)
965 free(log_control.log_whoami);
966 log_control.log_whoami = (char *) NULL;
967 if (log_control.log_hostname)
968 free(log_control.log_hostname);
969 log_control.log_hostname = (char *) NULL;
971 if (log_control.log_opened)
1079 log_control.log_hostname, log_control.log_whoami, (long) getpid(),
1102 if (log_control.log_nentries == 0) {
1112 for (lindex = 0; lindex < log_control.log_nentries; lindex++) {
1113 switch (log_control.log_entries[lindex].log_type) {
1116 klog_rotate(&log_control.log_entries[lindex]);
1122 if (fprintf(log_control.log_entries[lindex].lfu_filep, "%s\n",
1126 log_control.log_whoami,
1127 log_control.log_entries[lindex].lfu_fname);
1130 fflush(log_control.log_entries[lindex].lfu_filep);
1138 if (DEVICE_PRINT(log_control.log_entries[lindex].ldu_filep,
1142 log_control.log_whoami,
1143 log_control.log_entries[lindex].ldu_devname);