summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilly Tarreau <w@1wt.eu>2020-08-26 11:54:06 +0200
committerWilly Tarreau <w@1wt.eu>2020-08-26 18:33:52 +0200
commit63d8b6009b6d4d352853ab84bd2be3374c87c976 (patch)
tree3fcb84f32cfa0d0561e503dee1372189abb05881
parent67672459c72328047c5b24c8a721789fef8b13d9 (diff)
downloadhaproxy-63d8b6009b6d4d352853ab84bd2be3374c87c976.tar.gz
CLEANUP: fd: remove fd_remove() and rename fd_dodelete() to fd_delete()
This essentially undoes what we did in fd.c in 1.8 to support seamless reload. Since we don't need to remove an fd anymore we can turn fd_delete() to the simple function it used to be.
-rw-r--r--include/haproxy/fd.h5
-rw-r--r--src/fd.c24
2 files changed, 3 insertions, 26 deletions
diff --git a/include/haproxy/fd.h b/include/haproxy/fd.h
index 7b77567fa..240842a18 100644
--- a/include/haproxy/fd.h
+++ b/include/haproxy/fd.h
@@ -60,11 +60,6 @@ extern volatile int ha_used_fds; // Number of FDs we're currently using
*/
void fd_delete(int fd);
-/* Deletes an FD from the fdsets.
- * The file descriptor is kept open.
- */
-void fd_remove(int fd);
-
/*
* Take over a FD belonging to another thread.
* Returns 0 on success, and -1 on failure.
diff --git a/src/fd.c b/src/fd.c
index bf2383e4d..86c2d4359 100644
--- a/src/fd.c
+++ b/src/fd.c
@@ -297,7 +297,7 @@ done:
/* Deletes an FD from the fdsets.
* The file descriptor is also closed.
*/
-static void fd_dodelete(int fd, int do_close)
+void fd_delete(int fd)
{
int locked = fdtab[fd].running_mask != tid_bit;
@@ -329,10 +329,8 @@ static void fd_dodelete(int fd, int do_close)
fdinfo[fd].port_range = NULL;
fdtab[fd].owner = NULL;
fdtab[fd].thread_mask = 0;
- if (do_close) {
- close(fd);
- _HA_ATOMIC_SUB(&ha_used_fds, 1);
- }
+ close(fd);
+ _HA_ATOMIC_SUB(&ha_used_fds, 1);
if (locked)
fd_clr_running(fd);
}
@@ -393,22 +391,6 @@ int fd_takeover(int fd, void *expected_owner)
return ret;
}
-/* Deletes an FD from the fdsets.
- * The file descriptor is also closed.
- */
-void fd_delete(int fd)
-{
- fd_dodelete(fd, 1);
-}
-
-/* Deletes an FD from the fdsets.
- * The file descriptor is kept open.
- */
-void fd_remove(int fd)
-{
- fd_dodelete(fd, 0);
-}
-
void updt_fd_polling(const int fd)
{
if ((fdtab[fd].thread_mask & all_threads_mask) == tid_bit) {