perl paranoia about @INC
[exim.git] / src / OS / os.c-OSF1
CommitLineData
61ec970d
PH
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/* OSF1-specific code. This is concatenated onto the generic src/os.c file.
9OSF1 has an apparently unique way of getting the load average, so we provide a
10unique function here, and define OS_LOAD_AVERAGE to stop src/os.c trying to
11provide the function. The macro may be set initially anyway, when compiling os.
12for utilities that don't want this function. */
13
14#ifndef OS_LOAD_AVERAGE
15#define OS_LOAD_AVERAGE
16
17#include <sys/table.h>
18
19int
20os_getloadavg(void)
21{
22double avg;
23struct tbl_loadavg load_avg;
24
25table (TBL_LOADAVG, 0, &load_avg, 1, sizeof (load_avg));
26
27avg = (load_avg.tl_lscale == 0)?
28 load_avg.tl_avenrun.d[0] :
29 (load_avg.tl_avenrun.l[0] / (double)load_avg.tl_lscale);
30
31return (int)(avg * 1000.0);
32}
33
34#endif /* OS_LOAD_AVERAGE */
35
36/* End of os.c-OSF1 */