Tom Lane writes:

> The Hermit Hacker <[EMAIL PROTECTED]> 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   [EMAIL PROTECTED]   http://funkturm.homeip.net/~peter


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to