On Sat, 14 Mar 1998, Tom wrote:
> > Meanwhile, what's wrong with using exiwhat?
>
> Extremely resource intensive for one. I only care about stuff like this
> when the server is very loaded, and I want to see if a particular site is
> abusing Exim. But having exiwhat walk down the process list and
> send signals to hundreds of Exim processes, just makes the load even
> higher.
I take the point but:
(1) setproctitle() is not available in all OS - as far as I can see, not
in Solaris2, Linux, SunOS4, IRIX, HP-UX, or Digital Unix (at least
there's no man page for it). I found a man page on NetBSD, so I suspect
it is only in the BSD versions of Unix. Given this, I'm not very keen to
try to support it (it it were, say, just one OS that missed it I might
feel different).
(2) In Solaris 2, writing to argv[n] or the area that argv[n] points to
does not change what ps displays, though in Linux writing to the area it
points to does make the change. I haven't tried any other OS.
I've been promised code that works in Solaris 2, though I feel that the
only way this can be possible is by some privileged thing that requires
root and maybe poking around in kernel blocks. I definitely do not want
to do that.
Despite what I said in (1), since the creation of the line of text that
exiwhat uses is in a single procedure in the exim.c file, it wouldn't be
difficult to add a call to setproctitle() there, for those OS that do
have it. Somebody might like to look around line 144 in exim.c (either
in 1.82 or 1.890) where the code reads:
void
set_process_info(char *format, ...)
{
int len;
va_list ap;
sprintf(process_info, "%5d %.12s ", (int)getpid(), version_string);
len = strlen(process_info);
va_start(ap, format);
if (!string_vformat(process_info + len, PROCESS_INFO_SIZE - len, format, ap))
strcpy(process_info + len, "**** string overflowed buffer ****");
DEBUG(2) debug_printf("set_process_info: %s\n", process_info);
va_end(ap);
}
and try sticking in a call to setproctitle right at the end, using the
string in process_info.
If that works, I think I could be persuaded to put it in with a suitable
conditional macro that could be defined only for those OS that have it.
--
Philip Hazel University Computing Service,
ph10@??? New Museums Site, Cambridge CB2 3QG,
P.Hazel@??? England. Phone: +44 1223 334714
--
*** Exim information can be found at
http://www.exim.org/ ***