sevrin
asked on
strange struct declaration
I recently found the following declaration in a program I'm studying:
static struct symbol_table my_symtab = {
#include <linux/symtab_begin.h>
X(printk),
X(vmalloc),
X(vfree),
X(kerneld_send),
X(current_set),
X(sys_call_table),
X(register_symtab_from),
#include <linux/symtab_end.h>
};
I know the symbol_table struct is defined in module.h; but its contents seem to bear no resemblance to the above. Why does the declaration begin and end with the preprocessor instructions, and what exactly do symtab_begin.h and symtab_end.h do? (They're not on my system - Linux 2.0.0 slakware - at all.) Also, what does the X refer to? Is it some obscure preprocessor instruction? (It's not mentioned in Kernighan and Ritchie's book.)
Thanks for any help,
David
static struct symbol_table my_symtab = {
#include <linux/symtab_begin.h>
X(printk),
X(vmalloc),
X(vfree),
X(kerneld_send),
X(current_set),
X(sys_call_table),
X(register_symtab_from),
#include <linux/symtab_end.h>
};
I know the symbol_table struct is defined in module.h; but its contents seem to bear no resemblance to the above. Why does the declaration begin and end with the preprocessor instructions, and what exactly do symtab_begin.h and symtab_end.h do? (They're not on my system - Linux 2.0.0 slakware - at all.) Also, what does the X refer to? Is it some obscure preprocessor instruction? (It's not mentioned in Kernighan and Ritchie's book.)
Thanks for any help,
David
Is X defined in linux/symtab_begin.h?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I found the define X in the
symtab_begin.h
#define X(sym) { _basic_version(sym) }
symtab_begin.h
#define X(sym) { _basic_version(sym) }
ASKER
Ah, a macro. As I say, I don't have symtab_begin.h or symtab_end.h, so it was impossible for me to find out.
Thanks,
David
Thanks,
David
To ozo: Sorry I answered the question at the same time so I didn't see your comment.