Lines Matching refs:fds

112 static int shift_fds(int fds[], size_t n_fds) {  in shift_fds()  argument
118 assert(fds); in shift_fds()
127 if (fds[i] == i+3) in shift_fds()
130 nfd = fcntl(fds[i], F_DUPFD, i + 3); in shift_fds()
134 safe_close(fds[i]); in shift_fds()
135 fds[i] = nfd; in shift_fds()
152 static int flags_fds(const int fds[], size_t n_socket_fds, size_t n_storage_fds, bool nonblock) { in flags_fds() argument
160 assert(fds); in flags_fds()
168 r = fd_nonblock(fds[i], nonblock); in flags_fds()
177 r = fd_cloexec(fds[i], false); in flags_fds()
1175 const int fds[], size_t n_fds) { in setup_pam() argument
1276 (void) close_many(fds, n_fds); in setup_pam()
3876 const int *fds, size_t n_fds) { in close_remaining_fds() argument
3893 memcpy(dont_close + n_dont_close, fds, sizeof(int) * n_fds); in close_remaining_fds()
4066 static int add_shifted_fd(int *fds, size_t fds_size, size_t *n_fds, int fd, int *ret_fd) { in add_shifted_fd() argument
4069 assert(fds); in add_shifted_fd()
4090 *ret_fd = fds[*n_fds] = fd; in add_shifted_fd()
4104 int *fds, in exec_child() argument
4187 memcpy_safe(keep_fds, fds, n_fds * sizeof(int)); in exec_child()
4647 … r = setup_pam(context->pam_name, username, uid, gid, context->tty_path, &accum_env, fds, n_fds); in exec_child()
4810 fd = params->fds[0]; in exec_child()
4831 r = shift_fds(fds, n_fds); in exec_child()
4833 r = flags_fds(fds, n_socket_fds, n_storage_fds, context->non_blocking); in exec_child()
5176 int socket_fd, r, named_iofds[3] = { -1, -1, -1 }, *fds = NULL; in exec_spawn() local
5188 assert(params->fds || (params->n_socket_fds + params->n_storage_fds <= 0)); in exec_spawn()
5200 socket_fd = params->fds[0]; in exec_spawn()
5203 fds = params->fds; in exec_spawn()
5262 fds, in exec_spawn()
5578 named_iofds[STDIN_FILENO] = p->fds[i]; in exec_context_named_iofds()
5586 named_iofds[STDOUT_FILENO] = p->fds[i]; in exec_context_named_iofds()
5594 named_iofds[STDERR_FILENO] = p->fds[i]; in exec_context_named_iofds()
6735 int exec_runtime_serialize(const Manager *m, FILE *f, FDSet *fds) { in exec_runtime_serialize() argument
6740 assert(fds); in exec_runtime_serialize()
6754 copy = fdset_put_dup(fds, rt->netns_storage_socket[0]); in exec_runtime_serialize()
6764 copy = fdset_put_dup(fds, rt->netns_storage_socket[1]); in exec_runtime_serialize()
6774 copy = fdset_put_dup(fds, rt->ipcns_storage_socket[0]); in exec_runtime_serialize()
6784 copy = fdset_put_dup(fds, rt->ipcns_storage_socket[1]); in exec_runtime_serialize()
6797 int exec_runtime_deserialize_compat(Unit *u, const char *key, const char *value, FDSet *fds) { in exec_runtime_deserialize_compat() argument
6840 if (safe_atoi(value, &fd) < 0 || !fdset_contains(fds, fd)) { in exec_runtime_deserialize_compat()
6846 rt->netns_storage_socket[0] = fdset_remove(fds, fd); in exec_runtime_deserialize_compat()
6851 if (safe_atoi(value, &fd) < 0 || !fdset_contains(fds, fd)) { in exec_runtime_deserialize_compat()
6857 rt->netns_storage_socket[1] = fdset_remove(fds, fd); in exec_runtime_deserialize_compat()
6879 int exec_runtime_deserialize_one(Manager *m, const char *value, FDSet *fds) { in exec_runtime_deserialize_one() argument
6888 assert(fds); in exec_runtime_deserialize_one()
6928 if (!fdset_contains(fds, netns_fdpair[0])) in exec_runtime_deserialize_one()
6931 netns_fdpair[0] = fdset_remove(fds, netns_fdpair[0]); in exec_runtime_deserialize_one()
6947 if (!fdset_contains(fds, netns_fdpair[1])) in exec_runtime_deserialize_one()
6950 netns_fdpair[1] = fdset_remove(fds, netns_fdpair[1]); in exec_runtime_deserialize_one()
6966 if (!fdset_contains(fds, ipcns_fdpair[0])) in exec_runtime_deserialize_one()
6969 ipcns_fdpair[0] = fdset_remove(fds, ipcns_fdpair[0]); in exec_runtime_deserialize_one()
6985 if (!fdset_contains(fds, ipcns_fdpair[1])) in exec_runtime_deserialize_one()
6988 ipcns_fdpair[1] = fdset_remove(fds, ipcns_fdpair[1]); in exec_runtime_deserialize_one()
7019 p->fds = mfree(p->fds); in exec_params_clear()