Import Debian changes 4.92-8+deb10u3
[hcoop/debian/exim4.git] / OS / unsupported / os.c-HI-OSF
CommitLineData
420a0d19
CE
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
9src/os.c file. OSF has an apparently unique way of getting the
10load average, so we provide a unique function here, and define
11OS_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
18int
19os_getloadavg(void)
20{
21double avg;
22struct tbl_loadavg load_avg;
23
24table (TBL_LOADAVG, 0, &load_avg, 1, sizeof (load_avg));
25
26avg = (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
30return (int)(avg * 1000.0);
31}
32
33#endif /* OS_LOAD_AVERAGE */
34
35/* End of os.c-HI-OSF */