Commit 8a22e343 authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Andrei Vagin

files: Do not close PROC_PID_FD_OFF sfd in prepare_fds()

Here we need to close proc self fd only, as it's not
a service fd, and it can occupy real task fd number.
Closing of PROC_PID_FD_OFF is useless action here,
because it's already occupy a service fd number.

So, we skip this excess syscall, and leave PROC_PID_FD_OFF
open.

v4: New
Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 854342a5
......@@ -1248,7 +1248,7 @@ int prepare_fds(struct pstree_item *me)
* set than its parent
*/
close_service_fd(CGROUP_YARD);
close_pid_proc(); /* flush any proc cached fds we may have */
set_proc_self_fd(-1); /* flush any proc cached fds we may have */
if (rsti(me)->fdt) {
struct fdt *fdt = rsti(me)->fdt;
......
......@@ -28,6 +28,7 @@ enum sfd_type {
struct pstree_item;
extern void set_proc_self_fd(int fd);
extern int clone_service_fd(int id);
extern int init_service_fd(void);
extern int get_service_fd(enum sfd_type type);
......
......@@ -296,7 +296,7 @@ static pid_t open_proc_pid = PROC_NONE;
static pid_t open_proc_self_pid;
static int open_proc_self_fd = -1;
static inline void set_proc_self_fd(int fd)
void set_proc_self_fd(int fd)
{
if (open_proc_self_fd >= 0)
close(open_proc_self_fd);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment