LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices



Reply
 
Search this Thread
Old 06-20-2010, 06:26 AM   #1
jeremy28
Member
 
Registered: Sep 2009
Posts: 48

Rep: Reputation: 15
Where is "ioctl.c" in ubuntu?


Hi all

I'm using ubuntu 9.04;

I want to know where is the "ioctl" source code?
It's header file can be found in "/usr/include/sys/ioctl.h"

And is as below:

Code:
#ifndef	_SYS_IOCTL_H
#define	_SYS_IOCTL_H	1

#include <features.h>

__BEGIN_DECLS

/* Get the list of `ioctl' requests and related constants.  */
#include <bits/ioctls.h>

/* Define some types used by `ioctl' requests.  */
#include <bits/ioctl-types.h>

/* On a Unix system, the system <sys/ioctl.h> probably defines some of
   the symbols we define in <sys/ttydefaults.h> (usually with the same
   values).  The code to generate <bits/ioctls.h> has omitted these
   symbols to avoid the conflict, but a Unix program expects <sys/ioctl.h>
   to define them, so we must include <sys/ttydefaults.h> here.  */
#include <sys/ttydefaults.h>

/* Perform the I/O control operation specified by REQUEST on FD.
   One argument may follow; its presence and type depend on REQUEST.
   Return value depends on REQUEST.  Usually -1 indicates error.  */
extern int ioctl (int __fd, unsigned long int __request, ...) __THROW;

__END_DECLS

#endif /* sys/ioctl.h */
I want to access the source code of it: "ioctl.c", specially the implementation of function:
Code:
extern int ioctl (int __fd, unsigned long int __request, ...) __THROW;
Could you guide me where it is?

THX.
 
Old 06-20-2010, 06:42 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 14,273

Rep: Reputation: 2663Reputation: 2663Reputation: 2663Reputation: 2663Reputation: 2663Reputation: 2663Reputation: 2663Reputation: 2663Reputation: 2663Reputation: 2663Reputation: 2663
The file is found in the glibc-2.9 source code :
glibc-2.9/misc/ioctl.c
( find glibc-2.9/ -name ioctl.c )

http://archive.ubuntu.com/ubuntu/poo....9.orig.tar.gz

http://packages.ubuntu.com/source/jaunty/glibc
..
 
Old 09-04-2010, 07:48 AM   #3
jeremy28
Member
 
Registered: Sep 2009
Posts: 48

Original Poster
Rep: Reputation: 15
Hi;

I saw this source and found only this piece of code in it:
Code:
 #include <errno.h>
  #include <sys/ioctl.h>
 
  /* Perform the I/O control operation specified by REQUEST on FD.
     The actual type and use of ARG and the return value depend on   REQUEST.  */

  int
  __ioctl (fd, request)
       int fd;
       unsigned long int request;
  {
    __set_errno (ENOSYS);
    return -1;
  }
  stub_warning (ioctl)
 
  weak_alias (__ioctl, ioctl)
  #include <stub-tag.h>
I want its actual implementation that may consist of a big switch statement that selects the correct behavior according to the "request" argument, either in kernel side or user side!

Could you hep me again?!

TIA.
 
Old 09-07-2010, 12:56 PM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 14,273

Rep: Reputation: 2663Reputation: 2663Reputation: 2663Reputation: 2663Reputation: 2663Reputation: 2663Reputation: 2663Reputation: 2663Reputation: 2663Reputation: 2663Reputation: 2663
Actually not a suject, I am familar with.

Google .. ioctl in linux kernel ..
http://www.google.com/search?hl=en&s...=&oq=&gs_rfai=
> 562,000 hits, this one is the first
http://tldp.org/LDP/lkmpg/2.6/html/x892.html

Please see Example 7-3. ioctl.c : A "100 line file",
but then again, the site is dated 2007.
..

Last edited by knudfl; 09-07-2010 at 01:00 PM.
 
  


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
Weird Perl error with "Inappropriate ioctl for device" bnutting Programming 9 03-12-2012 08:25 AM
intrepid, PS3, update sources list from "ubuntu" to "ports-ubuntu" evdv Linux - Newbie 7 08-18-2009 11:52 AM
"wlanconfig: ioctl: Input/output error " when i try to recreate a vap... CoffeeKing!!! Linux - Networking 0 04-30-2008 04:20 PM
"Inproper ioctl reading somedirs", dirs are readonly pingu Debian 5 05-17-2005 05:22 AM
"ioctl: Operation not permitted" (beep media playe) unholy Linux - Software 1 12-18-2004 07:14 PM


All times are GMT -5. The time now is 04:33 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration