Re: refusing connections based on load ... - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: refusing connections based on load ...
Date
Msg-id Pine.LNX.4.30.0104241657010.736-100000@peter.localdomain
Whole thread Raw
In response to Re: refusing connections based on load ...  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: refusing connections based on load ...
List pgsql-hackers
Tom Lane writes:

> The Hermit Hacker <scrappy@hub.org> writes:
> > sendmail does it now, and, apparently relatively portable across OSs ...
>
> sendmail expects to be root.  It's unlikely (and very undesirable) that
> postgres will be installed with adequate privileges to read /dev/kmem,
> which is what it'd take to run the sendmail loadaverage code on most
> platforms...

This program:

#include <stdio.h>

int main()
{   double la[3];
   if (getloadavg(la, 3) == -1)       perror("getloadavg");
   printf("%f %f %f\n", la[0], la[1], la[2]);
   return 0;
}

works unprivileged on Linux 2.2 and FreeBSD 4.3.  Rumour[*] also has it
that there is a way to do this on Solaris and HP-UX 9.  So I think that
covers enough users to be worthwhile.

[*] - Autoconf AC_FUNC_GETLOADAVG

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: start / stop scripts question
Next
From: Thomas Lockhart
Date:
Subject: Re: OUTER JOIN vs UNION ... faster?