The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
C:system call Dedalus High Level Programming 2 06-23-2009 03:23 AM
system call hegdeshashi Shell Programming and Scripting 10 06-16-2009 01:11 AM
System call in CGI not work tqlam Shell Programming and Scripting 6 03-18-2008 09:52 PM
c system call rangaswamy High Level Programming 1 02-19-2008 01:53 PM
how to differentiate system call from library call muru UNIX for Advanced & Expert Users 2 07-19-2007 11:20 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-24-2009
yuno96 yuno96 is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 1
System Call Wrapper of 'open'

When the programmer use 'open' function, the process is like below.
"open -> system call wrapper of open in Glibc -> syscall_open in kernel"

I found the wrapper of open, but there is no implementation like 'int $80'.
Code:
int
__open (file, oflag)
     const char *file;
     int oflag;
{
  int mode;

  if (file == NULL)
    {
      __set_errno (EINVAL);
      return -1;
    }

  if (oflag & O_CREAT)
    {
      va_list arg;
      va_start(arg, oflag);
      mode = va_arg(arg, int);
      va_end(arg);
    }

  __set_errno (ENOSYS);
  return -1;
}
Please let me know where the wrapper of open is.
  #2 (permalink)  
Old 06-25-2009
mgessner mgessner is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 50
This looks to me like you found a stub that's intended for someone to fill in for a specific system, given that no matter what you do to call it, it will return -1 and set errno. That said, I'm not sure why they would do all the other stuff just to return -1.

You need to be looking in a different place, I think.
  #3 (permalink)  
Old 06-25-2009
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,643
Are you referring to syscall in Linux?

You need to read this page, then download the kernel source if you want.

http://tldp.org/HOWTO/Implement-Sys-...-i386/x50.html
  #4 (permalink)  
Old 06-25-2009
fpmurphy's Avatar
fpmurphy fpmurphy is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2003
Location: Florida
Posts: 1,861
Perhaps the following will help you. Assuming you are using a 32-bit X86 2.6 Linux kernel .....

0x80 is the value of the software interrupt (INT) which performs the transfer to kernel mode via system_call(). See ../arch/x84/kernel/entry_32.S for the system_call() source.

The syscall interface for open() is defined in ../include/linux/syscalls.h
Code:
asmlinkage long sys_open(const char __user *filename, int flags, int mode);
The system call number for open is defined in ../arch/include/asm/unistd_32.h
Code:
#define __NR_open 5
Sponsored Links
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 07:56 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0