Changeset 75
- Timestamp:
- 06.10.2002 18:39:42 (6 years ago)
- Location:
- trunk
- Files:
-
- 12 modified
-
HISTORY (modified) (1 diff)
-
Makefile.common.in (modified) (3 diffs)
-
Makefile.in (modified) (2 diffs)
-
VERSION (modified) (1 diff)
-
doc/Makefile.in (modified) (1 diff)
-
doc/ipfm.man (modified) (5 diffs)
-
source/Makefile.in (modified) (1 diff)
-
source/config.l (modified) (3 diffs)
-
source/config.y (modified) (2 diffs)
-
source/init.c (modified) (8 diffs)
-
source/init.h (modified) (1 diff)
-
source/ipfm.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/HISTORY
r71 r75 2 2 ------------------ 3 3 - typos in ipfm.conf.sample (Fixes Debian Bug #146409) 4 - pid configurable through command line [RC, looking at Loic Tortay's patch for pid configurable through configfile] 5 - various minor fixes [LT, RC] 4 6 5 7 Version 0.11.5pre2 -
trunk/Makefile.common.in
r63 r75 1 1 # 2 2 # Common definitions for all the Makefile's 3 # Copyright (c) 1999 Robert CHERAMY <tibob@via.ecp.fr>3 # Copyright (c) 1999-2002 Robert CHERAMY <robert@cheramy.net> 4 4 # Copyright (c) 2001 Loïc Tortay & IN2P3 Computing Center <tortay@cc.in2p3.fr> 5 5 # … … 15 15 ETCDIR = $(ROOT)@sysconfdir@ 16 16 LOGDIR = $(ROOT)@localstatedir@/log 17 VARRUN = $(ROOT)@localstatedir@/run17 VARRUNDIR = $(ROOT)@localstatedir@/run 18 18 19 19 INSTALL = @INSTALL@ … … 26 26 CONFIGFILE=$(ETCDIR)/ipfm.conf 27 27 LOGFILE=$(LOGDIR)/ipfm/%d-%b.%H-%M 28 PIDFILE=$(VARRUN )/ipfm.pid28 PIDFILE=$(VARRUNDIR)/ipfm.pid 29 29 -
trunk/Makefile.in
r63 r75 1 1 # 2 2 # Makefile for ipfm 3 # Copyright (c) 1999 Robert CHERAMY <tibob@via.ecp.fr>3 # Copyright (c) 1999-2002 Robert CHERAMY <robert@cheramy.net> 4 4 # Copyright (c) 2001 Loïc Tortay & IN2P3 Computing Center <tortay@cc.in2p3.fr> 5 5 # … … 26 26 $(INSTALL) -m 444 doc/ipfm.8 $(MANDIR)/man8/ipfm.8 27 27 $(INSTALL) -d -m 755 $(LOGDIR)/ipfm 28 $(INSTALL) -d -m 755 $(VARRUNDIR) 28 29 29 30 clean: -
trunk/VERSION
r67 r75 1 0.11.5pre 21 0.11.5pre3 -
trunk/doc/Makefile.in
r28 r75 1 1 # 2 2 # Makefile for ipfm docs 3 # Copyright (c) 1999-2002 Robert CHERAMY <robert@cheramy.net> 3 4 # 4 5 5 6 include ../Makefile.common 6 7 7 SED_SCRIPT=-e "s§__CONFIGURATION_FILE§$(CONFIGURATION_FILE)§g" \ 8 -e "s§__LOGFILE§$(LOG_FILE)§g" 8 SED_SCRIPT=-e "s§__CONFIGURATION_FILE§$(CONFIGFILE)§g" \ 9 -e "s§__LOGFILE§$(LOGFILE)§g" \ 10 -e "s§__PIDFILE§$(PIDFILE)§g" 9 11 10 12 all: man -
trunk/doc/ipfm.man
r63 r75 1 1 .\" -*-nroff-*- 2 2 .\" 3 .\" Copyright (c) 1999-200 1Robert CHERAMY <robert@cheramy.net>3 .\" Copyright (c) 1999-2002 Robert CHERAMY <robert@cheramy.net> 4 4 .\" Copyright (c) 2001 Loïc Tortay & IN2P3 Computing Center <tortay@cc.in2p3.fr> 5 5 .\" … … 18 18 .\" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 19 .\" 20 .TH IPFM 8 "Last change: 11 november 2001"20 .TH IPFM 8 "Last change: 06 october 2002" 21 21 22 22 .SH NAME … … 29 29 ][\-\-config 30 30 .I config-file 31 ] [-h][--help] [-n][--nodaemon] 31 ] [-h][--help] [-n][--nodaemon] [\-p 32 .I pid-file 33 ][--pid 34 .I pid-file 35 ] 32 36 33 37 .SH DESCRIPTION … … 49 53 50 54 .SH OPTIONS 51 .IP "-c config-file, --config <file>"55 .IP "-c config-file, --config config-file" 52 56 .I config-file 53 57 specifies an alternate configuration file to use. By default, … … 58 62 .IP "-h, --help" 59 63 displays an help message on standard output and exit 64 .IP "-p pid-file, --pid pid-file" 65 .I pid-file 66 specifies an alternate pid file to use. By default, 67 .IR __PIDFILE 68 is used. 60 69 61 70 .SH SIGNALS -
trunk/source/Makefile.in
r63 r75 1 1 # 2 # Makefile for ipfm 2 # Makefile for ipfm sources 3 # Copyright (c) 1999-2002 Robert CHERAMY <robert@cheramy.net> 3 4 # 4 5 5 6 include ../Makefile.common 6 7 7 DEFINES = -D PIDFILE=\"$(PIDFILE)\" \8 DEFINES = -DDEFAULT_OPTIONS_PIDFILE=\"$(PIDFILE)\" \ 8 9 -DDEFAULT_OPTIONS_CONFIGFILE=\"$(CONFIGFILE)\" \ 9 10 -DDEFAULT_OPTIONS_LOGFILE=\"$(LOGFILE)\" -
trunk/source/config.l
r66 r75 3 3 config.l - functions parsing the configuration file 4 4 5 (c) 1999-200 0 Robert Cheramy <tibob@via.ecp.fr>5 (c) 1999-2002 Robert Cheramy <robert@cheramy.net> 6 6 (c) 2000 Samuel Hocevar <sam@via.ecp.fr> 7 7 … … 12 12 which helped me to understand Lex and Yacc 13 13 14 200010 xx: sam & tibob : various config options14 200010 : sam & tibob : various config options 15 15 */ 16 16 … … 118 118 119 119 [0-9A-Za-z]+ { 120 yylval.stringval = strdup(yytext);120 yylval.stringval = xstrdup(yytext); 121 121 return STRING; 122 122 } -
trunk/source/config.y
r66 r75 3 3 config.y - functions parsing the configuration file 4 4 5 (c) 1999-200 0 Robert Cheramy <tibob@via.ecp.fr>5 (c) 1999-2002 Robert Cheramy <robert@cheramy.net> 6 6 (c) 2000 Samuel Hocevar <sam@via.ecp.fr> 7 7 (c) 2001 Loïc Tortay & IN2P3 Computing Center <tortay@cc.in2p3.fr> … … 221 221 } 222 222 | Device EOL { 223 if (NULL != device) xfree(device); 223 224 device = $1; 224 225 } -
trunk/source/init.c
r66 r75 4 4 (c) 1999 Andres Krapf <dae@via.ecp.fr> 5 5 (c) 2000 Samuel Hocevar <sam@via.ecp.fr> 6 7 200010xx : sam : pid file & daemon mode handling 8 20001107 : tibob : SIGUSR1 handling 9 20001207 : tibob : modifications to have a correct SIGHUP behaviour. 6 (c) 2002 Robert Chéramy <robert@cheramy.net> 7 8 200010 : sam : pid file & daemon mode handling 9 200011 : tibob : SIGUSR1 handling 10 200012 : tibob : modifications to have a correct SIGHUP behaviour. 11 200210 : tibob : command-line configurable pid file. 12 10 13 */ 11 14 … … 72 75 #ifdef __OS_LINUX__ 73 76 printf("\t-n, --nodaemon:\tdo not run as a daemon\n"); 74 printf("\t-c , --config <file>:\tspecify an alternate configuration file\n");77 printf("\t-c <file>, --config <file>:\tspecify an alternate configuration file\n"); 75 78 printf("\t-h, --help:\tdisplay this help and exit\n"); 79 printf("\t-p <file>, --pid <file>:\tspecify an alternate pid file\n"); 76 80 #else 77 81 printf("\t-n:\tdo not run as a daemon\n"); 78 82 printf("\t-c <file>:\tspecify an alternate configuration file\n"); 79 83 printf("\t-h:\tdisplay this help and exit\n"); 84 printf("\t-p <file>:\tspecify an alternate pid file\n"); 80 85 #endif /* __OS_LINUX__ */ 81 86 printf("\nPlease report bugs to ipfm@via.ecp.fr\n"); … … 94 99 { "help", 0, NULL, 0 }, 95 100 { "nodaemon", 0, &run_as_daemon, 0 }, 101 { "pidfile", 1, NULL, 0 }, 96 102 { NULL, 0, NULL, 0 } 97 103 }; … … 99 105 100 106 Options.ConfigFile = NULL; 101 102 #ifdef __OS_LINUX__ 103 while (EOF != (ch = getopt_long(argc, argv, "hnc:", long_options, 107 Options.PidFile = NULL; 108 109 #ifdef __OS_LINUX__ 110 while (EOF != (ch = getopt_long(argc, argv, "hncp:", long_options, 104 111 &option_index))) { 105 112 #else 106 while (EOF != (ch = getopt(argc, argv, "hnc :"))) {113 while (EOF != (ch = getopt(argc, argv, "hncp:"))) { 107 114 #endif /* __OS_LINUX__ */ 108 115 switch(ch) { … … 110 117 case 0: 111 118 switch (option_index) { 112 case 0: 113 Options.ConfigFile = xstrdup(optarg); 114 break; 115 case 1: 116 print_help(); 117 exit(0); 118 break; 119 } 119 case 0: 120 Options.ConfigFile = xstrdup(optarg); 121 break; 122 case 1: 123 print_help(); 124 exit(0); 125 break; 126 case 2: 127 run_as_daemon = 0; 128 break; 129 case 3: 130 Options.PidFile = xstrdup(optarg); 131 break; 132 } 133 break; 120 134 #endif /* __OS_LINUX__ */ 121 135 case 'c': … … 125 139 run_as_daemon = 0; 126 140 break; 141 case 'p': 142 Options.PidFile = xstrdup(optarg); 143 break; 127 144 case 'h': 128 145 case '?': … … 143 160 if (NULL == Options.ConfigFile) { 144 161 Options.ConfigFile = xstrdup(DEFAULT_OPTIONS_CONFIGFILE); 162 } 163 if (NULL == Options.PidFile) { 164 Options.PidFile = xstrdup(DEFAULT_OPTIONS_PIDFILE); 145 165 } 146 166 } … … 234 254 235 255 if (run_as_daemon) { 236 remove_pid ( PIDFILE);256 remove_pid (Options.PidFile); 237 257 } 238 258 -
trunk/source/init.h
r63 r75 27 27 struct OptionsType { 28 28 char *ConfigFile; 29 char *PidFile; 29 30 }; 30 31 -
trunk/source/ipfm.c
r63 r75 5 5 ********************************************************************* 6 6 7 (c) 1999-200 0 Robert Cheramy <tibob@via.ecp.fr>7 (c) 1999-2002 Robert Cheramy <robert@cheramy.net> 8 8 (c) 2000 Samuel Hocevar <sam@via.ecp.fr> 9 9 (c) 1999 Andres Krapf <dae@via.ecp.fr> … … 14 14 ********************************************************************* 15 15 16 200010xx: sam & tibob : clear and dump options 17 sam : PID file & daemon mode handling 16 200010: sam & tibob : clear and dump options 17 sam : PID file & daemon mode handling 18 200210: tibob : configurable PID file 18 19 19 20 */ … … 55 56 #include "utils.h" 56 57 57 // struct passwd *runas;58 58 struct AllLogsType * pAllLogs = NULL; 59 59 extern int run_as_daemon; 60 extern struct OptionsType Options; 60 61 61 62 int main(int argc, char *argv[]) { … … 69 70 if (run_as_daemon) { 70 71 /* Check PID */ 71 if (check_pid( PIDFILE)) {72 if (check_pid(Options.PidFile)) { 72 73 printf ("Already running, exiting.\n"); 73 74 exit (1); … … 83 84 84 85 /* Write PID file */ 85 if (!write_pid( PIDFILE)) {86 if (!write_pid(Options.PidFile)) { 86 87 exit (1); 87 88 } 88 89 } 89 90 90 /* Disabled because I can't close the socket as nobody.91 And I don't feel like using threads now :)92 runas = getpwnam("nobody");93 setuid(runas->pw_uid);94 */95 96 91 for(;;) { 97 92 p_packet = (struct ip *) getnextippkt();
