Thread: lsof

  1. #1
    Registered User
    Join Date
    Apr 2011
    Posts
    33

    lsof

    how lsof command can be implemented using c ??
    thanks in advance.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    lsof IS implemented in C
    Go download the source code for it.
    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.

  3. #3
    Registered User
    Join Date
    Apr 2011
    Posts
    33
    I TRIED but i couldnt get anything out of it...
    it would be a great help if you explain or give me a good link with information.(I already googled but in vain)

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    I can't see why I should bother...

    wget implemenation
    Process Control Block

    You'll have lost interest before you get to the end of this message, and will find some other completely random query to ask us about for 24 hours.

    Might I suggest Qt to be getting on with.
    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.

  5. #5
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    Is this person literally trying to create a GNU/Linux styled gaming system from scratch?

    Soma

  6. #6
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    I think he's trying to build some sort of portfolio for senior-level programmers, whether for himself or for the benefit of all on the internet I couldn't say. (Or at least I'm assuming that these outré topics are coming from somewhere else, and not his own fevered brain, as he doesn't seem to actually care about the topics very much himself.)

  7. #7
    Registered User
    Join Date
    Apr 2011
    Posts
    33
    Quote Originally Posted by Salem View Post
    I can't see why I should bother...


    You'll have lost interest before you get to the end of this message,
    Might I suggest Qt to be getting on with.

    I will never lose interset.i just wanted to learn and thought you guys would help me.
    thanks anyway for your opinions.

  8. #8
    Registered User
    Join Date
    Apr 2011
    Posts
    33
    Quote Originally Posted by tabstop View Post
    I think he's trying to build some sort of portfolio for senior-level programmers, whether for himself or for the benefit of all on the internet I couldn't say. (Or at least I'm assuming that these outré topics are coming from somewhere else, and not his own fevered brain, as he doesn't seem to actually care about the topics very much himself.)
    im trying to learn..

  9. #9
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by Dibyayan Chakra View Post
    im trying to learn..
    If that's true, why do you run from a thread the instant learning starts to happen, and just beg for source code -- and not just source code, but annotated source code? After all, if you had actually attempted to learn something from the source of lsof, you would have had questions to ask about the code, not just "explain".

  10. #10
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > im trying to learn..
    Trying to learn what exactly?

    If you think you're going to learn how to program in C, just by reading as much source code as possible, then you're going to be disappointed.

    Nobody becomes a good cook simply by reading lots of cookery books or going to restaurants. They've spent many long hours in the kitchen, learning the skills and making all the mistakes.
    I guarantee you that anyone who can cook will have in the past set fire to something at least once, and let things burn/boil over many times.

    You might know what a segfault is from reading a book, and might even have seen one for real in someone else's code, but until YOU have tried to find one in your own code, it's all just waffle on your part.

    You see, it's the practical experience of having made mistakes which is the real teacher in all of this.
    Experience is how you avoid mistakes; Mistakes are how you get experience to begin with!

    So here, just for you, a simple exercise.
    Quote Originally Posted by Programming assignment for Dibyayan Chakra
    Using the following POSIX API calls
    - opendir(), readdir(), closedir(), stat()
    Implement a simple "ls" command to list files in the current directory.
    The optional "-l" command line parameter causes the program to also display the file size, and the ctime, atime and mtime members of the stat structure.
    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.

  11. #11
    Registered User
    Join Date
    Apr 2011
    Posts
    33

    assignment

    Quote Originally Posted by Salem View Post
    > im trying to learn..
    Trying to learn what exactly?

    If you think you're going to learn how to program in C, just by reading as much source code as possible, then you're going to be disappointed.

    Nobody becomes a good cook simply by reading lots of cookery books or going to restaurants. They've spent many long hours in the kitchen, learning the skills and making all the mistakes.
    I guarantee you that anyone who can cook will have in the past set fire to something at least once, and let things burn/boil over many times.

    You might know what a segfault is from reading a book, and might even have seen one for real in someone else's code, but until YOU have tried to find one in your own code, it's all just waffle on your part.

    You see, it's the practical experience of having made mistakes which is the real teacher in all of this.
    Experience is how you avoid mistakes; Mistakes are how you get experience to begin with!

    So here, just for you, a simple exercise.
    i did it.please give the next one.
    my board exam is nearing so i may be a bit irregular.But i will follow you thats for sure.

  12. #12
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > i did it.please give the next one.
    So post it here then, so I can give you your marks out of 10.
    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.

Popular pages Recent additions subscribe to a feed