mirror of
https://github.com/systemd/systemd.git
synced 2024-12-23 21:35:11 +03:00
pid1: make manager_deserialize_{uid,gid}_refs() static
No functional change.
This commit is contained in:
parent
80f605c807
commit
b406c6d128
@ -3427,6 +3427,52 @@ int manager_set_watchdog_overridden(Manager *m, WatchdogType t, usec_t timeout)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void manager_deserialize_uid_refs_one_internal(
|
||||
Manager *m,
|
||||
Hashmap** uid_refs,
|
||||
const char *value) {
|
||||
|
||||
uid_t uid;
|
||||
uint32_t c;
|
||||
int r;
|
||||
|
||||
assert(m);
|
||||
assert(uid_refs);
|
||||
assert(value);
|
||||
|
||||
r = parse_uid(value, &uid);
|
||||
if (r < 0 || uid == 0) {
|
||||
log_debug("Unable to parse UID reference serialization: " UID_FMT, uid);
|
||||
return;
|
||||
}
|
||||
|
||||
r = hashmap_ensure_allocated(uid_refs, &trivial_hash_ops);
|
||||
if (r < 0) {
|
||||
log_oom();
|
||||
return;
|
||||
}
|
||||
|
||||
c = PTR_TO_UINT32(hashmap_get(*uid_refs, UID_TO_PTR(uid)));
|
||||
if (c & DESTROY_IPC_FLAG)
|
||||
return;
|
||||
|
||||
c |= DESTROY_IPC_FLAG;
|
||||
|
||||
r = hashmap_replace(*uid_refs, UID_TO_PTR(uid), UINT32_TO_PTR(c));
|
||||
if (r < 0) {
|
||||
log_debug_errno(r, "Failed to add UID reference entry: %m");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void manager_deserialize_uid_refs_one(Manager *m, const char *value) {
|
||||
manager_deserialize_uid_refs_one_internal(m, &m->uid_refs, value);
|
||||
}
|
||||
|
||||
static void manager_deserialize_gid_refs_one(Manager *m, const char *value) {
|
||||
manager_deserialize_uid_refs_one_internal(m, &m->gid_refs, value);
|
||||
}
|
||||
|
||||
int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
|
||||
int r = 0;
|
||||
|
||||
@ -4584,52 +4630,6 @@ static void manager_vacuum(Manager *m) {
|
||||
exec_runtime_vacuum(m);
|
||||
}
|
||||
|
||||
static void manager_deserialize_uid_refs_one_internal(
|
||||
Manager *m,
|
||||
Hashmap** uid_refs,
|
||||
const char *value) {
|
||||
|
||||
uid_t uid;
|
||||
uint32_t c;
|
||||
int r;
|
||||
|
||||
assert(m);
|
||||
assert(uid_refs);
|
||||
assert(value);
|
||||
|
||||
r = parse_uid(value, &uid);
|
||||
if (r < 0 || uid == 0) {
|
||||
log_debug("Unable to parse UID reference serialization: " UID_FMT, uid);
|
||||
return;
|
||||
}
|
||||
|
||||
r = hashmap_ensure_allocated(uid_refs, &trivial_hash_ops);
|
||||
if (r < 0) {
|
||||
log_oom();
|
||||
return;
|
||||
}
|
||||
|
||||
c = PTR_TO_UINT32(hashmap_get(*uid_refs, UID_TO_PTR(uid)));
|
||||
if (c & DESTROY_IPC_FLAG)
|
||||
return;
|
||||
|
||||
c |= DESTROY_IPC_FLAG;
|
||||
|
||||
r = hashmap_replace(*uid_refs, UID_TO_PTR(uid), UINT32_TO_PTR(c));
|
||||
if (r < 0) {
|
||||
log_debug_errno(r, "Failed to add UID reference entry: %m");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void manager_deserialize_uid_refs_one(Manager *m, const char *value) {
|
||||
manager_deserialize_uid_refs_one_internal(m, &m->uid_refs, value);
|
||||
}
|
||||
|
||||
void manager_deserialize_gid_refs_one(Manager *m, const char *value) {
|
||||
manager_deserialize_uid_refs_one_internal(m, &m->gid_refs, value);
|
||||
}
|
||||
|
||||
int manager_dispatch_user_lookup_fd(sd_event_source *source, int fd, uint32_t revents, void *userdata) {
|
||||
struct buffer {
|
||||
uid_t uid;
|
||||
|
@ -529,9 +529,6 @@ int manager_ref_uid(Manager *m, uid_t uid, bool clean_ipc);
|
||||
void manager_unref_gid(Manager *m, gid_t gid, bool destroy_now);
|
||||
int manager_ref_gid(Manager *m, gid_t gid, bool destroy_now);
|
||||
|
||||
void manager_deserialize_uid_refs_one(Manager *m, const char *value);
|
||||
void manager_deserialize_gid_refs_one(Manager *m, const char *value);
|
||||
|
||||
char *manager_taint_string(Manager *m);
|
||||
|
||||
void manager_ref_console(Manager *m);
|
||||
|
Loading…
Reference in New Issue
Block a user