diff options
author | 2015-01-16 16:48:51 +0000 | |
---|---|---|
committer | 2015-01-16 16:48:51 +0000 | |
commit | aea60bee5e9bad0aab62f480f19c2fb34c068de4 (patch) | |
tree | 1e7befbc10e28796528939427d4fdbd94b60d9af /lib/libc/gen/getloadavg.c | |
parent | More evil bootstrap code. #ifndef ALIGNBYTES #define ALIGNBYTES 3. (diff) | |
download | wireguard-openbsd-aea60bee5e9bad0aab62f480f19c2fb34c068de4.tar.xz wireguard-openbsd-aea60bee5e9bad0aab62f480f19c2fb34c068de4.zip |
Move to the <limits.h> universe.
review by millert, binary checking process with doug, concept with guenther
Diffstat (limited to 'lib/libc/gen/getloadavg.c')
-rw-r--r-- | lib/libc/gen/getloadavg.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libc/gen/getloadavg.c b/lib/libc/gen/getloadavg.c index 0b38042fec7..3ab72b09b47 100644 --- a/lib/libc/gen/getloadavg.c +++ b/lib/libc/gen/getloadavg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getloadavg.c,v 1.6 2005/08/08 08:05:34 espie Exp $ */ +/* $OpenBSD: getloadavg.c,v 1.7 2015/01/16 16:48:51 deraadt Exp $ */ /*- * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. @@ -28,13 +28,14 @@ * SUCH DAMAGE. */ -#include <sys/param.h> #include <sys/time.h> #include <sys/resource.h> #include <sys/sysctl.h> #include <stdlib.h> +#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b)) + /* * getloadavg() -- Get system load averages. * @@ -54,7 +55,7 @@ getloadavg(double loadavg[], int nelem) if (sysctl(mib, 2, &loadinfo, &size, NULL, 0) < 0) return (-1); - nelem = MIN(nelem, sizeof(loadinfo.ldavg) / sizeof(fixpt_t)); + nelem = MINIMUM(nelem, sizeof(loadinfo.ldavg) / sizeof(fixpt_t)); for (i = 0; i < nelem; i++) loadavg[i] = (double) loadinfo.ldavg[i] / loadinfo.fscale; return (nelem); |