Use compressed form of ipv6 in $sender_host_address under -bh. Bug 3027
[exim.git] / src / OS / unsupported / os.c-OSF1
1 /*************************************************
2 *     Exim - an Internet mail transport agent    *
3 *************************************************/
4
5 /* Copyright (c) University of Cambridge 2001 */
6 /* SPDX-License-Identifier: GPL-2.0-or-later */
7 /* See the file NOTICE for conditions of use and distribution. */
8
9 /* OSF1-specific code. This is concatenated onto the generic src/os.c file.
10 OSF1 has an apparently unique way of getting the load average, so we provide a
11 unique function here, and define OS_LOAD_AVERAGE to stop src/os.c trying to
12 provide the function. The macro may be set initially anyway, when compiling os.
13 for utilities that don't want this function. */
14
15 #ifndef OS_LOAD_AVERAGE
16 #define OS_LOAD_AVERAGE
17
18 #include <sys/table.h>
19
20 int
21 os_getloadavg(void)
22 {
23 double avg;
24 struct tbl_loadavg load_avg;
25
26 table (TBL_LOADAVG, 0, &load_avg, 1, sizeof (load_avg));
27
28 avg = (load_avg.tl_lscale == 0)?
29   load_avg.tl_avenrun.d[0] :
30   (load_avg.tl_avenrun.l[0] / (double)load_avg.tl_lscale);
31
32 return (int)(avg * 1000.0);
33 }
34
35 #endif  /* OS_LOAD_AVERAGE */
36
37 /* End of os.c-OSF1 */