BUILD: pollers: use an initcall to register the pollers

Pollers are among the few remaining blocks still using constructors
to register themselves. That's not needed anymore since the initcalls
so better turn to initcalls.
This commit is contained in:
Willy Tarreau 2022-04-25 19:00:55 +02:00
parent 2df1fbf816
commit 740d749d77
5 changed files with 12 additions and 19 deletions

View File

@ -357,11 +357,8 @@ static int _do_fork(struct poller *p)
} }
/* /*
* It is a constructor, which means that it will automatically be called before * Registers the poller.
* main(). This is GCC-specific but it works at least since 2.95.
* Special care must be taken so that it does not need any uninitialized data.
*/ */
__attribute__((constructor))
static void _do_register(void) static void _do_register(void)
{ {
struct poller *p; struct poller *p;
@ -388,6 +385,8 @@ static void _do_register(void)
p->fork = _do_fork; p->fork = _do_fork;
} }
INITCALL0(STG_REGISTER, _do_register);
/* /*
* Local variables: * Local variables:

View File

@ -402,10 +402,8 @@ static int _do_fork(struct poller *p)
} }
/* /*
* This constructor must be called before main() to register the event ports * Registers the poller.
* poller.
*/ */
__attribute__((constructor))
static void _do_register(void) static void _do_register(void)
{ {
struct poller *p; struct poller *p;
@ -431,3 +429,5 @@ static void _do_register(void)
p->poll = _do_poll; p->poll = _do_poll;
p->fork = _do_fork; p->fork = _do_fork;
} }
INITCALL0(STG_REGISTER, _do_register);

View File

@ -336,11 +336,8 @@ static int _do_fork(struct poller *p)
} }
/* /*
* It is a constructor, which means that it will automatically be called before * Registers the poller.
* main(). This is GCC-specific but it works at least since 2.95.
* Special care must be taken so that it does not need any uninitialized data.
*/ */
__attribute__((constructor))
static void _do_register(void) static void _do_register(void)
{ {
struct poller *p; struct poller *p;
@ -367,6 +364,7 @@ static void _do_register(void)
p->fork = _do_fork; p->fork = _do_fork;
} }
INITCALL0(STG_REGISTER, _do_register);
/* /*
* Local variables: * Local variables:

View File

@ -316,11 +316,8 @@ static int _do_test(struct poller *p)
} }
/* /*
* It is a constructor, which means that it will automatically be called before * Registers the poller.
* main(). This is GCC-specific but it works at least since 2.95.
* Special care must be taken so that it does not need any uninitialized data.
*/ */
__attribute__((constructor))
static void _do_register(void) static void _do_register(void)
{ {
struct poller *p; struct poller *p;
@ -341,6 +338,7 @@ static void _do_register(void)
p->poll = _do_poll; p->poll = _do_poll;
} }
INITCALL0(STG_REGISTER, _do_register);
/* /*
* Local variables: * Local variables:

View File

@ -300,11 +300,8 @@ static int _do_test(struct poller *p)
} }
/* /*
* It is a constructor, which means that it will automatically be called before * Registers the poller.
* main(). This is GCC-specific but it works at least since 2.95.
* Special care must be taken so that it does not need any uninitialized data.
*/ */
__attribute__((constructor))
static void _do_register(void) static void _do_register(void)
{ {
struct poller *p; struct poller *p;
@ -325,6 +322,7 @@ static void _do_register(void)
p->poll = _do_poll; p->poll = _do_poll;
} }
INITCALL0(STG_REGISTER, _do_register);
/* /*
* Local variables: * Local variables: