Sytem call internal and code

This is a discussion on Sytem call internal and code within the Linux Programming forums, part of the Platform Specific Boards category; Hi All, How system call internals could be known ? I mean for example if i take the example of ...

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    1

    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

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,494
    LXR / The Linux Cross Reference

    > The problem is write() system call directly write on console
    No it doesn't.
    It writes wherever the file descriptor is set up to write to.

    > If we want to write the data on some web page then write() system call will not do that
    Yes it will, if you create a socket to your web site.
    Then write() can send data to that site, via the socket.

    > How to redirect out data from console to application like html/web pages ?
    The close(), dup(), dup2() and pipe() calls are for manipulating file descriptors.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    In C/C++ on ALL operating systems, stdout (console output) is a file stream. You can just as easily use write() on a "real" file handle such as an html page as you can anything else, including stdout.

    If you had used write() even once in actual coding, you would be aware of this. I would stay away from the kernel sources until you have at least a basic grasp of C syntax. You will just waste your time and end up horribly confused, as perhaps has already happened.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reading a file with Courier New characters
    By Noam in forum C Programming
    Replies: 3
    Last Post: 07-07-2006, 09:29 AM
  2. Odd memory leaks
    By VirtualAce in forum C++ Programming
    Replies: 11
    Last Post: 05-25-2006, 12:56 AM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Internal working of this code...
    By vasanth in forum C++ Programming
    Replies: 1
    Last Post: 09-15-2004, 08:33 AM
  5. Tutorial review
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 03-22-2004, 08:40 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21