LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 05-14-2010, 12:31 AM   #1
ankur0921
LQ Newbie
 
Registered: May 2009
Posts: 25

Rep: Reputation: 0
Thumbs up Sytem call internal and code


Hi All,

How system call internals could be known ? I mean for example if i take the example of write system call of linux kernel, where i can find out the code of write() system call in the kernel source tree ? The problem is write() system call directly write on console.If we want to write the data on some web page then write() system call will not do that ? How to redirect out data from console to application like html/web pages ? Can
anybody suggest something in this direction ?

Thanks in advance..

Ankur
 
Old 05-14-2010, 05:19 PM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by ankur0921 View Post
Hi All,
...
where i can find out the code of write() system call in the kernel source tree ?
...
I think the source of 'write' is in 'glibc', not in kernel.
 
Old 05-15-2010, 03:08 AM   #3
posixculprit
Member
 
Registered: May 2010
Posts: 136

Rep: Reputation: 42
write() attempts to write to a file descriptor of your choice. If you desire to write() to a HTML page, you can very well do that. You just have to open() the file first and close() the file afterwords.

In any case, this: http://bluemaster.iu.hio.no/edu/dark.../syscalls.html and this: http://lxr.linux.no/ may help you with "system call internals".
 
Old 05-15-2010, 03:25 AM   #4
ForzaItalia2006
Member
 
Registered: Dec 2009
Location: Walldorf, Germany
Distribution: (X)Ubuntu, Arch, Gentoo
Posts: 205

Rep: Reputation: 67
As you already noticed, the write(2) system call isn't named that way in the kernel, it is named sys_write (take a look here: http://lxr.linux.no/#linux+v2.6.33/i...yscalls.h#L584). Like Sergei already said, the implementation of the write(2) function is in libc and it's basically a stub for the real system call sys_write and encapsulates the logic to do the system call in assembly (e.g. via int $80 or sysenter on x86 compatible platforms).
 
Old 05-16-2010, 06:17 PM   #5
ankur0921
LQ Newbie
 
Registered: May 2009
Posts: 25

Original Poster
Rep: Reputation: 0
Red face

Hi posixculprit,

Thanks for reply.Can you please elaborate on it ? I mean how the file for a html be made ?If we are downloading a page from server, and want to put some let say login password information , how and what kind of file you are asking ?My main problem is , how to redirect from console to web page ? A System is wrting on console, and i want on html page!!!

Last edited by ankur0921; 05-16-2010 at 06:21 PM.
 
Old 05-16-2010, 07:39 PM   #6
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by ankur0921 View Post
Hi posixculprit,

Thanks for reply.Can you please elaborate on it ? I mean how the file for a html be made ?If we are downloading a page from server, and want to put some let say login password information , how and what kind of file you are asking ?My main problem is , how to redirect from console to web page ? A System is wrting on console, and i want on html page!!!
Which "System" ?
 
Old 05-17-2010, 01:26 AM   #7
posixculprit
Member
 
Registered: May 2010
Posts: 136

Rep: Reputation: 42
It's difficult to understand exactly what you need. I'm guessing that you're trying to send data to a HTTP server or somesuch (i.e. have a program access some username/password protected resource - perhaps a brute force kind of thing?). If this is the case, write() can help you, but you'll be writing to a socket. I suppose you could start with some books on network programming (i.e. UNIX Network Programming by Richard Stevens) or some guides on this topic (i.e. Beej's).

However, it seems you are too young a programmer to have a basic knowledge of the C programming language, and you don't seem to understand how "HTML pages" work. To make a long story short: this project seems out of your league, and no easy answer to your real query can be given. The question as depicted in the thread's title has been answered (more than once, I believe).
 
  


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
LXer: What's In A Name? That Which We Call Qt, By Any Other Name Would Code As Well.. LXer Syndicated Linux News 0 08-12-2009 02:40 AM
OSE system call functions to Linux Sytem Call functions required roshantraj30 Linux - General 0 06-08-2009 02:06 AM
How to call system call from usb driver's code Mr.J Linux - Kernel 4 09-29-2008 03:47 AM
How to call an app from my c++ code? Puckaroo Programming 1 10-30-2006 10:28 AM
function call in kernel code vishalbutte Programming 1 02-15-2006 01:32 PM

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

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