Commit 72c1c1a6 authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Andrei Vagin

files: Count inh_fd_max

This patch counts maximum of inherited fds.
The value will be used in next patch.
Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent ab36e28d
...@@ -1455,6 +1455,8 @@ struct inherit_fd { ...@@ -1455,6 +1455,8 @@ struct inherit_fd {
dev_t inh_rdev; dev_t inh_rdev;
}; };
int inh_fd_max = -1;
/* /*
* Return 1 if inherit fd has been closed or reused, 0 otherwise. * Return 1 if inherit fd has been closed or reused, 0 otherwise.
* *
...@@ -1551,6 +1553,9 @@ int inherit_fd_add(int fd, char *key) ...@@ -1551,6 +1553,9 @@ int inherit_fd_add(int fd, char *key)
if (inh == NULL) if (inh == NULL)
return -1; return -1;
if (fd > inh_fd_max)
inh_fd_max = fd;
inh->inh_id = key; inh->inh_id = key;
inh->inh_fd = fd; inh->inh_fd = fd;
inh->inh_dev = sbuf.st_dev; inh->inh_dev = sbuf.st_dev;
......
...@@ -91,6 +91,8 @@ struct fdinfo_list_entry { ...@@ -91,6 +91,8 @@ struct fdinfo_list_entry {
u8 fake:1; u8 fake:1;
}; };
extern int inh_fd_max;
/* reports whether fd_a takes prio over fd_b */ /* reports whether fd_a takes prio over fd_b */
static inline int fdinfo_rst_prio(struct fdinfo_list_entry *fd_a, struct fdinfo_list_entry *fd_b) static inline int fdinfo_rst_prio(struct fdinfo_list_entry *fd_a, struct fdinfo_list_entry *fd_b)
{ {
......
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