mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 23:27:04 +02:00
MINOR: fd: make fd_insert() apply the thread mask itself
It's a bit ugly to see that half of the callers of fd_insert() have to apply all_threads_mask themselves to the bit field they're passing, because usually it comes from a listener that may have other bits set. Let's make the function apply the mask itself.
This commit is contained in:
parent
8e2c0fa8e5
commit
512dd2dc1c
@ -322,7 +322,9 @@ static inline long fd_clr_running(int fd)
|
||||
return _HA_ATOMIC_AND_FETCH(&fdtab[fd].running_mask, ~tid_bit);
|
||||
}
|
||||
|
||||
/* Prepares <fd> for being polled */
|
||||
/* Prepares <fd> for being polled on all permitted threads (these will then be
|
||||
* refined to only cover running ones).
|
||||
*/
|
||||
static inline void fd_insert(int fd, void *owner, void (*iocb)(int fd), unsigned long thread_mask)
|
||||
{
|
||||
extern void sock_conn_iocb(int);
|
||||
@ -333,6 +335,8 @@ static inline void fd_insert(int fd, void *owner, void (*iocb)(int fd), unsigned
|
||||
BUG_ON(fd < 0 || fd >= global.maxsock);
|
||||
BUG_ON(fdtab[fd].owner != NULL);
|
||||
BUG_ON(fdtab[fd].state != 0);
|
||||
|
||||
thread_mask &= all_threads_mask;
|
||||
BUG_ON(thread_mask == 0);
|
||||
|
||||
fdtab[fd].owner = owner;
|
||||
|
@ -157,7 +157,7 @@ int sockpair_bind_receiver(struct receiver *rx, char **errmsg)
|
||||
|
||||
rx->flags |= RX_F_BOUND;
|
||||
|
||||
fd_insert(rx->fd, rx->owner, rx->iocb, rx->bind_thread & all_threads_mask);
|
||||
fd_insert(rx->fd, rx->owner, rx->iocb, rx->bind_thread);
|
||||
return err;
|
||||
|
||||
bind_return:
|
||||
|
@ -390,7 +390,7 @@ int sock_inet_bind_receiver(struct receiver *rx, char **errmsg)
|
||||
rx->fd = fd;
|
||||
rx->flags |= RX_F_BOUND;
|
||||
|
||||
fd_insert(fd, rx->owner, rx->iocb, rx->bind_thread & all_threads_mask);
|
||||
fd_insert(fd, rx->owner, rx->iocb, rx->bind_thread);
|
||||
|
||||
/* for now, all regularly bound TCP listeners are exportable */
|
||||
if (!(rx->flags & RX_F_INHERITED))
|
||||
|
@ -284,7 +284,7 @@ int sock_unix_bind_receiver(struct receiver *rx, char **errmsg)
|
||||
rx->fd = fd;
|
||||
rx->flags |= RX_F_BOUND;
|
||||
|
||||
fd_insert(fd, rx->owner, rx->iocb, rx->bind_thread & all_threads_mask);
|
||||
fd_insert(fd, rx->owner, rx->iocb, rx->bind_thread);
|
||||
|
||||
/* for now, all regularly bound TCP listeners are exportable */
|
||||
if (!(rx->flags & RX_F_INHERITED))
|
||||
|
Loading…
Reference in New Issue
Block a user