Solved

strange struct declaration

Posted on 1999-01-19
5
235 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
This document is written for Red Hat Enterprise Linux AS release 4 and ORACLE 10g.  Earlier releases can be installed using this document as well however there are some additional steps for packages to be installed see Metalink. Disclaimer: I hav…
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…

920 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

11 Experts available now in Live!

Get 1:1 Help Now