systemd-nspawn: make SettingsMask 64 bit wide
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 22 May 2018 07:13:31 +0000 (09:13 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 22 May 2018 08:51:49 +0000 (10:51 +0200)
commitb49c6ca089a3eb663e42aa55a06df8c1fea8543c
tree7f18b96852daa8938310d7d3e3f8439d87ee2d46
parent9b505bc257907a6b9a2bcd006796b0a1d0fab76d
systemd-nspawn: make SettingsMask 64 bit wide

The use of UINT64_C() in the SettingsMask enum definition is misleading:
it does not mean that individual fields have this width. E.g., with
enum {
   FOO = UINT64_C(1)
}
sizeof(FOO) gives 4. It only means that the shift is done properly. So
1 << 35 is undefined, but UINT64_C(1) << 35 is the expected 64 bit
constant. Thus, the use UINT64_C() is useful, because we know that the shifts
are done properly, no matter what the value of _RLIMIT_MAX is, but when those
fields are used in expressions, we don't know what size they will be
(probably 4). Let's add a define which "hides" the enum definition behind a
define which gives the same value but is actually 64 bit. I think this is a
nicer solution than requiring all users to cast SETTING_RLIMIT_FIRST before
use.

Fixes #9035.
src/nspawn/nspawn-settings.h