Mercurial > hg > xemacs-beta
comparison src/getloadavg.c @ 286:57709be46d1b r21-0b41
Import from CVS: tag r21-0b41
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:35:03 +0200 |
parents | c42ec1d1cded |
children | 8626e4521993 |
comparison
equal
deleted
inserted
replaced
285:9a3756523c1b | 286:57709be46d1b |
---|---|
56 UMAX4_3 | 56 UMAX4_3 |
57 WIN32 No-op for Windows95/NT. | 57 WIN32 No-op for Windows95/NT. |
58 __linux__ Linux: assumes /proc filesystem mounted. | 58 __linux__ Linux: assumes /proc filesystem mounted. |
59 Support from Michael K. Johnson. | 59 Support from Michael K. Johnson. |
60 __NetBSD__ NetBSD: assumes /kern filesystem mounted. | 60 __NetBSD__ NetBSD: assumes /kern filesystem mounted. |
61 __OpenBSD__ OpenBSD: dito. | |
61 | 62 |
62 In addition, to avoid nesting many #ifdefs, we internally set | 63 In addition, to avoid nesting many #ifdefs, we internally set |
63 LDAV_DONE to indicate that the load average has been computed. | 64 LDAV_DONE to indicate that the load average has been computed. |
64 | 65 |
65 We also #define LDAV_PRIVILEGED if a program will require | 66 We also #define LDAV_PRIVILEGED if a program will require |
619 | 620 |
620 for (elem = 0; elem < nelem && elem < count; elem++) | 621 for (elem = 0; elem < nelem && elem < count; elem++) |
621 loadavg[elem] = load_ave[elem]; | 622 loadavg[elem] = load_ave[elem]; |
622 #endif /* __linux__ */ | 623 #endif /* __linux__ */ |
623 | 624 |
624 #if !defined (LDAV_DONE) && defined (__NetBSD__) | 625 #if !defined (LDAV_DONE) && defined (__NetBSD__) || defined (__OpenBSD__) |
625 #define LDAV_DONE | 626 #define LDAV_DONE |
626 #undef LOAD_AVE_TYPE | 627 #undef LOAD_AVE_TYPE |
627 | 628 |
628 #ifndef NETBSD_LDAV_FILE | 629 #ifndef NETBSD_LDAV_FILE |
629 #define NETBSD_LDAV_FILE "/kern/loadavg" | 630 #define NETBSD_LDAV_FILE "/kern/loadavg" |
643 if (count != 4) | 644 if (count != 4) |
644 return -1; | 645 return -1; |
645 | 646 |
646 for (elem = 0; elem < nelem; elem++) | 647 for (elem = 0; elem < nelem; elem++) |
647 loadavg[elem] = (double) load_ave[elem] / (double) scale; | 648 loadavg[elem] = (double) load_ave[elem] / (double) scale; |
648 #endif /* __NetBSD__ */ | 649 #endif /* __NetBSD__ or __OpenBSD__ */ |
649 | 650 |
650 #if !defined (LDAV_DONE) && defined (NeXT) | 651 #if !defined (LDAV_DONE) && defined (NeXT) |
651 #define LDAV_DONE | 652 #define LDAV_DONE |
652 /* The NeXT code was adapted from iscreen 3.2. */ | 653 /* The NeXT code was adapted from iscreen 3.2. */ |
653 | 654 |