diff options
author | Luca Boccassi <luca.boccassi@microsoft.com> | 2021-09-24 18:28:27 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-09-25 00:10:44 +0200 |
commit | f0e2cfc6dc1fc31a1a49c0a3bcaa56301e67e4ae (patch) | |
tree | 45149835ad52018d33bbe7c50ab31aa86f1ce9d5 /src/basic/linux | |
parent | user-record: switch the default LUKS PBKDF to argon2id to match cryptsetup (diff) | |
download | systemd-f0e2cfc6dc1fc31a1a49c0a3bcaa56301e67e4ae.tar.xz systemd-f0e2cfc6dc1fc31a1a49c0a3bcaa56301e67e4ae.zip |
basic: delete loadavg.h copy
loadavg.h is an internal header of the Linux source repository, and as
such it is licensed as GPLv2-only, without syscall exception.
We use it only for 4 macros, which are simply doing some math calculations
that cannot thus be subject to copyright.
Reimplement the same calculations in another internal header and delete
loadavg.h from our tree.
Diffstat (limited to 'src/basic/linux')
-rw-r--r-- | src/basic/linux/loadavg.h | 48 | ||||
-rwxr-xr-x | src/basic/linux/update.sh | 6 |
2 files changed, 1 insertions, 53 deletions
diff --git a/src/basic/linux/loadavg.h b/src/basic/linux/loadavg.h deleted file mode 100644 index 83ec54b65e..0000000000 --- a/src/basic/linux/loadavg.h +++ /dev/null @@ -1,48 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _LINUX_SCHED_LOADAVG_H -#define _LINUX_SCHED_LOADAVG_H - -/* - * These are the constant used to fake the fixed-point load-average - * counting. Some notes: - * - 11 bit fractions expand to 22 bits by the multiplies: this gives - * a load-average precision of 10 bits integer + 11 bits fractional - * - if you want to count load-averages more often, you need more - * precision, or rounding will get you. With 2-second counting freq, - * the EXP_n values would be 1981, 2034 and 2043 if still using only - * 11 bit fractions. - */ -extern unsigned long avenrun[]; /* Load averages */ -extern void get_avenrun(unsigned long *loads, unsigned long offset, int shift); - -#define FSHIFT 11 /* nr of bits of precision */ -#define FIXED_1 (1<<FSHIFT) /* 1.0 as fixed-point */ -#define LOAD_FREQ (5*HZ+1) /* 5 sec intervals */ -#define EXP_1 1884 /* 1/exp(5sec/1min) as fixed-point */ -#define EXP_5 2014 /* 1/exp(5sec/5min) */ -#define EXP_15 2037 /* 1/exp(5sec/15min) */ - -/* - * a1 = a0 * e + a * (1 - e) - */ -static inline unsigned long -calc_load(unsigned long load, unsigned long exp, unsigned long active) -{ - unsigned long newload; - - newload = load * exp + active * (FIXED_1 - exp); - if (active >= load) - newload += FIXED_1-1; - - return newload / FIXED_1; -} - -extern unsigned long calc_load_n(unsigned long load, unsigned long exp, - unsigned long active, unsigned int n); - -#define LOAD_INT(x) ((x) >> FSHIFT) -#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100) - -extern void calc_global_load(void); - -#endif /* _LINUX_SCHED_LOADAVG_H */ diff --git a/src/basic/linux/update.sh b/src/basic/linux/update.sh index 1ada894f09..72e133d0bc 100755 --- a/src/basic/linux/update.sh +++ b/src/basic/linux/update.sh @@ -4,11 +4,7 @@ set -eu set -o pipefail for i in *.h */*.h; do - if [[ "$i" == "loadavg.h" ]]; then - curl --fail "https://raw.githubusercontent.com/torvalds/linux/master/include/linux/sched/$i" -o "$i" - else - curl --fail "https://raw.githubusercontent.com/torvalds/linux/master/include/uapi/linux/$i" -o "$i" - fi + curl --fail "https://raw.githubusercontent.com/torvalds/linux/master/include/uapi/linux/$i" -o "$i" sed -i -e 's/__user //g' -e '/^#include <linux\/compiler.h>/ d' "$i" done |