Skip to content

Commit

Permalink
NOMERGE make namespace order verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
yabberyabber committed Nov 27, 2024
1 parent e113f22 commit 767739c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions ns.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <err.h>
#include <errno.h>
#include <stdio.h>
#include <fcntl.h>
#include <sched.h>
#include <stdlib.h>
Expand Down Expand Up @@ -155,12 +156,21 @@ void ns_enter_prefork(struct nsid *namespaces, size_t *len)
the userns may restrict us from joining additional namespaces, so
we rearrange the order so that we setns into target nsfs files first. */
if (capable(BST_CAP_SYS_ADMIN)) {
printf("performing sort: ");
qsort(namespaces, *len, sizeof (namespaces[0]),
cmp_nsids);
}
} else {
printf("skipping sort: ");
}
struct nsid *ns = &namespaces[0];
printf("POST SORT: ");
for (; ns < namespaces + *len; ++ns) {
printf("%d (%d), ", ns->ns, ns->action);
}
printf("\n");

struct nsid *first_postfork = NULL;
struct nsid *ns = &namespaces[0];
ns = &namespaces[0];
for (; ns < namespaces + *len; ++ns) {
if (ns->action != NSACTION_SHARE_WITH_PARENT && is_postfork_ns(ns)) {
first_postfork = ns;
Expand Down

0 comments on commit 767739c

Please sign in to comment.