Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster manager_process_barrier_fd and drop message if BARRIER=1 found #15660

Merged
merged 3 commits into from
May 14, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/core/service.c
Original file line number Diff line number Diff line change
Expand Up @@ -3847,7 +3847,7 @@ static int service_dispatch_watchdog(sd_event_source *source, usec_t usec, void
return 0;
}

static bool service_notify_message_authorized(Service *s, pid_t pid, char **tags, FDSet *fds) {
static bool service_notify_message_authorized(Service *s, pid_t pid, FDSet *fds) {
assert(s);

if (s->notify_access == NOTIFY_NONE) {
Expand Down Expand Up @@ -3894,19 +3894,19 @@ static void service_force_watchdog(Service *s) {
static void service_notify_message(
Unit *u,
const struct ucred *ucred,
char **tags,
char * const *tags,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we mostly gave up on using const on arrays of strings, since the semantics of that are so fucked in C. but i guess it doesn't hurt if it works here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tried to had a few const at some place, I quickly forget about it. And yes I am agree this part in the C language is "not perfect".

FDSet *fds) {

Service *s = SERVICE(u);
bool notify_dbus = false;
const char *e;
char **i;
char * const *i;
int r;

assert(u);
assert(ucred);

if (!service_notify_message_authorized(SERVICE(u), ucred->pid, tags, fds))
if (!service_notify_message_authorized(SERVICE(u), ucred->pid, fds))
return;

if (DEBUG_LOGGING) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/unit.h
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ typedef struct UnitVTable {
void (*notify_cgroup_oom)(Unit *u);

/* Called whenever a process of this unit sends us a message */
void (*notify_message)(Unit *u, const struct ucred *ucred, char **tags, FDSet *fds);
void (*notify_message)(Unit *u, const struct ucred *ucred, char * const *tags, FDSet *fds);

/* Called whenever a name this Unit registered for comes or goes away. */
void (*bus_name_owner_change)(Unit *u, const char *new_owner);
Expand Down