LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 11-21-2008, 04:52 AM   #1
KANT_797
LQ Newbie
 
Registered: Nov 2008
Posts: 2

Rep: Reputation: 0
How to generate system call ?


hi

I have trying do a project on syatem call in linux .I don't understand how i take intiation for this project ?Pls help me?
 
Old 11-21-2008, 04:58 AM   #2
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
man syscalls (overview, description)
man syscall (how to use the syscall command)
 
Old 11-24-2008, 05:59 AM   #3
KANT_797
LQ Newbie
 
Registered: Nov 2008
Posts: 2

Original Poster
Rep: Reputation: 0
[QUOTE=KANT_797;3349710]hi

I have trying do a project on syatem call in linux .I don't understand how i take intiation for this project ?Pls help me?[/QUOTE
I am totally new to Linux.I am starting shell scripting programming & after that now i m reading processes & threads.But as a B.TECH PROJECT I have chosen this topic but I don't understand from where I start.Pls suggest me for this project what I do first?
 
Old 11-24-2008, 09:11 AM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,699
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
All right, let's start with your "shell scripting program." Let's say your script includes this line:
Quote:
echo 'A hollow voice says, "plugh."'
Very soon, the shell is going to need to produce that line of text on the console. But... how does it do that? The answer, ultimately, is that it issues a "system call."

A "system call" is the mechanism that any program must use to ask another part of the operating system to do something that it cannot do on its own, such as "anything at all to do with the physical hardware."

Nearly all of the time, the program doesn't issue the call directly on its own: it uses a pre-existing library of subroutines to do the job. After all, the necessary system-calls on Linux are not the same as those on Windows, nor is the mechanism for issuing the call the same... but a program such as "the shell" can run equally in all of these environments. It does this by means of the libraries which have been "ported to" each of these various environments.

Okay, finally it's time to hand-over the keys to the kernel. This is where your non-privileged program goes hat-in-hand to the privileged kernel-code which, if it so chooses, can do what you ask. There are actually several hardware mechanisms that can be used to accomplish the transition, which is "necessarily one-way." (You can't just go anywhere-you-like in the kernel code: you can only go to specific destinations.)

If you look in the /arch subdirectory of the Linux source-tree, you'll find system-call implementations for each of the various CPU types, and you'll find that, even on a single architecture, Linux can use any one of several available methods. When the kernel is compiled for a particular CPU-type and model, it will be built to use the most-efficient mechanism available. (Only the code to support that mechanism will actually be included. Very-conveniently, the standard macros and functions that are used to generate the calls are also built, at that same time, so that they will use that mechanism.)

Even "good ol' MS-DOS" had such a mechanism, in the form of the INT (software interrupt) instruction. IBM mainframes had the SVC (service call) instruction. These days, we tend to use "call gates." In any case, it's a one-way door that non-privileged programs can use but cannot influence. The capacity to do this is built-in to the hardware.

Last edited by sundialsvcs; 11-24-2008 at 09:15 AM.
 
  


Reply



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
How to call system call from usb driver's code Mr.J Linux - Kernel 4 09-29-2008 03:47 AM
How can i make centos 4.5's system call using vDSO(call *%gs:0x10) instead of int80 tclwp Red Hat 3 08-06-2007 12:07 AM
Calling a system call from a system call? Loc_8 Programming 0 09-16-2006 04:21 PM
what is a system map file and how do i generate one? dr_zayus69 Linux - Software 10 07-01-2006 12:53 AM
Generate a system event to send email ? debian_dummy Debian 2 05-02-2004 04:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 11:43 PM.

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