extern struct list per_thread_free_list;
extern struct list per_thread_deinit_list;
+/* initcall caller location */
+extern const struct initcall *caller_initcall;
+extern const char *caller_file;
+extern int caller_line;
+
void hap_register_pre_check(int (*fct)());
void hap_register_post_check(int (*fct)());
void hap_register_post_proxy_check(int (*fct)(struct proxy *));
void *arg1;
void *arg2;
void *arg3;
+ const char *loc_file; /* file where the call is declared, or NULL */
+ int loc_line; /* line where the call is declared, or NULL */
#if defined(USE_OBSOLETE_LINKER)
void *next;
#endif
.arg1 = (void *)(a1), \
.arg2 = (void *)(a2), \
.arg3 = (void *)(a3), \
+ .loc_file = __FILE__, \
+ .loc_line = linenum, \
} : NULL
.arg1 = (void *)(a1), \
.arg2 = (void *)(a2), \
.arg3 = (void *)(a3), \
+ .loc_file = __FILE__, \
+ .loc_line = linenum, \
}; \
if (stg < STG_SIZE) { \
entry.next = __initstg[stg]; \
const struct initcall **ptr; \
if (stg >= STG_SIZE) \
break; \
- FOREACH_INITCALL(ptr, stg) \
+ FOREACH_INITCALL(ptr, stg) { \
+ caller_initcall = *ptr; \
+ caller_file = (*ptr)->loc_file; \
+ caller_line = (*ptr)->loc_line; \
(*ptr)->fct((*ptr)->arg1, (*ptr)->arg2, (*ptr)->arg3); \
+ caller_initcall = NULL; \
+ caller_file = NULL; \
+ caller_line = 0; \
+ } \
} while (0)
#else // USE_OBSOLETE_LINKER
const struct initcall *ptr; \
if (stg >= STG_SIZE) \
break; \
- FOREACH_INITCALL(ptr, stg) \
+ FOREACH_INITCALL(ptr, stg) { \
+ caller_initcall = ptr; \
+ caller_file = (ptr)->loc_file; \
+ caller_line = (ptr)->loc_line; \
(ptr)->fct((ptr)->arg1, (ptr)->arg2, (ptr)->arg3); \
+ caller_initcall = NULL; \
+ caller_file = NULL; \
+ caller_line = 0; \
+ } \
} while (0)
#endif // USE_OBSOLETE_LINKER
* valgrind mostly happy. */
struct list per_thread_deinit_list = LIST_HEAD_INIT(per_thread_deinit_list);
+/* location of current INITCALL declaration being processed, or NULL */
+const struct initcall *caller_initcall = NULL;
+const char *caller_file = NULL;
+int caller_line = 0;
+
/* used to register some initialization functions to call before the checks. */
void hap_register_pre_check(int (*fct)())
{