| 1 | /************************************************* |
| 2 | * Exim - an Internet mail transport agent * |
| 3 | *************************************************/ |
| 4 | |
| 5 | /* Copyright (c) University of Cambridge 2001 */ |
| 6 | /* See the file NOTICE for conditions of use and distribution. */ |
| 7 | |
| 8 | /* HI-OSF-specific code. This is concatenated onto the generic |
| 9 | src/os.c file. OSF has an apparently unique way of getting the |
| 10 | load average, so we provide a unique function here, and define |
| 11 | OS_LOAD_AVERAGE to stop src/os.c trying to provide the function. */ |
| 12 | |
| 13 | #ifndef OS_LOAD_AVERAGE |
| 14 | #define OS_LOAD_AVERAGE |
| 15 | |
| 16 | #include <sys/table.h> |
| 17 | |
| 18 | int |
| 19 | os_getloadavg(void) |
| 20 | { |
| 21 | double avg; |
| 22 | struct tbl_loadavg load_avg; |
| 23 | |
| 24 | table (TBL_LOADAVG, 0, &load_avg, 1, sizeof (load_avg)); |
| 25 | |
| 26 | avg = (load_avg.tl_lscale == 0)? |
| 27 | load_avg.tl_avenrun.d[0] : |
| 28 | (load_avg.tl_avenrun.l[0] / (double)load_avg.tl_lscale); |
| 29 | |
| 30 | return (int)(avg * 1000.0); |
| 31 | } |
| 32 | |
| 33 | #endif /* OS_LOAD_AVERAGE */ |
| 34 | |
| 35 | /* End of os.c-HI-OSF */ |