Solved

strange struct declaration

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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…
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

737 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