?
Solved

strange struct declaration

Posted on 1999-01-19
5
Medium Priority
?
242 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 300 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

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

Question has a verified solution.

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

1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
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 find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses
Course of the Month11 days, 20 hours left to enroll

752 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