diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 00:47:26 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 00:47:26 +0000 |
commit | 96b619cc129afed52411b9fad3407037a1cb7207 (patch) | |
tree | e453a74cc9ae39fbfcb3ac55a347e880413e4a06 /OS/unsupported/os.c-OSF1 | |
parent | Initial commit. (diff) | |
download | exim4-96b619cc129afed52411b9fad3407037a1cb7207.tar.xz exim4-96b619cc129afed52411b9fad3407037a1cb7207.zip |
Adding upstream version 4.92.upstream/4.92upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'OS/unsupported/os.c-OSF1')
-rw-r--r-- | OS/unsupported/os.c-OSF1 | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/OS/unsupported/os.c-OSF1 b/OS/unsupported/os.c-OSF1 new file mode 100644 index 0000000..ad91b63 --- /dev/null +++ b/OS/unsupported/os.c-OSF1 @@ -0,0 +1,36 @@ +/************************************************* +* Exim - an Internet mail transport agent * +*************************************************/ + +/* Copyright (c) University of Cambridge 2001 */ +/* See the file NOTICE for conditions of use and distribution. */ + +/* OSF1-specific code. This is concatenated onto the generic src/os.c file. +OSF1 has an apparently unique way of getting the load average, so we provide a +unique function here, and define OS_LOAD_AVERAGE to stop src/os.c trying to +provide the function. The macro may be set initially anyway, when compiling os. +for utilities that don't want this function. */ + +#ifndef OS_LOAD_AVERAGE +#define OS_LOAD_AVERAGE + +#include <sys/table.h> + +int +os_getloadavg(void) +{ +double avg; +struct tbl_loadavg load_avg; + +table (TBL_LOADAVG, 0, &load_avg, 1, sizeof (load_avg)); + +avg = (load_avg.tl_lscale == 0)? + load_avg.tl_avenrun.d[0] : + (load_avg.tl_avenrun.l[0] / (double)load_avg.tl_lscale); + +return (int)(avg * 1000.0); +} + +#endif /* OS_LOAD_AVERAGE */ + +/* End of os.c-OSF1 */ |