* Sebastian Hammer, Adam Dickmeiss
*
* $Log: statserv.c,v $
- * Revision 1.33 1996-02-10 12:23:49 quinn
+ * Revision 1.36 1996-07-06 19:58:36 quinn
+ * System headerfiles gathered in yconfig
+ *
+ * Revision 1.35 1996/05/29 10:03:28 quinn
+ * Options work
+ *
+ * Revision 1.34 1996/02/21 13:12:07 quinn
+ * *** empty log message ***
+ *
+ * Revision 1.33 1996/02/10 12:23:49 quinn
* Enable inetd operations fro TCP/IP stack
*
* Revision 1.32 1996/01/19 15:41:52 quinn
* really have to, but it's great for debugging memory management. :)
*/
+#include <yconfig.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
-#include <sys/wait.h>
#include <signal.h>
#include <errno.h>
-#include <sys/types.h>
#include <pwd.h>
-#include <sys/time.h>
#include <options.h>
#include <eventl.h>
else if (res == 0) /* child */
{
char nbuf[100];
+ IOCHAN pp;
close(hand[0]);
child = 1;
+ for (pp = iochan_getchan(); pp; pp = iochan_getnext(pp))
+ {
+ if (pp != h)
+ {
+ COMSTACK l = iochan_getdata(pp);
+ cs_close(l);
+ iochan_destroy(pp);
+ }
+ }
sprintf(nbuf, "%s(%d)", me, getpid());
log_init(control_block.loglevel, nbuf, 0);
}
int statserv_main(int argc, char **argv)
{
- int ret, listeners = 0, inetd = 0;
+ int ret, listeners = 0, inetd = 0, r;
char *arg;
int protocol = control_block.default_proto;
me = argv[0];
- while ((ret = options("a:iszSl:v:u:c:w:", argv, argc, &arg)) != -2)
+ while ((ret = options("a:iszSl:v:u:c:w:t:k:", argv, argc, &arg)) != -2)
{
switch (ret)
{
strcpy(control_block.setuid, arg ? arg : ""); break;
case 'c':
strcpy(control_block.configname, arg ? arg : ""); break;
+ case 't':
+ if (!arg || !(r = atoi(arg)))
+ {
+ fprintf(stderr, "%s: Specify positive timeout for -t.\n",
+ me);
+ exit(1);
+ }
+ control_block.idle_timeout = r;
+ break;
+ case 'k':
+ if (!arg || !(r = atoi(arg)))
+ {
+ fprintf(stderr, "%s: Specify positive timeout for -t.\n",
+ me);
+ exit(1);
+ }
+ control_block.maxrecordsize = r * 1024;
+ break;
case 'i':
inetd = 1; break;
case 'w':
break;
default:
fprintf(stderr, "Usage: %s [ -i -a <pdufile> -v <loglevel>"
- " -l <logfile> -u <user> -c <config>"
+ " -l <logfile> -u <user> -c <config> -t <minutes>"
+ " -k <kilobytes>"
" -zsS <listener-addr> -w <directory> ... ]\n", me);
exit(1);
}