return count;
}
-static int exec_process(const char* name, char **argv, char **env, int start_fd, int n_fds) {
+static int exec_process(const char* name, char **argv, char **env, int start_fd, size_t n_fds) {
_cleanup_strv_free_ char **envp = NULL;
_cleanup_free_ char *joined = NULL;
- unsigned n_env = 0, length;
+ size_t n_env = 0, length;
const char *tocopy;
char **s;
int r;
start_fd = SD_LISTEN_FDS_START;
}
- if (asprintf((char**)(envp + n_env++), "LISTEN_FDS=%i", n_fds) < 0)
+ if (asprintf((char**)(envp + n_env++), "LISTEN_FDS=%zu", n_fds) < 0)
return log_oom();
if (asprintf((char**)(envp + n_env++), "LISTEN_PID=" PID_FMT, getpid_cached()) < 0)
_cleanup_free_ char *names = NULL;
size_t len;
char *e;
- int i;
len = strv_length(arg_fdnames);
- if (len == 1)
+ if (len == 1) {
+ size_t i;
+
for (i = 1; i < n_fds; i++) {
r = strv_extend(&arg_fdnames, arg_fdnames[0]);
if (r < 0)
return log_error_errno(r, "Failed to extend strv: %m");
}
- else if (len != (unsigned) n_fds)
- log_warning("The number of fd names is different than number of fds: %zu vs %d",
- len, n_fds);
+ } else if (len != n_fds)
+ log_warning("The number of fd names is different than number of fds: %zu vs %zu", len, n_fds);
names = strv_join(arg_fdnames, ":");
if (!names)
break;
}
- exec_process(argv[optind], argv + optind, envp, SD_LISTEN_FDS_START, n);
+ exec_process(argv[optind], argv + optind, envp, SD_LISTEN_FDS_START, (size_t) n);
return EXIT_SUCCESS;
}
}
static void normalize_chain(CalendarComponent **c) {
- unsigned n = 0, k;
CalendarComponent **b, *i, **j, *next;
+ size_t n = 0, k;
assert(c);
assert(c);
for (;;) {
- unsigned i;
+ size_t i;
for (i = 0; i < ELEMENTSOF(day_nr); i++) {
size_t skip;
* - do nothing if our new entry matches the existing entry,
* - replace the existing entry if our new entry has higher priority.
*/
+ size_t i;
char *t;
- unsigned i;
int r;
for (i = 0; i < strv_length(*strv); i++) {
return 0;
}
-char **strv_env_merge(unsigned n_lists, ...) {
+char **strv_env_merge(size_t n_lists, ...) {
size_t n = 0;
char **l, **k, **r;
va_list ap;
- unsigned i;
+ size_t i;
/* Merges an arbitrary number of environment sets */
return *t == '=';
}
-char **strv_env_delete(char **x, unsigned n_lists, ...) {
+char **strv_env_delete(char **x, size_t n_lists, ...) {
size_t n, i = 0;
char **k, **r;
va_list ap;
return NULL;
STRV_FOREACH(k, x) {
- unsigned v;
+ size_t v;
va_start(ap, n_lists);
for (v = 0; v < n_lists; v++) {
char **replace_env_argv(char **argv, char **env) {
char **ret, **i;
- unsigned k = 0, l = 0;
+ size_t k = 0, l = 0;
l = strv_length(argv);
if ((*i)[0] == '$' && !IN_SET((*i)[1], '{', '$')) {
char *e;
char **w, **m = NULL;
- unsigned q;
+ size_t q;
e = strv_env_get(env, *i+1);
if (e) {
bool strv_env_name_is_valid(char **l);
bool strv_env_name_or_assignment_is_valid(char **l);
-char **strv_env_merge(unsigned n_lists, ...);
-char **strv_env_delete(char **x, unsigned n_lists, ...); /* New copy */
+char **strv_env_merge(size_t n_lists, ...);
+char **strv_env_delete(char **x, size_t n_lists, ...); /* New copy */
char **strv_env_set(char **x, const char *p); /* New copy ... */
char **strv_env_unset(char **l, const char *p); /* In place ... */
/* C++11 style 16bit unicode */
int a[4];
- unsigned i;
+ size_t i;
uint32_t c;
if (length != (size_t) -1 && length < 5)
/* C++11 style 32bit unicode */
int a[8];
- unsigned i;
+ size_t i;
char32_t c;
if (length != (size_t) -1 && length < 9)
p[1] = safe_close(p[1]);
}
-void close_many(const int fds[], unsigned n_fd) {
- unsigned i;
+void close_many(const int fds[], size_t n_fd) {
+ size_t i;
assert(fds || n_fd <= 0);
return 0;
}
-_pure_ static bool fd_in_set(int fd, const int fdset[], unsigned n_fdset) {
- unsigned i;
+_pure_ static bool fd_in_set(int fd, const int fdset[], size_t n_fdset) {
+ size_t i;
assert(n_fdset == 0 || fdset);
return false;
}
-int close_all_fds(const int except[], unsigned n_except) {
+int close_all_fds(const int except[], size_t n_except) {
_cleanup_closedir_ DIR *d = NULL;
struct dirent *de;
int r = 0;
return safe_close(fd);
}
-void close_many(const int fds[], unsigned n_fd);
+void close_many(const int fds[], size_t n_fd);
int fclose_nointr(FILE *f);
FILE* safe_fclose(FILE *f);
int fd_nonblock(int fd, bool nonblock);
int fd_cloexec(int fd, bool cloexec);
-int close_all_fds(const int except[], unsigned n_except);
+int close_all_fds(const int except[], size_t n_except);
int same_fd(int a, int b);
ssize_t sparse_write(int fd, const void *p, size_t sz, size_t run_length);
-static inline size_t IOVEC_TOTAL_SIZE(const struct iovec *i, unsigned n) {
- unsigned j;
- size_t r = 0;
+static inline size_t IOVEC_TOTAL_SIZE(const struct iovec *i, size_t n) {
+ size_t j, r = 0;
for (j = 0; j < n; j++)
r += i[j].iov_len;
return r;
}
-static inline size_t IOVEC_INCREMENT(struct iovec *i, unsigned n, size_t k) {
- unsigned j;
+static inline size_t IOVEC_INCREMENT(struct iovec *i, size_t n, size_t k) {
+ size_t j;
for (j = 0; j < n; j++) {
size_t sub;
_cleanup_close_ int fd = -1;
size_t sz = 0;
struct stat st;
- unsigned i;
+ size_t i;
int r;
fd = open("/usr/lib/locale/locale-archive", O_RDONLY|O_NOCTTY|O_CLOEXEC);
char location[256], prefix[1 + DECIMAL_STR_MAX(int) + 2];
struct iovec iovec[6] = {};
- unsigned n = 0;
bool highlight;
+ size_t n = 0;
if (console_fd < 0)
return 0;
struct pool {
struct pool *next;
- unsigned n_tiles;
- unsigned n_used;
+ size_t n_tiles;
+ size_t n_used;
};
void* mempool_alloc_tile(struct mempool *mp) {
- unsigned i;
+ size_t i;
/* When a tile is released we add it to the list and simply
* place the next pointer at its offset 0. */
if (_unlikely_(!mp->first_pool) ||
_unlikely_(mp->first_pool->n_used >= mp->first_pool->n_tiles)) {
- unsigned n;
- size_t size;
+ size_t size, n;
struct pool *p;
n = mp->first_pool ? mp->first_pool->n_tiles : 0;
do {
char line[LINE_MAX];
- unsigned i;
+ size_t i;
for (i = 0; i < sizeof(line)-1; i++) {
int c;
return 0;
}
-int fork_agent(const char *name, const int except[], unsigned n_except, pid_t *ret_pid, const char *path, ...) {
+int fork_agent(const char *name, const int except[], size_t n_except, pid_t *ret_pid, const char *path, ...) {
bool stdout_is_tty, stderr_is_tty;
- unsigned n, i;
+ size_t n, i;
va_list ap;
char **l;
int r;
return safe_fork_full(name, NULL, 0, flags, ret_pid);
}
-int fork_agent(const char *name, const int except[], unsigned n_except, pid_t *pid, const char *path, ...);
+int fork_agent(const char *name, const int except[], size_t n_except, pid_t *pid, const char *path, ...);
#if SIZEOF_PID_T == 4
/* The highest possibly (theoretic) pid_t value on this architecture. */
static int have_syscall = -1;
_cleanup_close_ int fd = -1;
- unsigned already_done = 0;
+ size_t already_done = 0;
int r;
/* Gathers some randomness from the kernel. This call will never block. If
const char *_appendees_[] = { a, __VA_ARGS__ }; \
char *_d_, *_p_; \
size_t _len_ = 0; \
- unsigned _i_; \
+ size_t _i_; \
for (_i_ = 0; _i_ < ELEMENTSOF(_appendees_) && _appendees_[_i_]; _i_++) \
_len_ += strlen(_appendees_[_i_]); \
_p_ = _d_ = alloca(_len_ + 1); \
return r;
}
-unsigned strv_length(char * const *l) {
- unsigned n = 0;
+size_t strv_length(char * const *l) {
+ size_t n = 0;
if (!l)
return 0;
char **strv_new_ap(const char *x, va_list ap) {
const char *s;
char **a;
- unsigned n = 0, i = 0;
+ size_t n = 0, i = 0;
va_list aq;
/* As a special trick we ignore all listed strings that equal
char **strv_split(const char *s, const char *separator) {
const char *word, *state;
size_t l;
- unsigned n, i;
+ size_t n, i;
char **r;
assert(s);
char **strv_split_newlines(const char *s) {
char **l;
- unsigned n;
+ size_t n;
assert(s);
int strv_push(char ***l, char *value) {
char **c;
- unsigned n, m;
+ size_t n, m;
if (!value)
return 0;
int strv_push_pair(char ***l, char *a, char *b) {
char **c;
- unsigned n, m;
+ size_t n, m;
if (!a && !b)
return 0;
return 0;
}
-int strv_insert(char ***l, unsigned position, char *value) {
+int strv_insert(char ***l, size_t position, char *value) {
char **c;
- unsigned n, m, i;
+ size_t n, m, i;
if (!value)
return 0;
*/
const char *p;
- unsigned c = 0, i = 0;
+ size_t c = 0, i = 0;
char **v;
assert(s || l <= 0);
}
char **strv_reverse(char **l) {
- unsigned n, i;
+ size_t n, i;
n = strv_length(l);
if (n <= 1)
void strv_clear(char **l);
char **strv_copy(char * const *l);
-unsigned strv_length(char * const *l) _pure_;
+size_t strv_length(char * const *l) _pure_;
int strv_extend_strv(char ***a, char **b, bool filter_duplicates);
int strv_extend_strv_concat(char ***a, char **b, const char *suffix);
int strv_extend_front(char ***l, const char *value);
int strv_push(char ***l, char *value);
int strv_push_pair(char ***l, char *a, char *b);
-int strv_insert(char ***l, unsigned position, char *value);
+int strv_insert(char ***l, size_t position, char *value);
static inline int strv_push_prepend(char ***l, char *value) {
return strv_insert(l, 0, value);
if (!first) \
_l = (char**) &first; \
else { \
- unsigned _n; \
+ size_t _n; \
va_list _ap; \
\
_n = 1; \
{ "us", 1 },
};
- unsigned i;
+ size_t i;
char *p = buf;
bool something = false;
time_t x;
usec_t x_usec, plus = 0, minus = 0, ret;
int r, weekday = -1, dst = -1;
- unsigned i;
+ size_t i;
/*
* Allowed syntaxes:
{ "us", 1ULL },
{ "µs", 1ULL },
};
- unsigned i;
+ size_t i;
for (i = 0; i < ELEMENTSOF(table); i++) {
char *e;
for (;;) {
long long l, z = 0;
+ size_t n = 0, i;
char *e;
- unsigned i, n = 0;
p += strspn(p, WHITESPACE);
sd_bus_error *error,
int c,
UnitFileChange *changes,
- unsigned n_changes) {
+ size_t n_changes) {
+
+ size_t i;
int r;
- unsigned i;
for (i = 0; i < n_changes; i++)
sd_bus_message *message,
int carries_install_info,
UnitFileChange *changes,
- unsigned n_changes,
+ size_t n_changes,
sd_bus_error *error) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
bool bad = false, good = false;
- unsigned i;
+ size_t i;
int r;
if (unit_file_changes_have_modification(changes, n_changes)) {
static int method_enable_unit_files_generic(
sd_bus_message *message,
Manager *m,
- int (*call)(UnitFileScope scope, UnitFileFlags flags, const char *root_dir, char *files[], UnitFileChange **changes, unsigned *n_changes),
+ int (*call)(UnitFileScope scope, UnitFileFlags flags, const char *root_dir, char *files[], UnitFileChange **changes, size_t *n_changes),
bool carries_install_info,
sd_bus_error *error) {
_cleanup_strv_free_ char **l = NULL;
UnitFileChange *changes = NULL;
- unsigned n_changes = 0;
+ size_t n_changes = 0;
UnitFileFlags flags;
int runtime, force, r;
return method_enable_unit_files_generic(message, userdata, unit_file_link, false, error);
}
-static int unit_file_preset_without_mode(UnitFileScope scope, UnitFileFlags flags, const char *root_dir, char **files, UnitFileChange **changes, unsigned *n_changes) {
+static int unit_file_preset_without_mode(UnitFileScope scope, UnitFileFlags flags, const char *root_dir, char **files, UnitFileChange **changes, size_t *n_changes) {
return unit_file_preset(scope, flags, root_dir, files, UNIT_FILE_PRESET_FULL, changes, n_changes);
}
_cleanup_strv_free_ char **l = NULL;
UnitFileChange *changes = NULL;
- unsigned n_changes = 0;
+ size_t n_changes = 0;
Manager *m = userdata;
UnitFilePresetMode mm;
int runtime, force, r;
static int method_disable_unit_files_generic(
sd_bus_message *message,
Manager *m,
- int (*call)(UnitFileScope scope, UnitFileFlags flags, const char *root_dir, char *files[], UnitFileChange **changes, unsigned *n_changes),
+ int (*call)(UnitFileScope scope, UnitFileFlags flags, const char *root_dir, char *files[], UnitFileChange **changes, size_t *n_changes),
sd_bus_error *error) {
_cleanup_strv_free_ char **l = NULL;
UnitFileChange *changes = NULL;
- unsigned n_changes = 0;
+ size_t n_changes = 0;
int r, runtime;
assert(message);
static int method_revert_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_strv_free_ char **l = NULL;
UnitFileChange *changes = NULL;
- unsigned n_changes = 0;
+ size_t n_changes = 0;
Manager *m = userdata;
int r;
static int method_set_default_target(sd_bus_message *message, void *userdata, sd_bus_error *error) {
UnitFileChange *changes = NULL;
- unsigned n_changes = 0;
+ size_t n_changes = 0;
Manager *m = userdata;
const char *name;
int force, r;
static int method_preset_all_unit_files(sd_bus_message *message, void *userdata, sd_bus_error *error) {
UnitFileChange *changes = NULL;
- unsigned n_changes = 0;
+ size_t n_changes = 0;
Manager *m = userdata;
UnitFilePresetMode mm;
const char *mode;
_cleanup_strv_free_ char **l = NULL;
Manager *m = userdata;
UnitFileChange *changes = NULL;
- unsigned n_changes = 0;
+ size_t n_changes = 0;
int runtime, force, r;
char *target, *type;
UnitDependency dep;
static int method_get_unit_file_links(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
UnitFileChange *changes = NULL;
- unsigned n_changes = 0, i;
+ size_t n_changes = 0, i;
UnitFileFlags flags;
const char *name;
char **p;
#define SNDBUF_SIZE (8*1024*1024)
-static int shift_fds(int fds[], unsigned n_fds) {
+static int shift_fds(int fds[], size_t n_fds) {
int start, restart_from;
if (n_fds <= 0)
return 0;
}
-static int flags_fds(const int fds[], unsigned n_storage_fds, unsigned n_socket_fds, bool nonblock) {
- unsigned i, n_fds;
+static int flags_fds(const int fds[], size_t n_storage_fds, size_t n_socket_fds, bool nonblock) {
+ size_t i, n_fds;
int r;
n_fds = n_storage_fds + n_socket_fds;
gid_t gid,
const char *tty,
char ***env,
- int fds[], unsigned n_fds) {
+ int fds[], size_t n_fds) {
#if HAVE_PAM
const Unit *u,
const ExecContext *c,
const ExecParameters *p,
- unsigned n_fds,
+ size_t n_fds,
const char *home,
const char *username,
const char *shell,
char ***ret) {
_cleanup_strv_free_ char **our_env = NULL;
- unsigned n_env = 0;
+ size_t n_env = 0;
char *x;
assert(u);
return -ENOMEM;
our_env[n_env++] = x;
- if (asprintf(&x, "LISTEN_FDS=%u", n_fds) < 0)
+ if (asprintf(&x, "LISTEN_FDS=%zu", n_fds) < 0)
return -ENOMEM;
our_env[n_env++] = x;
const ExecContext *context,
const ExecParameters *params,
BindMount **ret_bind_mounts,
- unsigned *ret_n_bind_mounts,
+ size_t *ret_n_bind_mounts,
char ***ret_empty_directories) {
_cleanup_strv_free_ char **empty_directories = NULL;
BindMount *bind_mounts;
- unsigned n, h = 0, i;
+ size_t n, h = 0, i;
ExecDirectoryType t;
int r;
};
bool needs_sandboxing;
BindMount *bind_mounts = NULL;
- unsigned n_bind_mounts = 0;
+ size_t n_bind_mounts = 0;
int r;
assert(context);
return r;
}
-static void append_socket_pair(int *array, unsigned *n, const int pair[2]) {
+static void append_socket_pair(int *array, size_t *n, const int pair[2]) {
assert(array);
assert(n);
const DynamicCreds *dcreds,
int user_lookup_fd,
int socket_fd,
- int *fds, unsigned n_fds) {
+ int *fds, size_t n_fds) {
- unsigned n_dont_close = 0;
+ size_t n_dont_close = 0;
int dont_close[n_fds + 12];
assert(params);
int socket_fd,
int named_iofds[3],
int *fds,
- unsigned n_storage_fds,
- unsigned n_socket_fds,
+ size_t n_storage_fds,
+ size_t n_socket_fds,
char **files_env,
int user_lookup_fd,
int *exit_status) {
uid_t uid = UID_INVALID;
gid_t gid = GID_INVALID;
int i, r, ngids = 0;
- unsigned n_fds;
+ size_t n_fds;
ExecDirectoryType dt;
int secure_bits;
_cleanup_strv_free_ char **files_env = NULL;
int *fds = NULL;
- unsigned n_storage_fds = 0, n_socket_fds = 0;
+ size_t n_storage_fds = 0, n_socket_fds = 0;
_cleanup_free_ char *line = NULL;
int socket_fd, r;
int named_iofds[3] = { -1, -1, -1 };
c->argv = strv_free(c->argv);
}
-void exec_command_done_array(ExecCommand *c, unsigned n) {
- unsigned i;
+void exec_command_done_array(ExecCommand *c, size_t n) {
+ size_t i;
for (i = 0; i < n; i++)
exec_command_done(c+i);
return NULL;
}
-void exec_command_free_array(ExecCommand **c, unsigned n) {
- unsigned i;
+void exec_command_free_array(ExecCommand **c, size_t n) {
+ size_t i;
for (i = 0; i < n; i++)
c[i] = exec_command_free_list(c[i]);
}
static int exec_context_named_iofds(const ExecContext *c, const ExecParameters *p, int named_iofds[3]) {
- unsigned i, targets;
+ size_t i, targets;
const char* stdio_fdname[3];
- unsigned n_fds;
+ size_t n_fds;
assert(c);
assert(p);
char **read_write_paths, **read_only_paths, **inaccessible_paths;
unsigned long mount_flags;
BindMount *bind_mounts;
- unsigned n_bind_mounts;
+ size_t n_bind_mounts;
TemporaryFileSystem *temporary_filesystems;
- unsigned n_temporary_filesystems;
+ size_t n_temporary_filesystems;
uint64_t capability_bounding_set;
uint64_t capability_ambient_set;
int *fds;
char **fd_names;
- unsigned n_storage_fds;
- unsigned n_socket_fds;
+ size_t n_storage_fds;
+ size_t n_socket_fds;
ExecFlags flags;
bool selinux_context_net:1;
DynamicCreds *dynamic_creds,
pid_t *ret);
-void exec_command_done_array(ExecCommand *c, unsigned n);
+void exec_command_done_array(ExecCommand *c, size_t n);
ExecCommand* exec_command_free_list(ExecCommand *c);
-void exec_command_free_array(ExecCommand **c, unsigned n);
+void exec_command_free_array(ExecCommand **c, size_t n);
void exec_command_dump_list(ExecCommand *c, FILE *f, const char *prefix);
void exec_command_append_list(ExecCommand **l, ExecCommand *e);
_cleanup_free_ Unit **array_copy = NULL;
Unit *u1, *u2, **array;
int r, *fd_array = NULL;
- unsigned n_fds = 0;
+ size_t n_fds = 0;
bool found = false;
ssize_t n;
return 0;
}
-static int append_bind_mounts(MountEntry **p, const BindMount *binds, unsigned n) {
- unsigned i;
+static int append_bind_mounts(MountEntry **p, const BindMount *binds, size_t n) {
+ size_t i;
assert(p);
return 0;
}
-static int append_tmpfs_mounts(MountEntry **p, const TemporaryFileSystem *tmpfs, unsigned n) {
- unsigned i;
+static int append_tmpfs_mounts(MountEntry **p, const TemporaryFileSystem *tmpfs, size_t n) {
+ size_t i;
int r;
assert(p);
return 0;
}
-static int append_static_mounts(MountEntry **p, const MountEntry *mounts, unsigned n, bool ignore_protect) {
- unsigned i;
+static int append_static_mounts(MountEntry **p, const MountEntry *mounts, size_t n, bool ignore_protect) {
+ size_t i;
assert(p);
assert(mounts);
return 0;
}
-static int prefix_where_needed(MountEntry *m, unsigned n, const char *root_directory) {
- unsigned i;
+static int prefix_where_needed(MountEntry *m, size_t n, const char *root_directory) {
+ size_t i;
/* Prefixes all paths in the bind mount table with the root directory if it is specified and the entry needs
* that. */
return 0;
}
-static void drop_duplicates(MountEntry *m, unsigned *n) {
+static void drop_duplicates(MountEntry *m, size_t *n) {
MountEntry *f, *t, *previous;
assert(m);
*n = t - m;
}
-static void drop_inaccessible(MountEntry *m, unsigned *n) {
+static void drop_inaccessible(MountEntry *m, size_t *n) {
MountEntry *f, *t;
const char *clear = NULL;
*n = t - m;
}
-static void drop_nop(MountEntry *m, unsigned *n) {
+static void drop_nop(MountEntry *m, size_t *n) {
MountEntry *f, *t;
assert(m);
*n = t - m;
}
-static void drop_outside_root(const char *root_directory, MountEntry *m, unsigned *n) {
+static void drop_outside_root(const char *root_directory, MountEntry *m, size_t *n) {
MountEntry *f, *t;
assert(m);
ns_info->protect_kernel_tunables);
}
-static unsigned namespace_calculate_mounts(
+static size_t namespace_calculate_mounts(
const char* root_directory,
const NamespaceInfo *ns_info,
char** read_write_paths,
char** read_only_paths,
char** inaccessible_paths,
char** empty_directories,
- unsigned n_bind_mounts,
- unsigned n_temporary_filesystems,
+ size_t n_bind_mounts,
+ size_t n_temporary_filesystems,
const char* tmp_dir,
const char* var_tmp_dir,
ProtectHome protect_home,
ProtectSystem protect_system) {
- unsigned protect_home_cnt;
- unsigned protect_system_cnt =
+ size_t protect_home_cnt;
+ size_t protect_system_cnt =
(protect_system == PROTECT_SYSTEM_STRICT ?
ELEMENTSOF(protect_system_strict_table) :
((protect_system == PROTECT_SYSTEM_FULL) ?
(namespace_info_mount_apivfs(root_directory, ns_info) ? ELEMENTSOF(apivfs_table) : 0);
}
-static void normalize_mounts(const char *root_directory, MountEntry *mounts, unsigned *n_mounts) {
+static void normalize_mounts(const char *root_directory, MountEntry *mounts, size_t *n_mounts) {
assert(n_mounts);
assert(mounts || *n_mounts == 0);
char** inaccessible_paths,
char** empty_directories,
const BindMount *bind_mounts,
- unsigned n_bind_mounts,
+ size_t n_bind_mounts,
const TemporaryFileSystem *temporary_filesystems,
- unsigned n_temporary_filesystems,
+ size_t n_temporary_filesystems,
const char* tmp_dir,
const char* var_tmp_dir,
ProtectHome protect_home,
size_t root_hash_size = 0;
bool make_slave = false;
const char *root;
- unsigned n_mounts;
+ size_t n_mounts;
bool require_prefix = false;
int r = 0;
if (n_mounts > 0) {
_cleanup_fclose_ FILE *proc_self_mountinfo = NULL;
char **blacklist;
- unsigned j;
+ size_t j;
/* Open /proc/self/mountinfo now as it may become unavailable if we mount anything on top of /proc.
* For example, this is the case with the option: 'InaccessiblePaths=/proc' */
return r;
}
-void bind_mount_free_many(BindMount *b, unsigned n) {
- unsigned i;
+void bind_mount_free_many(BindMount *b, size_t n) {
+ size_t i;
assert(b || n == 0);
free(b);
}
-int bind_mount_add(BindMount **b, unsigned *n, const BindMount *item) {
+int bind_mount_add(BindMount **b, size_t *n, const BindMount *item) {
_cleanup_free_ char *s = NULL, *d = NULL;
BindMount *c;
return 0;
}
-void temporary_filesystem_free_many(TemporaryFileSystem *t, unsigned n) {
- unsigned i;
+void temporary_filesystem_free_many(TemporaryFileSystem *t, size_t n) {
+ size_t i;
assert(t || n == 0);
int temporary_filesystem_add(
TemporaryFileSystem **t,
- unsigned *n,
+ size_t *n,
const char *path,
const char *options) {
char **inaccessible_paths,
char **empty_directories,
const BindMount *bind_mounts,
- unsigned n_bind_mounts,
+ size_t n_bind_mounts,
const TemporaryFileSystem *temporary_filesystems,
- unsigned n_temporary_filesystems,
+ size_t n_temporary_filesystems,
const char *tmp_dir,
const char *var_tmp_dir,
ProtectHome protect_home,
ProtectSystem protect_system_from_string(const char *s) _pure_;
ProtectSystem parse_protect_system_or_bool(const char *s);
-void bind_mount_free_many(BindMount *b, unsigned n);
-int bind_mount_add(BindMount **b, unsigned *n, const BindMount *item);
+void bind_mount_free_many(BindMount *b, size_t n);
+int bind_mount_add(BindMount **b, size_t *n, const BindMount *item);
-void temporary_filesystem_free_many(TemporaryFileSystem *t, unsigned n);
-int temporary_filesystem_add(TemporaryFileSystem **t, unsigned *n,
+void temporary_filesystem_free_many(TemporaryFileSystem *t, size_t n);
+int temporary_filesystem_add(TemporaryFileSystem **t, size_t *n,
const char *path, const char *options);
const char* namespace_type_to_string(NamespaceType t) _const_;
if (s->n_fd_store_max > 0)
fprintf(f,
"%sFile Descriptor Store Max: %u\n"
- "%sFile Descriptor Store Current: %u\n",
+ "%sFile Descriptor Store Current: %zu\n",
prefix, s->n_fd_store_max,
prefix, s->n_fd_store);
NotifyState notify_state;
ServiceFDStore *fd_store;
- unsigned n_fd_store;
+ size_t n_fd_store;
unsigned n_fd_store_max;
unsigned n_keep_fd_store;
static int usbffs_dispatch_eps(SocketPort *p) {
_cleanup_free_ struct dirent **ent = NULL;
- int r, i, n, k;
+ size_t n, k, i;
+ int r;
r = scandir(p->path, &ent, usbffs_select_ep, alphasort);
if (r < 0)
return -errno;
- n = r;
+ n = (size_t) r;
p->auxiliary_fds = new(int, n);
if (!p->auxiliary_fds)
return -ENOMEM;
if (r < 0)
goto fail;
- p->auxiliary_fds[k] = r;
-
- ++k;
+ p->auxiliary_fds[k++] = r;
free(ent[i]);
}
}
int socket_collect_fds(Socket *s, int **fds) {
- int *rfds, k = 0, n = 0;
+ size_t k = 0, n = 0;
SocketPort *p;
+ int *rfds;
assert(s);
assert(fds);
return -ENOMEM;
LIST_FOREACH(port, p, s->ports) {
- int i;
+ size_t i;
if (p->fd >= 0)
rfds[k++] = p->fd;
assert(k == n);
*fds = rfds;
- return n;
+ return (int) n;
}
static void socket_reset_failed(Unit *u) {
SocketType type;
int fd;
int *auxiliary_fds;
- int n_auxiliary_fds;
+ size_t n_auxiliary_fds;
SocketAddress address;
char *path;
}
static int show_menu(char **x, unsigned n_columns, unsigned width, unsigned percentage) {
- unsigned n, per_column, i, j;
unsigned break_lines, break_modulo;
+ size_t n, per_column, i, j;
assert(n_columns > 0);
if (!e)
return log_oom();
- printf("%4u) %-*s", j * per_column + i + 1, width, e);
+ printf("%4zu) %-*s", j * per_column + i + 1, width, e);
}
putchar('\n');
}
}
-static void write_to_journal(Server *s, uid_t uid, struct iovec *iovec, unsigned n, int priority) {
+static void write_to_journal(Server *s, uid_t uid, struct iovec *iovec, size_t n, int priority) {
bool vacuumed = false, rotate = false;
struct dual_timestamp ts;
JournalFile *f;
}
if (vacuumed || !shall_try_append_again(f, r)) {
- log_error_errno(r, "Failed to write entry (%d items, %zu bytes), ignoring: %m", n, IOVEC_TOTAL_SIZE(iovec, n));
+ log_error_errno(r, "Failed to write entry (%zu items, %zu bytes), ignoring: %m", n, IOVEC_TOTAL_SIZE(iovec, n));
return;
}
log_debug("Retrying write.");
r = journal_file_append_entry(f, &ts, iovec, n, &s->seqnum, NULL, NULL);
if (r < 0)
- log_error_errno(r, "Failed to write entry (%d items, %zu bytes) despite vacuuming, ignoring: %m", n, IOVEC_TOTAL_SIZE(iovec, n));
+ log_error_errno(r, "Failed to write entry (%zu items, %zu bytes) despite vacuuming, ignoring: %m", n, IOVEC_TOTAL_SIZE(iovec, n));
else
server_schedule_sync(s, priority);
}
struct iovec iovec;
ssize_t n;
int *fds = NULL, v = 0;
- unsigned n_fds = 0;
+ size_t n_fds = 0;
union {
struct cmsghdr cmsghdr;
/* If the patterns begin with "!", edit it out and negate the test. */
if (raw_patterns[0][0] == '!') {
char **patterns;
- unsigned i, length;
+ size_t i, length;
length = strv_length(raw_patterns) + 1; /* Include the NULL. */
patterns = newa(char*, length);
}
int sd_dhcp_lease_get_search_domains(sd_dhcp_lease *lease, char ***domains) {
- unsigned r;
+ size_t r;
assert_return(lease, -EINVAL);
assert_return(domains, -EINVAL);
uint64_t creds_mask;
int *fds;
- unsigned n_fds;
+ size_t n_fds;
char *exec_path;
char **exec_argv;
size_t footer_accessible,
size_t message_size,
int *fds,
- unsigned n_fds,
+ size_t n_fds,
const char *label,
size_t extra,
sd_bus_message **ret) {
void *buffer,
size_t length,
int *fds,
- unsigned n_fds,
+ size_t n_fds,
const char *label,
sd_bus_message **ret) {
_public_ int sd_bus_message_append_string_iovec(
sd_bus_message *m,
const struct iovec *iov,
- unsigned n) {
+ unsigned n /* should be size_t, but is API now… 😞 */) {
size_t size;
unsigned i;
sd_bus_message *m,
char type,
const struct iovec *iov,
- unsigned n) {
+ unsigned n /* should be size_t, but is API now… 😞 */) {
size_t size;
unsigned i;
int bus_message_get_blob(sd_bus_message *m, void **buffer, size_t *sz) {
size_t total;
void *p, *e;
- unsigned i;
+ size_t i;
struct bus_body_part *part;
assert(m);
size_t footer_accessible,
size_t message_size,
int *fds,
- unsigned n_fds,
+ size_t n_fds,
const char *label,
size_t extra,
sd_bus_message **ret);
void *buffer,
size_t length,
int *fds,
- unsigned n_fds,
+ size_t n_fds,
const char *label,
sd_bus_message **ret);
return -ENOMEM;
strv_uniq(a);
- r = strv_length(a);
+ r = (int) strv_length(a);
if (array)
*array = a;
}
}
- r = strv_length(a);
+ r = (int) strv_length(a);
if (sessions)
*sessions = TAKE_PTR(a);
return -ENOMEM;
strv_uniq(a);
- r = strv_length(a);
+ r = (int) strv_length(a);
*ret = TAKE_PTR(a);
return -ENOMEM;
strv_uniq(a);
- r = strv_length(a);
+ r = (int) strv_length(a);
*ret = TAKE_PTR(a);
_cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL, *reply = NULL;
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
UnitFileChange *changes = NULL;
- unsigned n_changes = 0;
+ size_t n_changes = 0;
int carries_install_info = 0;
const char *method = NULL;
sd_bus *bus = userdata;
return dispatch_verb(argc, argv, verbs, bus);
}
-static int translate(const char *verb, const char *single_arg, unsigned num_args, char **args, sd_bus *bus) {
+static int translate(const char *verb, const char *single_arg, size_t num_args, char **args, sd_bus *bus) {
char **fake, **p;
- unsigned num, i;
+ size_t num, i;
assert(verb);
assert(num_args == 0 || args);
*p++ = args[i];
optind = 0;
- return native_main(num, fake, bus);
+ return native_main((int) num, fake, bus);
}
static int compat_main(int argc, char *argv[], sd_bus *bus) {
#include "resolved-dns-dnssec.h"
#include "string-util.h"
-DnsAnswer *dns_answer_new(unsigned n) {
+DnsAnswer *dns_answer_new(size_t n) {
DnsAnswer *a;
a = malloc0(offsetof(DnsAnswer, items) + sizeof(DnsAnswerItem) * n);
}
int dns_answer_add(DnsAnswer *a, DnsResourceRecord *rr, int ifindex, DnsAnswerFlags flags) {
- unsigned i;
+ size_t i;
int r;
assert(rr);
int dns_answer_remove_by_key(DnsAnswer **a, const DnsResourceKey *key) {
bool found = false, other = false;
DnsResourceRecord *rr;
- unsigned i;
+ size_t i;
int r;
assert(a);
int dns_answer_remove_by_rr(DnsAnswer **a, DnsResourceRecord *rm) {
bool found = false, other = false;
DnsResourceRecord *rr;
- unsigned i;
+ size_t i;
int r;
assert(a);
void dns_answer_order_by_scope(DnsAnswer *a, bool prefer_link_local) {
DnsAnswerItem *items;
- unsigned i, start, end;
+ size_t i, start, end;
if (!a)
return;
memcpy(a->items, items, sizeof(DnsAnswerItem) * a->n_rrs);
}
-int dns_answer_reserve(DnsAnswer **a, unsigned n_free) {
+int dns_answer_reserve(DnsAnswer **a, size_t n_free) {
DnsAnswer *n;
assert(a);
return 0;
if (*a) {
- unsigned ns;
+ size_t ns;
if ((*a)->n_ref > 1)
return -EBUSY;
return 0;
}
-int dns_answer_reserve_or_clone(DnsAnswer **a, unsigned n_free) {
+int dns_answer_reserve_or_clone(DnsAnswer **a, size_t n_free) {
_cleanup_(dns_answer_unrefp) DnsAnswer *n = NULL;
int r;
struct DnsAnswer {
unsigned n_ref;
- unsigned n_rrs, n_allocated;
+ size_t n_rrs, n_allocated;
DnsAnswerItem items[0];
};
-DnsAnswer *dns_answer_new(unsigned n);
+DnsAnswer *dns_answer_new(size_t n);
DnsAnswer *dns_answer_ref(DnsAnswer *a);
DnsAnswer *dns_answer_unref(DnsAnswer *a);
void dns_answer_order_by_scope(DnsAnswer *a, bool prefer_link_local);
-int dns_answer_reserve(DnsAnswer **a, unsigned n_free);
-int dns_answer_reserve_or_clone(DnsAnswer **a, unsigned n_free);
+int dns_answer_reserve(DnsAnswer **a, size_t n_free);
+int dns_answer_reserve_or_clone(DnsAnswer **a, size_t n_free);
int dns_answer_remove_by_key(DnsAnswer **a, const DnsResourceKey *key);
int dns_answer_remove_by_rr(DnsAnswer **a, DnsResourceRecord *rr);
bool dns_answer_has_dname_for_cname(DnsAnswer *a, DnsResourceRecord *cname);
-static inline unsigned dns_answer_size(DnsAnswer *a) {
+static inline size_t dns_answer_size(DnsAnswer *a) {
return a ? a->n_rrs : 0;
}
DEFINE_TRIVIAL_CLEANUP_FUNC(DnsAnswer*, dns_answer_unref);
#define _DNS_ANSWER_FOREACH(q, kk, a) \
- for (unsigned UNIQ_T(i, q) = ({ \
+ for (size_t UNIQ_T(i, q) = ({ \
(kk) = ((a) && (a)->n_rrs > 0) ? (a)->items[0].rr : NULL; \
0; \
}); \
#define DNS_ANSWER_FOREACH(kk, a) _DNS_ANSWER_FOREACH(UNIQ, kk, a)
#define _DNS_ANSWER_FOREACH_IFINDEX(q, kk, ifi, a) \
- for (unsigned UNIQ_T(i, q) = ({ \
+ for (size_t UNIQ_T(i, q) = ({ \
(kk) = ((a) && (a)->n_rrs > 0) ? (a)->items[0].rr : NULL; \
(ifi) = ((a) && (a)->n_rrs > 0) ? (a)->items[0].ifindex : 0; \
0; \
#define DNS_ANSWER_FOREACH_IFINDEX(kk, ifindex, a) _DNS_ANSWER_FOREACH_IFINDEX(UNIQ, kk, ifindex, a)
#define _DNS_ANSWER_FOREACH_FLAGS(q, kk, fl, a) \
- for (unsigned UNIQ_T(i, q) = ({ \
+ for (size_t UNIQ_T(i, q) = ({ \
(kk) = ((a) && (a)->n_rrs > 0) ? (a)->items[0].rr : NULL; \
(fl) = ((a) && (a)->n_rrs > 0) ? (a)->items[0].flags : 0; \
0; \
#define DNS_ANSWER_FOREACH_FLAGS(kk, flags, a) _DNS_ANSWER_FOREACH_FLAGS(UNIQ, kk, flags, a)
#define _DNS_ANSWER_FOREACH_FULL(q, kk, ifi, fl, a) \
- for (unsigned UNIQ_T(i, q) = ({ \
+ for (size_t UNIQ_T(i, q) = ({ \
(kk) = ((a) && (a)->n_rrs > 0) ? (a)->items[0].rr : NULL; \
(ifi) = ((a) && (a)->n_rrs > 0) ? (a)->items[0].ifindex : 0; \
(fl) = ((a) && (a)->n_rrs > 0) ? (a)->items[0].flags : 0; \
#include "dns-type.h"
#include "resolved-dns-question.h"
-DnsQuestion *dns_question_new(unsigned n) {
+DnsQuestion *dns_question_new(size_t n) {
DnsQuestion *q;
assert(n > 0);
assert(q->n_ref > 0);
if (q->n_ref == 1) {
- unsigned i;
+ size_t i;
for (i = 0; i < q->n_keys; i++)
dns_resource_key_unref(q->keys[i]);
}
int dns_question_add(DnsQuestion *q, DnsResourceKey *key) {
- unsigned i;
+ size_t i;
int r;
assert(key);
}
int dns_question_matches_rr(DnsQuestion *q, DnsResourceRecord *rr, const char *search_domain) {
- unsigned i;
+ size_t i;
int r;
assert(rr);
}
int dns_question_matches_cname_or_dname(DnsQuestion *q, DnsResourceRecord *rr, const char *search_domain) {
- unsigned i;
+ size_t i;
int r;
assert(rr);
int dns_question_is_valid_for_query(DnsQuestion *q) {
const char *name;
- unsigned i;
+ size_t i;
int r;
if (!q)
}
int dns_question_contains(DnsQuestion *a, const DnsResourceKey *k) {
- unsigned j;
+ size_t j;
int r;
assert(k);
}
int dns_question_is_equal(DnsQuestion *a, DnsQuestion *b) {
- unsigned j;
+ size_t j;
int r;
if (a == b)
struct DnsQuestion {
unsigned n_ref;
- unsigned n_keys, n_allocated;
+ size_t n_keys, n_allocated;
DnsResourceKey* keys[0];
};
-DnsQuestion *dns_question_new(unsigned n);
+DnsQuestion *dns_question_new(size_t n);
DnsQuestion *dns_question_ref(DnsQuestion *q);
DnsQuestion *dns_question_unref(DnsQuestion *q);
const char *dns_question_first_name(DnsQuestion *q);
-static inline unsigned dns_question_size(DnsQuestion *q) {
+static inline size_t dns_question_size(DnsQuestion *q) {
return q ? q->n_keys : 0;
}
DEFINE_TRIVIAL_CLEANUP_FUNC(DnsQuestion*, dns_question_unref);
#define _DNS_QUESTION_FOREACH(u, key, q) \
- for (unsigned UNIQ_T(i, u) = ({ \
+ for (size_t UNIQ_T(i, u) = ({ \
(key) = ((q) && (q)->n_keys > 0) ? (q)->keys[0] : NULL; \
0; \
}); \
assert(ret_rrs);
assert_return(DNS_PACKET_NSCOUNT(p) > 0, -EINVAL);
- for (unsigned i = DNS_PACKET_ANCOUNT(p); i < (DNS_PACKET_ANCOUNT(p) + DNS_PACKET_NSCOUNT(p)); i++) {
+ for (size_t i = DNS_PACKET_ANCOUNT(p); i < (DNS_PACKET_ANCOUNT(p) + DNS_PACKET_NSCOUNT(p)); i++) {
r = dns_resource_key_match_rr(key, p->answer->items[i].rr, NULL);
if (r < 0)
return r;
if (!list)
return -ENOMEM;
- for (unsigned i = DNS_PACKET_ANCOUNT(p); i < (DNS_PACKET_ANCOUNT(p) + DNS_PACKET_NSCOUNT(p)); i++) {
+ for (size_t i = DNS_PACKET_ANCOUNT(p); i < (DNS_PACKET_ANCOUNT(p) + DNS_PACKET_NSCOUNT(p)); i++) {
r = dns_resource_key_match_rr(key, p->answer->items[i].rr, NULL);
if (r < 0)
return r;
static int mdns_do_tiebreak(DnsResourceKey *key, DnsAnswer *answer, DnsPacket *p) {
_cleanup_free_ DnsResourceRecord **our = NULL, **remote = NULL;
DnsResourceRecord *rr;
- unsigned i = 0;
- unsigned size;
+ size_t i = 0, size;
int r;
size = dns_answer_size(answer);
int base_filesystem_create(const char *root, uid_t uid, gid_t gid) {
_cleanup_close_ int fd = -1;
- unsigned i;
int r = 0;
+ size_t i;
fd = open(root, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW);
if (fd < 0)
}
void boot_config_free(BootConfig *config) {
- unsigned i;
+ size_t i;
assert(config);
}
static bool find_nonunique(BootEntry *entries, size_t n_entries, bool *arr) {
- unsigned i, j;
+ size_t i, j;
bool non_unique = false;
assert(entries || n_entries == 0);
static int boot_entries_uniquify(BootEntry *entries, size_t n_entries) {
char *s;
- unsigned i;
+ size_t i;
int r;
bool arr[n_entries];
return bus_wait_for_jobs(d, quiet, NULL);
}
-int bus_deserialize_and_dump_unit_file_changes(sd_bus_message *m, bool quiet, UnitFileChange **changes, unsigned *n_changes) {
+int bus_deserialize_and_dump_unit_file_changes(sd_bus_message *m, bool quiet, UnitFileChange **changes, size_t *n_changes) {
const char *type, *path, *source;
int r;
DEFINE_TRIVIAL_CLEANUP_FUNC(BusWaitForJobs*, bus_wait_for_jobs_free);
-int bus_deserialize_and_dump_unit_file_changes(sd_bus_message *m, bool quiet, UnitFileChange **changes, unsigned *n_changes);
+int bus_deserialize_and_dump_unit_file_changes(sd_bus_message *m, bool quiet, UnitFileChange **changes, size_t *n_changes);
int unit_show_processes(sd_bus *bus, const char *unit, const char *cgroup_path, const char *prefix, unsigned n_columns, OutputFlags flags, sd_bus_error *error);
return MAKE_FDSET(set_new(NULL));
}
-int fdset_new_array(FDSet **ret, const int *fds, unsigned n_fds) {
- unsigned i;
+int fdset_new_array(FDSet **ret, const int *fds, size_t n_fds) {
+ size_t i;
FDSet *s;
int r;
void *e;
Iterator i;
int *a;
- unsigned j, m;
+ size_t j = 0, m;
- j = 0, m = fdset_size(fds);
- a = alloca(sizeof(int) * m);
+ m = fdset_size(fds);
+ a = newa(int, m);
SET_FOREACH(e, MAKE_SET(fds), i)
a[j++] = PTR_TO_FD(e);
bool fdset_contains(FDSet *s, int fd);
int fdset_remove(FDSet *s, int fd);
-int fdset_new_array(FDSet **ret, const int *fds, unsigned n_fds);
+int fdset_new_array(FDSet **ret, const int *fds, size_t n_fds);
int fdset_new_fill(FDSet **ret);
int fdset_new_listen_fds(FDSet **ret, bool unset);
int unit_file_changes_add(
UnitFileChange **changes,
- unsigned *n_changes,
+ size_t *n_changes,
UnitFileChangeType type,
const char *path,
const char *source) {
return 0;
}
-void unit_file_changes_free(UnitFileChange *changes, unsigned n_changes) {
- unsigned i;
+void unit_file_changes_free(UnitFileChange *changes, size_t n_changes) {
+ size_t i;
assert(changes || n_changes == 0);
free(changes);
}
-void unit_file_dump_changes(int r, const char *verb, const UnitFileChange *changes, unsigned n_changes, bool quiet) {
- unsigned i;
+void unit_file_dump_changes(int r, const char *verb, const UnitFileChange *changes, size_t n_changes, bool quiet) {
+ size_t i;
bool logged = false;
assert(changes || n_changes == 0);
const char *new_path,
bool force,
UnitFileChange **changes,
- unsigned *n_changes) {
+ size_t *n_changes) {
_cleanup_free_ char *dest = NULL, *dirname = NULL;
const char *rp;
bool dry_run,
bool *restart,
UnitFileChange **changes,
- unsigned *n_changes) {
+ size_t *n_changes) {
_cleanup_closedir_ DIR *d = NULL;
struct dirent *de;
const LookupPaths *lp,
bool dry_run,
UnitFileChange **changes,
- unsigned *n_changes) {
+ size_t *n_changes) {
_cleanup_close_ int fd = -1;
bool restart;
UnitFileInstallInfo *i,
const LookupPaths *paths,
UnitFileChange **changes,
- unsigned *n_changes) {
+ size_t *n_changes) {
assert(i);
assert(paths);
SearchFlags flags,
UnitFileInstallInfo **ret,
UnitFileChange **changes,
- unsigned *n_changes) {
+ size_t *n_changes) {
UnitFileInstallInfo *i;
int r;
const char *config_path,
bool force,
UnitFileChange **changes,
- unsigned *n_changes) {
+ size_t *n_changes) {
char **s;
int r = 0, q;
char **list,
const char *suffix,
UnitFileChange **changes,
- unsigned *n_changes) {
+ size_t *n_changes) {
_cleanup_free_ char *buf = NULL;
const char *n;
const char *config_path,
bool force,
UnitFileChange **changes,
- unsigned *n_changes) {
+ size_t *n_changes) {
_cleanup_free_ char *path = NULL;
int r;
const char *config_path,
bool force,
UnitFileChange **changes,
- unsigned *n_changes) {
+ size_t *n_changes) {
int r, q;
bool force,
SearchFlags flags,
UnitFileChange **changes,
- unsigned *n_changes) {
+ size_t *n_changes) {
UnitFileInstallInfo *i;
int r;
Set **remove_symlinks_to,
const char *config_path,
UnitFileChange **changes,
- unsigned *n_changes) {
+ size_t *n_changes) {
UnitFileInstallInfo *i;
int r;
const char *root_dir,
char **files,
UnitFileChange **changes,
- unsigned *n_changes) {
+ size_t *n_changes) {
_cleanup_(lookup_paths_free) LookupPaths paths = {};
const char *config_path;
const char *root_dir,
char **files,
UnitFileChange **changes,
- unsigned *n_changes) {
+ size_t *n_changes) {
_cleanup_(lookup_paths_free) LookupPaths paths = {};
_cleanup_set_free_free_ Set *remove_symlinks_to = NULL;
const char *root_dir,
char **files,
UnitFileChange **changes,
- unsigned *n_changes) {
+ size_t *n_changes) {
_cleanup_(lookup_paths_free) LookupPaths paths = {};
_cleanup_strv_free_ char **todo = NULL;
const char *root_dir,
char **files,
UnitFileChange **changes,
- unsigned *n_changes) {
+ size_t *n_changes) {
_cleanup_set_free_free_ Set *remove_symlinks_to = NULL;
_cleanup_(lookup_paths_free) LookupPaths paths = {};
const char *target,
UnitDependency dep,
UnitFileChange **changes,
- unsigned *n_changes) {
+ size_t *n_changes) {
_cleanup_(lookup_paths_free) LookupPaths paths = {};
_cleanup_(install_context_done) InstallContext c = {};
const char *root_dir,
char **files,
UnitFileChange **changes,
- unsigned *n_changes) {
+ size_t *n_changes) {
_cleanup_(lookup_paths_free) LookupPaths paths = {};
_cleanup_(install_context_done) InstallContext c = {};
const char *root_dir,
char **files,
UnitFileChange **changes,
- unsigned *n_changes) {
+ size_t *n_changes) {
_cleanup_(lookup_paths_free) LookupPaths paths = {};
_cleanup_(install_context_done) InstallContext c = {};
const char *root_dir,
char **files,
UnitFileChange **changes,
- unsigned *n_changes) {
+ size_t *n_changes) {
char **n;
int r;
const char *root_dir,
const char *name,
UnitFileChange **changes,
- unsigned *n_changes) {
+ size_t *n_changes) {
_cleanup_(lookup_paths_free) LookupPaths paths = {};
_cleanup_(install_context_done) InstallContext c = {};
UnitFilePresetMode mode,
bool force,
UnitFileChange **changes,
- unsigned *n_changes) {
+ size_t *n_changes) {
int r;
const char *name,
Presets presets,
UnitFileChange **changes,
- unsigned *n_changes) {
+ size_t *n_changes) {
_cleanup_(install_context_done) InstallContext tmp = {};
UnitFileInstallInfo *i;
char **files,
UnitFilePresetMode mode,
UnitFileChange **changes,
- unsigned *n_changes) {
+ size_t *n_changes) {
_cleanup_(install_context_done) InstallContext plus = {}, minus = {};
_cleanup_(lookup_paths_free) LookupPaths paths = {};
const char *root_dir,
UnitFilePresetMode mode,
UnitFileChange **changes,
- unsigned *n_changes) {
+ size_t *n_changes) {
_cleanup_(install_context_done) InstallContext plus = {}, minus = {};
_cleanup_(lookup_paths_free) LookupPaths paths = {};
char *source;
};
-static inline bool unit_file_changes_have_modification(const UnitFileChange* changes, unsigned n_changes) {
- unsigned i;
+static inline bool unit_file_changes_have_modification(const UnitFileChange* changes, size_t n_changes) {
+ size_t i;
for (i = 0; i < n_changes; i++)
if (IN_SET(changes[i].type, UNIT_FILE_SYMLINK, UNIT_FILE_UNLINK))
return true;
const char *root_dir,
char **files,
UnitFileChange **changes,
- unsigned *n_changes);
+ size_t *n_changes);
int unit_file_disable(
UnitFileScope scope,
UnitFileFlags flags,
const char *root_dir,
char **files,
UnitFileChange **changes,
- unsigned *n_changes);
+ size_t *n_changes);
int unit_file_reenable(
UnitFileScope scope,
UnitFileFlags flags,
const char *root_dir,
char **files,
UnitFileChange **changes,
- unsigned *n_changes);
+ size_t *n_changes);
int unit_file_preset(
UnitFileScope scope,
UnitFileFlags flags,
char **files,
UnitFilePresetMode mode,
UnitFileChange **changes,
- unsigned *n_changes);
+ size_t *n_changes);
int unit_file_preset_all(
UnitFileScope scope,
UnitFileFlags flags,
const char *root_dir,
UnitFilePresetMode mode,
UnitFileChange **changes,
- unsigned *n_changes);
+ size_t *n_changes);
int unit_file_mask(
UnitFileScope scope,
UnitFileFlags flags,
const char *root_dir,
char **files,
UnitFileChange **changes,
- unsigned *n_changes);
+ size_t *n_changes);
int unit_file_unmask(
UnitFileScope scope,
UnitFileFlags flags,
const char *root_dir,
char **files,
UnitFileChange **changes,
- unsigned *n_changes);
+ size_t *n_changes);
int unit_file_link(
UnitFileScope scope,
UnitFileFlags flags,
const char *root_dir,
char **files,
UnitFileChange **changes,
- unsigned *n_changes);
+ size_t *n_changes);
int unit_file_revert(
UnitFileScope scope,
const char *root_dir,
char **files,
UnitFileChange **changes,
- unsigned *n_changes);
+ size_t *n_changes);
int unit_file_set_default(
UnitFileScope scope,
UnitFileFlags flags,
const char *root_dir,
const char *file,
UnitFileChange **changes,
- unsigned *n_changes);
+ size_t *n_changes);
int unit_file_get_default(
UnitFileScope scope,
const char *root_dir,
const char *target,
UnitDependency dep,
UnitFileChange **changes,
- unsigned *n_changes);
+ size_t *n_changes);
int unit_file_get_state(UnitFileScope scope, const char *root_dir, const char *filename, UnitFileState *ret);
int unit_file_exists(UnitFileScope scope, const LookupPaths *paths, const char *name);
int unit_file_get_list(UnitFileScope scope, const char *root_dir, Hashmap *h, char **states, char **patterns);
Hashmap* unit_file_list_free(Hashmap *h);
-int unit_file_changes_add(UnitFileChange **changes, unsigned *n_changes, UnitFileChangeType type, const char *path, const char *source);
-void unit_file_changes_free(UnitFileChange *changes, unsigned n_changes);
-void unit_file_dump_changes(int r, const char *verb, const UnitFileChange *changes, unsigned n_changes, bool quiet);
+int unit_file_changes_add(UnitFileChange **changes, size_t *n_changes, UnitFileChangeType type, const char *path, const char *source);
+void unit_file_changes_free(UnitFileChange *changes, size_t n_changes);
+void unit_file_dump_changes(int r, const char *verb, const UnitFileChange *changes, size_t n_changes, bool quiet);
int unit_file_query_preset(UnitFileScope scope, const char *root_dir, const char *name);
int lookup_paths_reduce(LookupPaths *p) {
_cleanup_free_ struct stat *stats = NULL;
size_t n_stats = 0, allocated = 0;
- unsigned c = 0;
+ size_t c = 0;
int r;
assert(p);
while (p->search_path[c]) {
struct stat st;
- unsigned k;
+ size_t k;
/* Never strip the transient and control directories from the path */
if (path_equal_ptr(p->search_path[c], p->transient) ||
static int set_default(int argc, char *argv[], void *userdata) {
_cleanup_free_ char *unit = NULL;
UnitFileChange *changes = NULL;
- unsigned n_changes = 0;
+ size_t n_changes = 0;
int r;
assert(argc >= 2);
_cleanup_strv_free_ char **names = NULL;
const char *verb = argv[0];
UnitFileChange *changes = NULL;
- unsigned n_changes = 0;
+ size_t n_changes = 0;
int carries_install_info = -1;
bool ignore_carries_install_info = arg_quiet;
int r;
if (arg_now && STR_IN_SET(argv[0], "enable", "disable", "mask")) {
sd_bus *bus;
- unsigned len, i;
+ size_t len, i;
r = acquire_bus(BUS_MANAGER, &bus);
if (r < 0)
_cleanup_free_ char *target = NULL;
const char *verb = argv[0];
UnitFileChange *changes = NULL;
- unsigned n_changes = 0;
+ size_t n_changes = 0;
UnitDependency dep;
int r = 0;
static int preset_all(int argc, char *argv[], void *userdata) {
UnitFileChange *changes = NULL;
- unsigned n_changes = 0;
+ size_t n_changes = 0;
int r;
if (install_client_side()) {
static int show_installation_targets_client_side(const char *name) {
UnitFileChange *changes = NULL;
- unsigned n_changes = 0, i;
+ size_t n_changes = 0, i;
UnitFileFlags flags;
char **p;
int r;
const char **args;
char *editor, **editor_args = NULL;
char **tmp_path, **original_path, *p;
- unsigned n_editor_args = 0, i = 1;
+ size_t n_editor_args = 0, i = 1;
size_t argc;
argc = strv_length(paths)/2 + 1;
const char *p;
UnitFileState state;
UnitFileChange *changes = NULL;
- unsigned n_changes = 0;
+ size_t n_changes = 0;
log_set_max_level(LOG_DEBUG);
const char *p, *q;
UnitFileState state;
UnitFileChange *changes = NULL;
- unsigned n_changes = 0, i;
+ size_t n_changes = 0, i;
/*
* We'll test three cases here:
static void test_default(const char *root) {
_cleanup_free_ char *def = NULL;
UnitFileChange *changes = NULL;
- unsigned n_changes = 0;
+ size_t n_changes = 0;
const char *p;
p = strjoina(root, "/usr/lib/systemd/system/test-default-real.target");
static void test_add_dependency(const char *root) {
UnitFileChange *changes = NULL;
- unsigned n_changes = 0;
+ size_t n_changes = 0;
const char *p;
p = strjoina(root, "/usr/lib/systemd/system/real-add-dependency-test-target.target");
static void test_template_enable(const char *root) {
UnitFileChange *changes = NULL;
- unsigned n_changes = 0;
+ size_t n_changes = 0;
UnitFileState state;
const char *p;
static void test_indirect(const char *root) {
UnitFileChange *changes = NULL;
- unsigned n_changes = 0;
+ size_t n_changes = 0;
UnitFileState state;
const char *p;
static void test_preset_and_list(const char *root) {
UnitFileChange *changes = NULL;
- unsigned n_changes = 0, i;
+ size_t n_changes = 0, i;
const char *p, *q;
UnitFileState state;
bool got_yes = false, got_no = false;
const char *p;
UnitFileState state;
UnitFileChange *changes = NULL;
- unsigned n_changes = 0;
+ size_t n_changes = 0;
assert(root);
static void test_preset_order(const char *root) {
UnitFileChange *changes = NULL;
- unsigned n_changes = 0;
+ size_t n_changes = 0;
const char *p;
UnitFileState state;
const char *p;
UnitFileState state;
UnitFileChange *changes = NULL;
- unsigned n_changes = 0;
+ size_t n_changes = 0;
assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "with-dropin-1.service", &state) == -ENOENT);
assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "with-dropin-2.service", &state) == -ENOENT);
const char *p;
UnitFileState state;
UnitFileChange *changes = NULL;
- unsigned n_changes = 0;
+ size_t n_changes = 0;
assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "with-dropin-1@.service", &state) == -ENOENT);
assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root, "with-dropin-2@.service", &state) == -ENOENT);
const char *const files[] = { "avahi-daemon.service", NULL };
const char *const files2[] = { "/home/lennart/test.service", NULL };
UnitFileChange *changes = NULL;
- unsigned n_changes = 0;
+ size_t n_changes = 0;
UnitFileState state = 0;
log_set_max_level(LOG_DEBUG);