LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 08-19-2006, 12:07 PM   #1
aheak123
LQ Newbie
 
Registered: Aug 2006
Posts: 1

Rep: Reputation: 0
how is my program executed by bash and the kernel


Hello all,
I just wanted to know how the program name and arguments are passed to the kernel, are they passed on the stack or registers. I need a detail explanation (under the hood type) of how a program gets executed. I have read the article "How main() is executed on Linux" by Hyouck "Hawk" Kim (great article), but I still have questions on how the stack is setup before
_start gets control.

thanks
 
Old 08-20-2006, 06:03 AM   #2
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
Moved: This thread is more suitable in Programming and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 08-20-2006, 05:41 PM   #3
aluser
Member
 
Registered: Mar 2004
Location: Massachusetts
Distribution: Debian
Posts: 557

Rep: Reputation: 43
Sounds a little homeworky

You can find out by inspecting the source for _start() in libc or by looking at the kernel code.

You can get _start() by downloading glibc here: http://ftp.gnu.org/gnu/glibc/glibc-2.4.tar.gz . The file you want (for i386) is sysdeps/i386/elf/start.S . The function is pretty well commented.

You can browse the kernel code at LXR:
http://lxr.linux.no/source/fs/binfmt_elf.c#L246 . It looks a little harder to grok.
 
  


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
need help with bash program? ice99 Programming 3 08-11-2005 11:48 AM
Kylix Program can not be executed outside Kylix vinsky2002 Linux - Software 1 01-10-2005 08:35 AM
getting output from a program executed from c++ dfuse Programming 6 08-22-2003 02:24 AM
converting from a bash program to a c program Linh Programming 5 08-01-2003 05:47 PM
bash shell program help embsupafly Programming 7 11-27-2002 12:05 AM

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

All times are GMT -5. The time now is 08:08 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