summaryrefslogtreecommitdiffstats
path: root/src/core/cgroup.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-02-09 12:21:26 +0100
committerLennart Poettering <lennart@poettering.net>2024-02-09 15:32:04 +0100
commit893220f62ff35b6a6f4a36167bf0dbc08ea3f701 (patch)
treef5aef4b2fcee80872fc3989a0dc0bcda065e4573 /src/core/cgroup.c
parentMerge pull request #31243 from YHNdnzj/systemctl-disable-now-template (diff)
downloadsystemd-893220f62ff35b6a6f4a36167bf0dbc08ea3f701.tar.xz
systemd-893220f62ff35b6a6f4a36167bf0dbc08ea3f701.zip
bpf-devices: normalize how we pass around major/minor values
There's some unclarity whether major/minor of device nodes are supposed to be "unsigned" or "dev_t". Various codebases assume the latter, but glibc's major()/minor() types actually return a value typed to "unsigned". On glibc dev_t is actually 64bit even if the kernel only exposes 32bit. Hence this distinction kinda matters. Let's clean things up a bit with handling: let's followe glibc's type system here, and use unsigned (and not int). Also let's pass invalid major/minor values around as UINT_MAX rather than via pointers, to match how we usually do this, and to shorten our code a bit. This is safe, since given the linux dev_t space being 32bit only we can't possibly have a valid major or minor this hight, given they must be smaller in size. While other archs disagree on the types of major/minor, they also tend to have similar limits. In fact on FreeBSD for example major()/minor() returns a signed int. Which would hence also mean that UINT_MAX cannot be a valid major or minor.
Diffstat (limited to 'src/core/cgroup.c')
0 files changed, 0 insertions, 0 deletions