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