Solved

strange struct declaration

Posted on 1999-01-19
5
234 Views
Last Modified: 2010-04-20
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
0
Comment
Question by:sevrin
  • 3
5 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1639176
Is X defined in linux/symtab_begin.h?
0
 
LVL 10

Accepted Solution

by:
rbr earned 100 total points
ID: 1639177
Serach for a define X in your header files. The X must be a macro which is replaced by compile time with the structure component.
0
 
LVL 10

Expert Comment

by:rbr
ID: 1639178
I found the define X in the
symtab_begin.h
#define X(sym) { _basic_version(sym) }

0
 

Author Comment

by:sevrin
ID: 1639179
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
0
 
LVL 10

Expert Comment

by:rbr
ID: 1639180
To ozo: Sorry I answered the question at the same time so I didn't see your comment.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
If you use Debian 6 Squeeze and you are tired of looking at the childish graphical GDM login screen that is used by default, here's an easy way to change it. If you've already tried to change it you've probably discovered that none of the old met…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now