MINOR: fd: add a lock bit with the tgid
authorWilly Tarreau <w@1wt.eu>
Thu, 13 Apr 2023 12:27:48 +0000 (14:27 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 13 Apr 2023 14:57:51 +0000 (16:57 +0200)
commit7b44c26e136a9d215e4b102a9e9a66731666ede8
tree8992224aa7febdb76959f9a6dc2fb679b999155b
parent4d882bd80089eac21d949bdb6d10a8700fea32c6
MINOR: fd: add a lock bit with the tgid

In order to permit to migrate FDs from one thread group to another,
we'll need to be able to set a TGID that is compatible with no other
thread group. Either we use a special value or we dedicate a special
bit. Given that we already have way more bits than needed, let's just
sacrifice the topmost one to serve as a lock bit, indicating the tgid
is not valid anymore. This will make all fd_grab_tgid() fail to grab
it.

The new fd_lock_tgid() function now tries to assign a locked tgid to
an idle FD, and fd_unlock_tgid() simply drops the lock bit, revealing
the target tgid.

For now it's still unused so it must not have any effect.
include/haproxy/fd-t.h
include/haproxy/fd.h