[Netadm-devel] gwc/gwcklogd gwcklogd.c,1.2,1.3
Status: Beta
Brought to you by:
linuxpark
|
From: linuxpark <lin...@us...> - 2006-05-08 17:58:42
|
Update of /cvsroot/netadm/gwc/gwcklogd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5943 Modified Files: gwcklogd.c Log Message: MOD: some other function which was used to run with syslogd through "/dev/log" was moved to the routine of "RUNWITH_SYSLOGD" defined code. Index: gwcklogd.c =================================================================== RCS file: /cvsroot/netadm/gwc/gwcklogd/gwcklogd.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gwcklogd.c 6 May 2006 17:33:33 -0000 1.2 --- gwcklogd.c 6 May 2006 17:49:48 -0000 1.3 *************** *** 39,45 **** static int kmsg; static int change_state = 0; - static int terminate = 0; static int caught_TSTP = 0; #ifdef RUNWITH_SYSLOGD /* i dont need to run with syslogd --LP (linuxpark, Jeho Park )*/ static char log_buffer[LOG_BUFFER_SIZE]; #endif --- 39,45 ---- static int kmsg; static int change_state = 0; static int caught_TSTP = 0; #ifdef RUNWITH_SYSLOGD /* i dont need to run with syslogd --LP (linuxpark, Jeho Park )*/ + static int terminate = 0; static char log_buffer[LOG_BUFFER_SIZE]; #endif *************** *** 52,58 **** static void closelogsrc(void); static void signaldaemon(int); - static void changelog(void); - static enum src get_klog_src(void); #ifdef RUNWITH_SYSLOGD static void logline(char *ptr, int len); #endif --- 52,58 ---- static void closelogsrc(void); static void signaldaemon(int); #ifdef RUNWITH_SYSLOGD + static enum src get_klog_src(void); + static void changelog(void); static void logline(char *ptr, int len); #endif *************** *** 347,350 **** --- 347,351 ---- } + #ifdef RUNWITH_SYSLOGD static void changelog(void) { *************** *** 374,378 **** } - static enum src get_klog_src(void) { int i; --- 375,378 ---- *************** *** 394,397 **** --- 394,398 ---- return (proc); } + #endif *************** *** 618,621 **** --- 619,635 ---- } #endif + + void dump_klogcmdtab () { + #ifdef DEBUG + for (i = 0; i < MAXSYSIDX; i++) { + out ("idx: %d, fd: %d, logfd: %d, devname: %s, log_file: %s\n", + klogcmdtab[i].idx, + klogcmdtab[i].fd, + klogcmdtab[i].log_fd, + klogcmdtab[i].devname, + klogcmdtab[i].log_file); + } + #endif + } int main( int argc, char ** argv) { *************** *** 681,689 **** /* This is the child closing its file descriptors. */ for (fl= 2; fl <= num_fds; ++fl) { - #if 0 - if ( fileno(stdout) == fl && use_output ) - if ( strcmp(output, "stdout") == 0 ) - continue; - #endif close(fl); } --- 695,698 ---- *************** *** 722,736 **** signal(SIGCONT, restart); - out ("1.\n"); - /* Open outputs. */ - #if 0 - if ( strcmp(output, "-") == 0 ) { - output_file = stdout; - } else if ( (output_file = fopen(output, "w")) == (FILE *) 0 ) { - out ("klogd: Cannot open output file %s - %s\n", output, strerror(errno)); - return 1; - } - #endif - out ("2.\n"); /* Determine where kernel logging information is to come from. */ for (i = 0; i < MAXSYSIDX; i++) { --- 731,734 ---- *************** *** 753,766 **** } } ! ! for (i = 0; i < MAXSYSIDX; i++) { ! out ("idx: %d, fd: %d, logfd: %d, devname: %s, log_file: %s\n", ! klogcmdtab[i].idx, ! klogcmdtab[i].fd, ! klogcmdtab[i].log_fd, ! klogcmdtab[i].devname, ! klogcmdtab[i].log_file); ! } out ("gwcklogd: Starting ...\n"); /* The main loop. */ while (1) { --- 751,758 ---- } } ! ! dump_klogcmdtab (); out ("gwcklogd: Starting ...\n"); + /* The main loop. */ while (1) { *************** *** 773,782 **** FD_SET( klogcmdtab[i].fd, &sock_set); } ! #if 0 ! if ( change_state ) { ! out ("Changelog.\n"); ! changelog(); ! } ! #endif tv.tv_sec = GWC_KLOGD_TIMEOUT * 60L; tv.tv_usec = 0; --- 765,769 ---- FD_SET( klogcmdtab[i].fd, &sock_set); } ! tv.tv_sec = GWC_KLOGD_TIMEOUT * 60L; tv.tv_usec = 0; *************** *** 791,795 **** } else if (!ret) { - out ("Timeout: continue ...\n"); continue; --- 778,781 ---- *************** *** 797,806 **** } else { - out ("receive kernel log\n"); for (i = 0; i < MAXSYSIDX; i++) { if( FD_ISSET(klogcmdtab[i].fd, &sock_set) ) { - out ("find idx [%d]\n", i); ret = klogcmdtab[i].func (NULL); if (ret < 0 ) { --- 783,790 ---- *************** *** 812,817 **** klogcmdtab[i].log_file ); - } else { - out ("success to handling kernel log\n"); } break; --- 796,799 ---- |