LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-26-2005, 05:23 AM   #1
kpachopoulos
Member
 
Registered: Feb 2004
Location: Athens, Greece
Distribution: Gentoo,FreeBSD, Debian
Posts: 705

Rep: Reputation: 30
include/linux/types.h and include/linux/posix_types.h


include/linux/types.h
Code:
20 typedef __kernel_fd_set         fd_set;
21 typedef __kernel_dev_t          dev_t;
.......
32 typedef __kernel_mqd_t          mqd_t;
include/linux/posix_types.h
Code:
36 typedef struct {
37         unsigned long fds_bits [__FDSET_LONGS];
38 } __kernel_fd_set;
Why don't we use __kernel_fd_set directly?
What more does "typedef __kernel_fd_set fd_set;" offer us?
This applies to most typedef's in include/linux/types.h; this is just an example.
Thanks
 
Old 11-26-2005, 05:38 AM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
A typedef basically lets you have an alias for something. By using fd_set, you still are using __kernel_fd_set directly, it's just that you have less to type.

Edit: this is what I know about typedef generally, from my knowledge of C++. I hope this is right!
 
Old 11-26-2005, 05:52 AM   #3
kpachopoulos
Member
 
Registered: Feb 2004
Location: Athens, Greece
Distribution: Gentoo,FreeBSD, Debian
Posts: 705

Original Poster
Rep: Reputation: 30
You're right Nylex, but why not write:
Code:
36 typedef struct {
37         unsigned long fds_bits [__FDSET_LONGS];
38 } kernel_fd_set;
instead of

Code:
36 typedef struct {
37         unsigned long fds_bits [__FDSET_LONGS];
38 }__kernel_fd_set;
?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
include files for linux kahcor Fedora 1 05-05-2005 08:51 PM
/usr/include/linux revsteban Debian 1 02-22-2005 10:41 PM
/usr/include/linux contains? alaios Linux - General 4 11-11-2004 10:34 PM
/include/linux/version.h is missing!!! eisheth.zenunim Linux From Scratch 2 03-23-2004 05:32 PM
#include <linux/fs.h> aliyildiz Linux - General 2 12-11-2001 02:48 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration