NNTPC: Minor patch to set process name to something sensible

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, I found I would like 'ps' to show something useful for each client.
So I added a call to 'setproctitle' to make it look like this:

	nntpcached: unknown@haraldt.p52.hioslo.no (158.36.144.135)

I just did a quick and dirty version for FreeBSD - for a more complete
version look at TITLEset() from nnrpd.c in the inn-1.5.1 distribution.

I also changed a couple of openlog() calls to use "nntpcached" instead
of argv[0]. This is just a cosmetic issue, I think it makes the syslog
output easier to read.

I'm happy to report that ntpcached is now very nice and stable for me,
I haven't had a crash for several days. There are still problems with
multiuser handling (several users accessing the same articles/overview),
but I'm sure we'll get these fixed also.

Steinar Haug, Nethelp consulting, sthaug@nethelp.no
----------------------------------------------------------------------
*** nntpcache.c.orig	Fri Nov  8 21:47:38 1996
--- nntpcache.c	Tue Feb 11 13:46:30 1997
***************
*** 653,659 ****
  #  endif
  #endif
  	}
! 	openlog (argv[0], LOG_PID, LOG_NEWS);
  	gethostname (Host, sizeof (Host));
  	if ((hp = gethostbyname (Host)))
  		strncpy (Host, hp->h_name, sizeof Host);
--- 660,666 ----
  #  endif
  #endif
  	}
! 	openlog ("nntpcached", LOG_PID, LOG_NEWS);
  	gethostname (Host, sizeof (Host));
  	if ((hp = gethostbyname (Host)))
  		strncpy (Host, hp->h_name, sizeof Host);
***************
*** 910,916 ****
  #ifdef CRASHES_UNDER_LINUX
  					setvbuf(clientout, io_buf, _IOFBF, IO_BUF_LEN);
  #endif
! 					openlog (argv[0], LOG_PID, LOG_NEWS);
  					memset (Stats, 0, sizeof *Stats);
  					Stats->time_client_started = time (NULL);
  					break;
--- 926,932 ----
  #ifdef CRASHES_UNDER_LINUX
  					setvbuf(clientout, io_buf, _IOFBF, IO_BUF_LEN);
  #endif
! 					openlog ("nntpcached", LOG_PID, LOG_NEWS);
  					memset (Stats, 0, sizeof *Stats);
  					Stats->time_client_started = time (NULL);
  					break;
***************
*** 974,979 ****
--- 992,998 ----
  	signal(SIGALRM, sigalrm);
  	alarm(con.idleTimeout);
  	log (("connect from %s (%s)", ClientHost, ClientHostAddr));
+ 	setproctitle("%s (%s)", ClientHost, ClientHostAddr);
  	emitf ("%d %s NNTPcache server V%s %s ready (posting %s).\r\n", gauth->post? NNTP_POSTOK_VAL: NNTP_NOPOSTOK_VAL, Host, VERSION, __DATE__, gauth->post? "ok": "not permitted");
  	flush ();
  


[Index of Archives]     [Yosemite]     [Yosemite Campsites]     [Bugtraq]     [Linux]     [Trn]

Powered by Linux