journald: move uid_for_system_journal() to uid-alloc-range.h

Let's move this helper call from journald specific code to src/basic/,
so that we can use it from sd-journal.

While we are at it, slightly extend it to also cover container uids,
which are also routed to the system journal now.

This places the call in uid-alloc-range.[ch] which contains similar
functions that match UID ranges for specific purposes.
This commit is contained in:
Lennart Poettering
2023-06-08 09:32:04 +02:00
parent 8a8b4a8784
commit 115d5145a2
3 changed files with 9 additions and 7 deletions
+7
View File
@@ -122,3 +122,10 @@ bool gid_is_system(gid_t gid) {
return gid <= defs->system_gid_max;
}
bool uid_for_system_journal(uid_t uid) {
/* Returns true if the specified UID shall get its data stored in the system journal. */
return uid_is_system(uid) || uid_is_dynamic(uid) || uid == UID_NOBODY || uid_is_container(uid);
}